aboutsummaryrefslogtreecommitdiff
path: root/stow-services
blob: db9350c9433003b3ac0d4e8bdff3f2ae42af331e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
serviceName=$(echo $1 | cut -d'/' -f'2')
if [[ $1 =~ "/" && $serviceName != "" ]]; then	
	if [ -f "$1" ]; then
    if [[ $(echo $1 | cut -d'/' -f1) == "services" ]]; then
		  ln -s $(readlink -f $1) ~/.config/systemd/user/default.target.wants/$serviceName
    elif [[ $(echo $1 | cut -d'/' -f1) == "services-root" ]]; then
      sudo ln -s $(readlink -f $1) /usr/lib/systemd/system/$serviceName
    else
      echo "You can only install service from services and services-root folder !"
    fi
	else
		echo "Warning ! You must be in the dotfile folder to execute this !"
		echo "Sorry the file $1 not found !"
	fi
else
	echo "Syntax: services/<name of the service"
fi