summaryrefslogtreecommitdiff
path: root/modules/40-neofetch/install.sh
blob: 39ef2f27c0762838fed9943ecf736dc95c2704eb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
_script="$(realpath ${BASH_SOURCE[0]})"
_scriptname="$(basename $_script)"
_scriptdir="$(dirname $_script)"
_modulename="$(basename $_scriptdir)"
DOT_MODULE_NAME="neofetch"

function preinstall() {
	if ! [[ -x "$(command -v neofetch)" ]]; then
		PACKAGES+=("neofetch")
	fi
}

function install() {
	# backup old file if it exists and we haven't backed it up before
	if [[ -f "$HOME/.config/neofetch/config.conf" ]] && ! [[ -f "$HOME/.config/neofetch/config.conf.bak" ]] && ! [[ -f "$_scriptdir/.firstrun" ]]; then
		log verbose "making backup"
		cp "$HOME/.config/neofetch/config.conf" "$HOME/.config/neofetch/config.conf.bak"
		touch "$_scriptdir/.firstrun"
	fi

	log info "linking neofetch config"
	mkdir -p "$HOME/.config/neofetch"
	ln -f "$_scriptdir/config.conf" "$HOME/.config/neofetch/config.conf"
}