49 lines
1.2 KiB
Bash
Executable file
49 lines
1.2 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# This file is part of VM-Experiments.
|
|
# Licensed under the GPL-3.0-or-later. See LICENSE for details.
|
|
|
|
trap '' SIGINT SIGTERM
|
|
|
|
while true; do
|
|
read -p "Enter a username (letters, prefferably only lowercase, digits, underscores and hyphens): " username
|
|
chroot /mnt /bin/bash -c "useradd -m '$username'"
|
|
|
|
if [ $? -eq 0 ]; then
|
|
break
|
|
fi
|
|
done
|
|
|
|
while true; do
|
|
read -p "Enter a display name: " fullname
|
|
chroot /mnt /bin/bash -c "usermod -c '$fullname' '$username'"
|
|
|
|
if [ $? -eq 0 ]; then
|
|
break
|
|
fi
|
|
done
|
|
|
|
while true; do
|
|
chroot /mnt /bin/bash -c "passwd '$username'"
|
|
|
|
if [ $? -eq 0 ]; then
|
|
break
|
|
fi
|
|
done
|
|
|
|
while true; do
|
|
read -p "Enter the hostname: " hostname
|
|
chroot /mnt /bin/bash -c "echo $hostname > /etc/hostname"
|
|
|
|
if [ $? -eq 0 ]; then
|
|
break
|
|
fi
|
|
done
|
|
|
|
cp /mnt/root/ca.crt /mnt/usr/local/share/ca-certificates/
|
|
mkdir -p /mnt/usr/share/ca-certificates/mozilla/
|
|
cp /mnt/root/ca.crt /mnt/usr/share/ca-certificates/
|
|
cp /mnt/root/ca.crt /mnt/usr/share/ca-certificates/mozilla/
|
|
cp /mnt/root/ca.crt /mnt/etc/ssl/certs/
|
|
cp /mnt/root/ca.crt /mnt/home/$username/
|
|
chroot /mnt /bin/bash -c "update-ca-certificates"
|