fix some chroot commands

This commit is contained in:
Ward from fusion-voyager-3 2023-10-20 20:35:43 +03:00
parent ce74034b47
commit ea2bf8ee3c
4 changed files with 48 additions and 4 deletions

View File

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

View File

@ -0,0 +1,38 @@
#!/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

@ -16,9 +16,14 @@ chmod +x /var/albius-refind_linux.sh
refind-install refind-install
apt install -y /var/cache/apt/archives/pika-refind-theme*.deb apt install -y /var/cache/apt/archives/pika-refind-theme*.deb
apt install -y /var/cache/apt/archives/booster*.deb apt install -y /var/cache/apt/archives/booster*.deb
locale-gen locale-genlp
useradd -m -k -U pikaos /usr/lib/pika/pikainstall/autoadder pikaos pikaos
echo "pikaos"| passwd --stdin pikaos usermod -a -G sudo pikaos
usermod -a -G lpadmin pikaos
mkdir -p /etc/gdm3
echo '[daemon]\nAutomaticLogin=pikaos\nAutomaticLoginEnable=True' > /etc/gdm3/daemon.conf
mkdir -p /home/pikaos/.config/dconf
chmod 700 /home/pikaos/.config/dconf
mkdir -p /var/lib/AccountsService/users mkdir -p /var/lib/AccountsService/users
echo '[User]\nSession=firstsetup' > /var/lib/AccountsService/users/pikaos echo '[User]\nSession=firstsetup' > /var/lib/AccountsService/users/pikaos
mkdir -p /home/pikaos/.config/autostart mkdir -p /home/pikaos/.config/autostart

View File

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