windvn/mods/oobe/data/bin/login

67 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
export PATH="/sbin:/usr/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
CHOICE=1
while true; do
echo "Welcome to windvn!"
echo "1: Finish installation"
echo "2: Open bash"
echo "3: Shut down"
read -p "Choice: " CHOICE
echo ""
if [ "$CHOICE" == "1" ]; then
dpkg-reconfigure keyboard-configuration
udevadm trigger --subsystem-match=input --action=change
apt -y install console-setup locales tzdata
dpkg-reconfigure locales
dpkg-reconfigure tzdata
groupadd -f sudo
while true; do
read -p "First user (Administrator): " NEW_USER
(
set -e
adduser --gecos "" "$NEW_USER"
usermod -a -G sudo "$NEW_USER"
)
if [ "$?" == "0" ]; then
break
else
deluser --remove-home "$NEW_USER"
echo ""
fi
done
for file in "/oobe/setupComplete"/*; do
if [[ -x "$file" ]]; then
source "$file"
fi
done
echo "$HOSTNAME" > /etc/hostname
echo "127.0.0.1 localhost
127.0.1.1 $HOSTNAME
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
" > /etc/hosts
rm "/bin/login"
mv "/bin/login.bak" "/bin/login"
exit
fi
if [ "$CHOICE" == "2" ]; then
bash
fi
if [ "$CHOICE" == "3" ]; then
poweroff
exit
fi
echo ""
done