2022-11-20 17:51:35 +01:00
|
|
|
#!/bin/sh
|
|
|
|
# install dots
|
|
|
|
|
|
|
|
# require root
|
|
|
|
if [ "$(whoami)" != "root" ]; then
|
|
|
|
echo "Not running as root."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
clear
|
|
|
|
|
|
|
|
echo "What would you like to do?"
|
|
|
|
echo "[a] Install everything."
|
|
|
|
echo "[q] Quit."
|
|
|
|
echo "[ip] Install all packages."
|
|
|
|
echo "[iw] Install @world file (NOTE: This can be risky sometimes but a backup is created.)."
|
|
|
|
echo "[id] Install portage config files."
|
|
|
|
printf "> "
|
|
|
|
|
|
|
|
read installaction
|
|
|
|
|
|
|
|
# check valid options
|
|
|
|
if [ "$installaction" != "ip" ] && [ "$installaction" != "iw" ] && [ "$installaction" != "id" ] && [ "$installaction" != "a" ] && [ "$installaction" != "q" ]; then
|
|
|
|
echo "Invalid option, try again."
|
|
|
|
sleep 1
|
|
|
|
$0 && exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
curdir="$(pwd)"
|
|
|
|
|
|
|
|
WARN() {
|
|
|
|
echo "WARNING: You are about to install packages. Make sure your /etc/portage/make.conf is set up properly."
|
|
|
|
echo "Do you want to edit it now? (y/n)"
|
|
|
|
printf "> "
|
|
|
|
read edit
|
|
|
|
|
2022-11-20 17:59:46 +01:00
|
|
|
if [ "$edit" != "y" ] && [ "$edit" != "n" ]; then
|
2022-11-20 17:51:35 +01:00
|
|
|
echo "Try again."
|
|
|
|
WARN
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$edit" = "y" ]; then
|
|
|
|
command -v nvim > /dev/null && EDITOR=nvim
|
|
|
|
command -v vim > /dev/null && EDITOR=vim
|
|
|
|
command -v vi > /dev/null && EDITOR=vi
|
|
|
|
command -v $EDITOR > /dev/null && EDITOR=$EDITOR
|
|
|
|
command -v nano > /dev/null && EDITOR=nano
|
|
|
|
|
|
|
|
FINDEDITOR() {
|
|
|
|
if [ "$EDITOR" = "" ]; then
|
|
|
|
echo "Not able to find an editor on your system, please specify one."
|
|
|
|
printf "> "
|
|
|
|
read EDITOR
|
|
|
|
|
|
|
|
command -v $EDITOR > /dev/null || FINDEDITOR
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
FINDEDITOR
|
2022-11-20 18:06:51 +01:00
|
|
|
|
|
|
|
$EDITOR /etc/portage/make.conf
|
2022-11-20 17:51:35 +01:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ "$installaction" = "ip" ]; then
|
|
|
|
WARN
|
|
|
|
cd src
|
|
|
|
./setup-pkgs.sh
|
|
|
|
elif [ "$installaction" = "iw" ]; then
|
|
|
|
WARN
|
|
|
|
cd src
|
|
|
|
./setup-world.sh
|
|
|
|
./update-world.sh
|
|
|
|
elif [ "$installaction" = "id" ]; then
|
|
|
|
cd src
|
|
|
|
./setup.sh
|
|
|
|
elif [ "$installaction" = "q" ]; then
|
|
|
|
exit 0
|
|
|
|
elif [ "$installaction" = "a" ]; then
|
|
|
|
WARN
|
|
|
|
cd src
|
|
|
|
./setup.sh
|
|
|
|
./setup-world.sh
|
|
|
|
./update-world.sh
|
|
|
|
./setup-pkgs.sh
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd $curdir
|