summaryrefslogtreecommitdiff
path: root/modules/50-discord/install.sh
blob: 1589a5cb9dc4b50f6b0e59b7f8180e6824c47bf3 (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 discord)" ]]; then
		PACKAGES+=("discord" "alsa-lib")
	fi
}

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

	log info "linking hh3 config"
	mkdir -p "$HOME/.config/hh3"
	ln -f "$_scriptdir/discord.json" "$HOME/.config/hh3/discord.json"
}