-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkaffeine_install.sh
73 lines (68 loc) · 1.65 KB
/
kaffeine_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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
if test -f scanfile.dvb
then
DIR1="$HOME/.kde/share/apps/kaffeine"
DIR2="$HOME/.local/share/kaffeine"
if test -d "$DIR1"
then
KDIR="$DIR1"
elif test -d "$DIR2"
then
KDIR="$DIR2"
fi
read -p "Enter Kaffeine directory location [$KDIR]: " NDIR
if [[ "$NDIR" == "" ]]
then
NDIR="$KDIR"
fi
if [[ "$NDIR" == "" ]]
then
echo "ERROR: Provided directory is invalid";
exit 1;
fi
if test -d "$NDIR"
then
DVBFILE="$NDIR/scanfile.dvb"
if test -f $DVBFILE
then
echo "scanfile.dvb already exists at target location"
read -p "Do you want to replace it [y/N]: " response
if [[ "$response" == "y" ]] || [[ "$response" == "Y" ]]
then
cp scanfile.dvb "$DVBFILE"
echo "Done!"
exit 0;
else
read -p "Do you want to append to the file instead? [y/N]: " response
if [[ "$response" == "y" ]] || [[ "$response" == "Y" ]]
then
x=0;
while read -r line
do
x=$(($x+1))
if [[ $x > 2 ]]
then
echo $line >> "$DVBFILE"
fi
done < "scanfile.dvb"
echo "Done!"
exit 0
else
echo "Aborted"
exit 0;
fi
fi
else
cp scanfile.dvb "$DVBFILE"
echo "Done!"
exit 0
fi
else
echo "ERROR: Provided directory does not exist!";
exit 1;
fi
else
echo "ERROR: scanfile.dvb not found!"
echo "Make sure to put scanfile.dvb in the same directory as the script"
exit 1;
fi