Added commands to create default users

This commit is contained in:
Krizsán Péter 2024-11-04 17:28:29 +01:00
parent 8cd884f475
commit 94615da0f1

View File

@ -190,15 +190,15 @@ if [ -n "$NET_SCRIPT" ] ; then
sed -i "s/^.*PKR-LINUX.local/127.0.0.1 PKR-LINUX.local/" "$NET_SCRIPT"
if [[ $2 == *"wpa_supplicant"* ]] ; then
sed -i "/^cat > \/etc\/systemd\/network/i cat > \/etc\/systemd\/network\/20-wlan0.network << \"EOF\"\n\[Match\]\nName=wlan0\n\n\[Network\]\nDHCP=yes\nEOF" "$NET_SCRIPT"
sed -i "/20-wlan0.network/i mkdir -pv \/etc\/wpa_supplicant\ncat > \/etc\/wpa_supplicant\/wpa_supplicant-wlan0.conf << \"EOF\"\nnetwork=\{\nssid=\"T-E797F1\"\n#psk=\"Q2729eq9338qQJ7s\"\npsk=a41c0853c906d7db271a007af55afa9dce2efa8efa994d614b2d7b1d0b38bc72\n\}\nEOF" "$NET_SCRIPT"
sed -i "/^cat > \/etc\/systemd\/network/i cat > /etc/systemd/network/20-wlan0.network << \"EOF\"\n\[Match\]\nName=wlan0\n\n\[Network\]\nDHCP=yes\nEOF" "$NET_SCRIPT"
sed -i "/20-wlan0.network/i mkdir -pv /etc/wpa_supplicant\ncat > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf << \"EOF\"\nnetwork=\{\nssid=\"T-E797F1\"\n#psk=\"Q2729eq9338qQJ7s\"\npsk=a41c0853c906d7db271a007af55afa9dce2efa8efa994d614b2d7b1d0b38bc72\n\}\nEOF" "$NET_SCRIPT"
fi
fi
# Patch LFS kernel script to keep build folder
# Patch LFS kernel script to keep build folder and add new user
KERNEL_SCRIPT=$(find "$DIR_COMMANDS" -type f -iname "*-kernel")
sed -i "/^rm -rf \$PKGDIR/s/^/#/" "$KERNEL_SCRIPT"
sed -i "/^EOF$/a groupadd pkr\nuseradd -s /bin/bash -g pkr -m -k /dev/null pkr\nusermod -a -G audio,video,input,systemd-journal" "$KERNEL_SCRIPT"
sed -i "/^EOF$/a # Add new user\ngroupadd pkr\nuseradd -s /bin/bash -g pkr -m -k /dev/null pkr\nusermod -a -G audio,video,input,systemd-journal\npasswd -s pkr <<< pkr\npasswd -s root <<< root" "$KERNEL_SCRIPT"
# Check if wpa_supplicant is required and patch its install script if yes
if [[ $2 == *"wpa_supplicant"* ]] ; then