summaryrefslogtreecommitdiff
path: root/modules/10-ly/install.sh
blob: 415c405c36a72b5d3424f4ec5fd742eefcdf8a34 (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="ly"

function preinstall() {
	PACKAGES+=("ly")
}

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

	log info "linking config.ini"
	rm -rf "/etc/ly/config.ini"
	ln -sf "$_scriptdir/config.ini" "/etc/ly/config.ini"
}