fix user creation

This commit is contained in:
Ward from fusion-voyager-3 2023-10-20 20:57:34 +03:00
parent 87338b59fc
commit 13e0e0228e
4 changed files with 3 additions and 41 deletions

View File

@ -1,4 +1,4 @@
pikainstall (1.0.5-100pika4) pikauwu; urgency=medium
pikainstall (1.0.5-100pika5) pikauwu; urgency=medium
* Initial release.

View File

@ -1,38 +0,0 @@
#!/bin/bash
ROOT_UID=0
SUCCESS=0
E_USEREXISTS=70
# Run as root, of course. (this might not be necessary, because we have to run the script somehow with root anyway)
if [ "$UID" -ne "$ROOT_UID" ]
then
echo "Must be root to run this script."
exit $E_NOTROOT
fi
#test, if both argument are there
if [ $# -eq 2 ]; then
username=$1
pass=$2
# Check if user already exists.
grep -q "$username" /etc/passwd
if [ $? -eq $SUCCESS ]
then
echo "User $username does already exist."
echo "please chose another username."
exit $E_USEREXISTS
fi
#Preerequisite for mkpasswd : whois
useradd -p `mkpasswd "$pass"` -d /home/"$username" -m -g users -s /bin/bash "$username"
#Allow no one else to access the home directory of the user
chmod 750 /home/"$username"
echo "the account is setup"
else
echo " Expected usage: ./autoadder username password"
fi
exit 0

View File

@ -17,7 +17,8 @@ refind-install
apt install -y /var/cache/apt/archives/pika-refind-theme*.deb
apt install -y /var/cache/apt/archives/booster*.deb
locale-genlp
/usr/lib/pika/pikainstall/autoadder pikaos pikaos
useradd -m -k -U pikaos
echo pikaos:pikaos | sudo chpasswd
usermod -a -G sudo pikaos
usermod -a -G lpadmin pikaos
mkdir -p /etc/gdm3

View File

@ -13,5 +13,4 @@ genfstab -U "$1" > "$1"/etc/fstab
cat "$1"/etc/fstab | grep -v zram > "$1"/etc/fstab
mkdir -pv "$1"/usr/lib/pika/pikainstall/
cp -rvf /usr/lib/pika/pikainstall/pika-install-chroot.sh "$1"/usr/lib/pika/pikainstall/
cp -rvf /usr/lib/pika/pikainstall/autoadder "$1"/usr/lib/pika/pikainstall/
chroot "$1" /bin/bash -c "su - -c /usr/lib/pika/pikainstall/pika-install-chroot.sh"