Files
linux-scripts/alpine/alpine-essentials.sh
2023-12-02 07:32:16 -06:00

30 lines
743 B
Bash

#!/bin/ash
# apk update and install essentials
apk update && apk upgrade
apk add nano sudo pwgen curl wget qemu-guest-agent git bash-doc bash-completion --no-cache
# change default shell to bash
isInFile=$(cat /etc/passwd | grep -c "/bin/bash")
if [ $isInFile -eq 0 ]
then
sed -i 's/ash/bash/g' /etc/passwd
fi
# add akanealw to sudo users
if [[ ! -f /etc/sudoers.d/akanealw ]]
then
echo "akanealw ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/akanealw
fi
# edit issue file
isInFile=$(cat /etc/issue | grep -c "192.168.1")
if [ $isInFile -eq 0 ]
then
ip address show eth0 | awk '/inet / {print $2}' | cut -d/ -f1 >> /etc/issue
echo "" >> /etc/issue
fi
# remove all motd
rm /etc/motd > /dev/null 2>&1