-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
54 lines (40 loc) · 1.07 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#! /usr/bin/env bash
# test wether rsnapshot is installed
if [ -z `which rsnapshot` ] ; then
printf "The program 'rsnapshot' cannot be found.\
please install 'rsnapshot' first, before you execute\
this script."
exit 2
fi
if [ -z `which sed` ] ; then
printf "The program 'sed' cannot be found.\
please install 'rsnapshot' first, before you execute\
this script."
exit 2
fi
if [[ `id -u` -eq 0 ]] ; then
echo "You should not execute this script as root"
exit 3
fi
# Defaultls
if [ -z $USB_B_INSTALL_LOC ] ; then
USB_B_INSTALL_LOC=~/.local/bin
fi
if [ -z $USB_B_CONF_LOC ] ; then
USB_B_CONF_LOC=~/.conf
fi
sed -i "s/USER/$USERNAME/g" usb_backup.conf
if ![ -d $USB_B_CONF_LOC ] ; then
mkdir -p $USB_B_CONF_LOC
fi
if ![ -d $USB_B_INSTALL_LOC ] ; then
mkdir -p $USB_B_INSTALL_LOC
export $USB_B_INSTALL_LOC:$PATH
fi
if ![ -d ~/.local/share/applications ] ; then
mkdir -p ~/.local/share/applications
fi
mv usb_backup.conf $USB_B_CONF_LOC
chmod +x usb_backup
mv usb_backup $USB_B_INSTALL_LOC
mv USB_backup.desktop ~/.local/share/applications/