2020-10-28 03:02:56 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
err(){
|
|
|
|
echo "$(tput bold)$(tput setaf 1)==> $@ $(tput sgr0)"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
msg(){
|
|
|
|
echo "$(tput bold)$(tput setaf 2)==> $@ $(tput sgr0)"
|
|
|
|
}
|
|
|
|
|
|
|
|
msg "Initializing pacman keyrings..."
|
|
|
|
pacman-key --init
|
|
|
|
pacman-key --populate archlinux
|
|
|
|
msg "Installing essential packages..."
|
2020-11-09 17:02:27 +00:00
|
|
|
pacman -Syu base base-devel xorg pulseaudio nano --noconfirm
|
2020-11-09 14:08:19 +00:00
|
|
|
msg "Installing servicectl..."
|
|
|
|
mkdir -p /usr/local/share/servicectl/enabled
|
|
|
|
curl -L 'https://raw.githubusercontent.com/lemniskett/servicectl/master/servicectl' > /usr/local/share/servicectl/servicectl 2>/dev/null
|
|
|
|
curl -L 'https://raw.githubusercontent.com/lemniskett/servicectl/master/serviced' > /usr/local/share/servicectl/serviced 2>/dev/null
|
|
|
|
chmod +x /usr/local/share/servicectl/service{d,ctl}
|
|
|
|
ln -s /usr/local/share/servicectl/servicectl /usr/local/bin/servicectl
|
|
|
|
ln -s /usr/local/share/servicectl/serviced /usr/local/bin/serviced
|
2020-11-09 17:02:27 +00:00
|
|
|
msg "Setting up locale..."
|
|
|
|
echo "Uncomment needed locale, enter to continue"
|
|
|
|
read
|
|
|
|
nano /etc/locale.gen
|
|
|
|
locale-gen
|
|
|
|
msg "Setting up timezone..."
|
|
|
|
echo "Enter your timezone, for example : \"Asia/Jakarta\""
|
|
|
|
while true; do
|
|
|
|
read TIMEZONE \
|
|
|
|
&& [[ -e /usr/share/zoneinfo/$TIMEZONE ]] \
|
2020-11-09 17:07:10 +00:00
|
|
|
&& ln -s /usr/share/zoneinfo/$TIMEZONE /etc/localtime \
|
2020-11-09 17:02:27 +00:00
|
|
|
&& break \
|
2020-11-25 12:27:27 +00:00
|
|
|
|| echo "Timezone not found, enter it again."
|
2020-11-09 17:02:27 +00:00
|
|
|
done
|
2020-10-28 03:02:56 +00:00
|
|
|
msg "Creating user account..."
|
2020-11-08 15:36:35 +00:00
|
|
|
CHROOT_USER="$(cat /tmp/archbox_user)"
|
2020-10-28 03:02:56 +00:00
|
|
|
useradd -m $CHROOT_USER
|
|
|
|
gpasswd -a $CHROOT_USER wheel
|
|
|
|
echo "Enter root password"
|
2020-11-08 15:42:18 +00:00
|
|
|
while true; do
|
|
|
|
passwd && break
|
|
|
|
done
|
2020-10-28 03:02:56 +00:00
|
|
|
echo "Enter $CHROOT_USER password"
|
2020-11-08 15:42:18 +00:00
|
|
|
while true; do
|
|
|
|
passwd $CHROOT_USER && break
|
|
|
|
done
|
2020-10-28 03:02:56 +00:00
|
|
|
sed -i 's/# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/g' /etc/sudoers
|
2020-11-17 18:48:28 +00:00
|
|
|
echo "Don't forget to run '/usr/local/share/archbox/bin/archboxinit start' in host on boot"
|