windvn/mods/oobe/data/bin/login

74 lines
1.4 KiB
Plaintext
Raw Normal View History

2022-08-10 00:00:49 +00:00
#!/bin/bash
export PATH="/sbin:/usr/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
export HOME="/root"
2022-08-10 00:00:49 +00:00
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
service console-setup.sh restart
2022-08-25 19:07:03 +00:00
udevadm trigger --subsystem-match=input --action=change
service keyboard-setup.sh restart
2022-08-15 06:31:02 +00:00
apt -y install locales tzdata
2022-08-10 00:00:49 +00:00
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"
2022-09-21 10:46:14 +00:00
adduser "$NEW_USER" "sudo"
2022-08-10 00:00:49 +00:00
)
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
2022-05-10 10:50:10 +00:00
127.0.1.1 $HOSTNAME
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
2022-08-10 00:00:49 +00:00
ff02::2 ip6-allrouters
" > /etc/hosts
2022-05-10 10:50:10 +00:00
2022-08-10 00:00:49 +00:00
rm "/bin/login"
mv "/bin/login.bak" "/bin/login"
echo "Setup complete. Press ENTER to reboot."
read -p ""
reboot
2022-08-10 00:00:49 +00:00
fi
if [ "$CHOICE" == "2" ]; then
bash
fi
if [ "$CHOICE" == "3" ]; then
poweroff
exit
fi
echo ""
done