2017-12-06 18:30:31 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# =======================================
|
|
|
|
# Functions
|
|
|
|
# =======================================
|
|
|
|
|
|
|
|
# Ask a question and return true or false based on the users input
|
|
|
|
function yes_or_no {
|
|
|
|
while true; do
|
|
|
|
read -p "$* [y/n]: " yn
|
|
|
|
case $yn in
|
|
|
|
[Yy]*) return 0 ;;
|
|
|
|
[Nn]*) echo "Aborted" ; return 1 ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
# moves all fonts into the fonts directory (overwriting existing files)
|
|
|
|
function install_fonts {
|
|
|
|
yes | cp -rf ./fonts/*.ttf ~/.fonts
|
|
|
|
}
|
|
|
|
|
|
|
|
# install basic rice files
|
|
|
|
function install_rice {
|
|
|
|
mkdir ~/.config/i3
|
|
|
|
yes | cp -rf ../* ~/.config/i3
|
|
|
|
}
|
|
|
|
|
|
|
|
# install other configs
|
|
|
|
function install_config {
|
2017-12-06 19:10:41 +01:00
|
|
|
rm ~/.notify-osd && mv notify-osd/notify-osd ~/.notify-osd
|
2017-12-06 18:30:31 +01:00
|
|
|
rsync -av ./config ~/.config
|
|
|
|
}
|
|
|
|
|
|
|
|
# Installs the dependencies on Arch Linux
|
|
|
|
function install_dependencies {
|
2017-12-06 19:10:41 +01:00
|
|
|
sudo pacman -S $(cat dependencies/pacman.txt | sed ':a;N;$!ba;s/\n/ /g')
|
|
|
|
yaourt -S --noconfirm $(cat dependencies/aur.txt | sed ':a;N;$!ba;s/\n/ /g')
|
2017-12-06 18:30:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# list the dependencies file
|
|
|
|
function list_dependencies {
|
|
|
|
echo ""
|
|
|
|
echo "=========================="
|
|
|
|
echo ""
|
2017-12-06 19:10:41 +01:00
|
|
|
cat dependencies/pacman.txt
|
|
|
|
cat dependencies/aur.txt
|
2017-12-06 18:30:31 +01:00
|
|
|
echo ""
|
|
|
|
echo "=========================="
|
|
|
|
echo ""
|
|
|
|
}
|
|
|
|
|
|
|
|
# Run the intro bit
|
|
|
|
function intro {
|
|
|
|
echo "This will install my i3rice".
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# =======================================
|
|
|
|
# Main loop
|
|
|
|
# =======================================
|
|
|
|
|
|
|
|
# Run the intro function
|
|
|
|
intro
|
|
|
|
|
2017-12-06 19:10:41 +01:00
|
|
|
yes_or_no "Do you want to continue?" &&
|
|
|
|
|
2017-12-06 18:30:31 +01:00
|
|
|
# Ask for dependency installation
|
|
|
|
list_dependencies
|
2017-12-06 19:10:41 +01:00
|
|
|
yes_or_no "Do you want to install the list of applications above? (might prompt for password)" && install_dependencies
|
|
|
|
|
|
|
|
# Ask for config installation
|
|
|
|
yes_or_no "Do you want to install the config files?" && install_config
|
2017-12-06 18:30:31 +01:00
|
|
|
|
|
|
|
# Ask for font installation
|
|
|
|
yes_or_no "Do you want to install the fonts?" && install_fonts
|
|
|
|
|
|
|
|
# Ask the user whether it wants to continue
|
|
|
|
yes_or_no "Are you sure you want to install my rice?" && install_rice
|