-
Notifications
You must be signed in to change notification settings - Fork 6
/
pva
129 lines (85 loc) · 3.31 KB
/
pva
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/bash
if [ "$USER" == "root" ]; then
if [ ! -f /root/.config/pva.root.overwrite ]; then
echo "please, do not run this as root, it does only work for desktopsessions!"
exit;
fi
fi
cd /usr/share/pva/
DATE=$(date -R)
echo "PVA starting $DATE" >> $HOME/.var/log/pva.log
if [ ! -e $HOME/.config/pva ]; then
mkdir -p $HOME/.config/pva/conf.d
fi
if [ ! -e $HOME/.cache/pva ]; then
mkdir -p $HOME/.cache/pva/audio
fi
if [ ! -f $HOME/.config/pva/conf.d/02-paths.conf ]; then
echo "path:\"video\",\"$HOME/Videos\"" > $HOME/.config/pva/conf.d/02-paths.conf
echo "path:\"pics\",\"$HOME/Bilder\"" >> $HOME/.config/pva/conf.d/02-paths.conf
echo "path:\"music\",\"$HOME/Musik\"" >> $HOME/.config/pva/conf.d/02-paths.conf
echo "path:\"docs\",\"$HOME/Dokumente\"" >> $HOME/.config/pva/conf.d/02-paths.conf
fi
if [ ! -e $HOME/.var/log ]; then
mkdir -p $HOME/.var/log
fi
if [ -e $HOME/.config/systemd/user/pvatimer.service ]; then
# WE DON'T NEED THIS ANYMORE
#
# mkdir -p $HOME/.config/systemd/user/
# cp systemd/pvatimer.service $HOME/.config/systemd/user/pvatimer.service
rm -f $HOME/.config/systemd/user/pvatimer.service
fi
if [ -e $HOME/.config/systemd/user/pvatimer.timer ]; then
# WE DON'T NEED THIS ANYMORE
#
# mkdir -p $HOME/.config/systemd/user/
# cp systemd/pvatimer.timer $HOME/.config/systemd/user/pvatimer.timer
systemctl --user disable pvatimer.timer
rm -f $HOME/.config/systemd/user/pvatimer.timer
fi
if [ ! -e $HOME/.config/pva/kspass.txt ]; then
echo "$RANDOMkeystore$RANDOM" | /usr/bin/sha256sum | sed -e "s/ *-.*$//" > $HOME/.config/pva/kspass.txt
fi
if [ ! -e $HOME/.config/pva/.keystore ]; then
storepass=$(cat $HOME/.config/pva/kspass.txt)
NAME=$(grep "^conf:.*keyword" /etc/pva/conf.d/* $HOME/.config/pva/conf.d/* | tail -n 1 | sed -e "s/^.*,//g" -e "s/\"//g")
if [ "$NAME" != "" ]; then
LANG=C echo "$NAME
PVA Server $HOSTNAME
PVA
unkown
unkown
DE
Yes" | LANG=C /usr/bin/keytool -genkey -alias PVA -keyalg RSA -validity 3650 -storepass "$storepass" -storetype pkcs12 -keystore $HOME/.config/pva/.keystore 2>/dev/null
else
LANG=C echo "Carola
PVA Server $HOSTNAME
PVA
unkown
unkown
DE
Yes" | LANG=C /usr/bin/keytool -genkey -alias PVA -keyalg RSA -validity 3650 -storepass "$storepass" -storetype pkcs12 -keystore $HOME/.config/pva/.keystore 2>/dev/null
fi
fi
MLANG=$(grep "^conf:.*lang_short" /etc/pva/conf.d/* $HOME/.config/pva/conf.d/* $HOME/.config/pva/pva.conf | tail -n 1 | sed -e "s/^.*,//g" -e "s/\"//g")
MODEL=$(ls -d *-$MLANG-*);
GREETING=$(grep "^conf:.*greeting" /etc/pva/conf.d/* $HOME/.config/pva/conf.d/* | tail -n 1 | sed -e "s/^.*,//g" -e "s/\"//g")
if [ "$GREETING" != "" ]; then
SAY=$(grep say $HOME/.config/pva/pva.conf| sed -e "s/^.*,//g" -e "s/\"//g" -e "s/%VOICE/$MLANG/g" -e "s/x:x/ /g")
if [ "$SAY" == "" ]; then
SAY="/usr/local/sbin/say"
fi
$SAY "$GREETING" &
fi
ICON=$(ps auxf|grep -v grep|grep -c pvatrayicon)
if [ "$ICON" -eq 0 ]; then
NAME=$(grep "^conf:.*keyword" /etc/pva/conf.d/* $HOME/.config/pva/conf.d/* | tail -n 1 | sed -e "s/^.*,//g" -e "s/\"//g")
if [ "$NAME" != "" ]; then
./pvatrayicon.py "$NAME" >> $HOME/.var/log/pva.log &
else
./pvatrayicon.py "PVA" >> $HOME/.var/log/pva.log &
fi
fi
./start.sh &
./pva.py -m $MODEL >> $HOME/.var/log/pva.log