Files
colorshell/install.sh
T
2025-05-15 18:29:49 -03:00

88 lines
2.8 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/bash
source ./utils.sh
set -e
trap "printf \"\nOk, quitting beacuse you entered an exit signal. (SIGINT).\n\"; exit 1" SIGINT
trap "printf \"\nOh noo!! Some application just killed the script!\"; exit 2" SIGTERM
XDG_CONFIG_HOME=$(sh -c '[[ ! -z "$XDG_CONFIG_HOME" ]] && echo "$XDG_CONFIG_HOME" || echo "$HOME/.config"')
function Apply_wallpapers() {
echo -n "Would you also like to apply the wallpapers folder? :3 [y/n] "
read answer
printf "\n"
if [[ $answer =~ "y" ]]; then
echo "Thanks for choosing! Please remember that I am not the author of the wallpapers!"
echo "You can see sources in the repo: https://github.com/retrozinndev/colorshell/WALLPAPERS.md"
echo "-> Copying wallpapers to ~/wallpapers"
mkdir -p $HOME/wallpapers
cp -f ./wallpapers/* $HOME/wallpapers
else
echo "Ok! The wallpaper is yours to choose!"
echo "Expect some Hyprland source and color errors, it happens because there aren't colors to source when you don't install wallpapers right away, so you have to do it yourself."
echo "Tip: create the ~/wallpapers directory, put your wallpapers there and press ´SUPER + W´ to select :3"
fi
}
#########
# Start #
#########
Print_header
echo -e "colorshell is a project made by retrozinndev. source: https://github.com/retrozinndev/colorshell\n"
sleep .5
echo "Welcome to the colorshell installation script!"
# Warn user of possible problems that can happen
echo "!!!WARNING!!! By running this script, you assume total responsability for any issues that may occur with your filesystem"
echo -n "Do you want to start the shell installation? [y/n] "
[[ ! $1 == "dots" ]] && read input || printf "\n"
if [[ $1 == "dots" ]] || [[ $input =~ "y" ]]; then
Send_log "Starting installation...\n"
for dir in ${config_dirs[@]}; do
dest=$XDG_CONFIG_HOME/$dir
echo "-> Installing $dir in $dest"
mkdir -p "$dest" # create parents
if [[ -f "./$dir" ]]; then
rm -r "$dest" # delete unused directory
cp -f ./$dir "$dest" # copy actual file
else
cp -rf ./$dir/* "$dest" # force-copy content
fi
done
echo "-> Copying default user config"
cp -rf ./hypr/user $XDG_CONFIG_HOME/hypr
echo "-> Copying default hyprpaper.conf"
cp -f ./hypr/hyprpaper.conf $XDG_CONFIG_HOME/hypr
# Ask if user also wants to install default wallpapers
Apply_wallpapers
if ! [[ $1 == "dots" ]]; then
echo "Ah yes! Looks like it's installed, yay :3"; sleep .8
echo "If you find any issue, please report it in: https://github.com/retrozinndev/colorshell/issues"; sleep .5
echo "Thanks for using colorshell! I really appreciate that :D"
printf "\n"
exit 0
fi
Send_log "colorshell is installed!"
exit 0
fi
printf "Ok, doing as you said! Bye bye!\n"
exit 0