-
Notifications
You must be signed in to change notification settings - Fork 27
/
installe2.sh
executable file
·68 lines (59 loc) · 1.27 KB
/
installe2.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
#!/bin/bash
D=$(pushd $(dirname $0) &> /dev/null; pwd; popd &> /dev/null)
E2_USERNAME="root"
usage (){
echo "usage: HOST [USERNAME PASSWORD]"
return
}
if [ -n "$1" ];
then
E2_HOST=$1
fi
if [ -n "$2" ];
then
E2_USERNAME=$2
fi
if [ -n "$3" ];
then
E2_PASSWORD=$3
fi
if [ -z $E2_HOST ]; then
usage
exit 1
fi
with_pass=
if [ $# -eq 5 ]; then
with_pass=1
fi
echo "connection parameters: $E2_HOST $E2_USERNAME $E2_PASSWORD"
echo "creating ipk..."
${D}/create_ipk.sh > /dev/null
IPK_NAME=$(ls -vt ${D}|grep '\.ipk'|head -n 1)
echo $IPK_NAME
echo "uploading '${IPK_NAME}' to $E2_HOST..."
if [ -f "$with_pass" ]; then
ftp -n $E2_HOST <<- EOFFTP > /dev/null
user $E2_USERNAME $E2_PASSWORD
binary
cd /tmp
lcd ${D}
put $IPK_NAME
bye
EOFFTP
else
scp $IPK_NAME $E2_USERNAME@$E2_HOST:/tmp
fi
echo "installing '${IPK_NAME}' to $E2_HOST..."
if [ -f "$with_pass" ]; then
sshpass -p $E2_PASSWORD ssh $E2_USERNAME@$E2_HOST <<- EOFSSH > /dev/null
opkg remove enigma2-plugin-extensions-subssupport
opkg --force-downgrade install /tmp/$IPK_NAME
rm /tmp/$IPK_NAME
EOFSSH
else
ssh $E2_USERNAME@$E2_HOST <<- EOFSSH > /dev/null
opkg remove enigma2-plugin-extensions-subssupport
opkg --force-downgrade install /tmp/$IPK_NAME
rm /tmp/$IPK_NAME
EOFSSH
fi