summarylogtreecommitdiffstats
path: root/yeet.install
blob: 60aa39f73cd31511f0cf762a87fbd065bab5fde8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
post_install() {
	echo
	echo -e "\e[1;34m ==> yeet has been successfully installed! Thanks for using it.\e[0m"
	echo
}

post_upgrade() {
	echo

	echo -e "\e[1;34m ==> Checking for config file...\e[0m"
	user=$(who | awk '{ print $1 }')
	CONFIG_FILE_PATH="/home/$user/.config/yeet/yeet.conf"
	if [[ -f "$CONFIG_FILE_PATH" ]]; then
		echo -e "\e[1;32m ==> Found config file at $CONFIG_FILE_PATH\e[0m"
		echo -e "\e[1;34m ==> Updating config vars (BREAKING 0.3.0 => 0.4.0) (YEET_CACHE_DIR => CACHE_DIR; AUR_URL => AUR_BASE_URL)\e[0m"
		sed -i 's/YEET_CACHE_DIR/CACHE_DIR/g' "$CONFIG_FILE_PATH"
		sed -i 's/AUR_URL/AUR_BASE_URL/g' "$CONFIG_FILE_PATH"
		echo -e "\e[1;32m ==> Updated successfully!\e[0m"
	else
		echo -e "\e[1;31m ==> Did not find config file at $CONFIG_FILE_PATH; skipping config file patch\e[0m"
	fi

	echo
}