forked from grantmcwilliams/PlexForBoxee
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmkapp.sh
More file actions
executable file
·80 lines (76 loc) · 2.76 KB
/
mkapp.sh
File metadata and controls
executable file
·80 lines (76 loc) · 2.76 KB
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
#!/bin/bash
#repository project dir has to be the same name as the source project dir
#eg. PlexForBoxee-beta
UDIR=${PWD##*/}
UPLOADDIR=${UDIR,,}
APPREPO="192.168.1.101"
APPPATH="/var/www/html/grantmcwilliams.com/${UPLOADDIR}"
TMPDIR=$(mktemp -d)
echo "Please enter PlexforBoxee app version"
read APPVERSION
if [[ ! $APPVERSION =~ ^[0-9]\.[0-9][0-9]?$ ]] ;then
echo "Not a proper version number"
echo "Enter a number in the following format 1.5"
exit 1
fi
yesno()
{
echo -n "$1? <y|n> "
read ANS
while true ;do
case $ANS in
[yY] | [yY][Ee][Ss] ) return 0 ;;
[nN] | [n|N][O|o] ) return 1 ;;
*) echo "Invalid input" ;;
esac
done
}
if [[ -d ./app-files ]] ;then
if [[ -d ./app-files/plexee.plexforboxee ]] ;then
rm -Rf app-files/plexee.plexforboxee
fi
cp -Rf plexee.plexforboxee app-files
cd app-files
if [[ -f plexee.plexforboxee/descriptor.xml ]] ;then
sed "s/<version>[0-9]\.[0-9]<\/version>/<version>$APPVERSION<\/version>/g" plexee.plexforboxee/descriptor.xml > ${TMPDIR}/descriptor.xml
fi
cat ${TMPDIR}/descriptor.xml
if yesno "Does this look OK" ;then
cat ${TMPDIR}/descriptor.xml > plexee.plexforboxee/descriptor.xml
fi
if [[ -f plexee.plexforboxee-${APPVERSION}.zip ]];then
rm -f plexee.plexforboxee-${APPVERSION}.zip
fi
zip -r "plexee.plexforboxee-${APPVERSION}.zip" plexee.plexforboxee
ln -s plexee.plexforboxee-${APPVERSION}.zip plexee.plexforboxee-latest.zip
echo "Upload and sign the zip file at http://bbx.boxee.tv/developer/appedit?appid=plexee.plexforboxee"
echo "then download the signature file to $PWD and resume this script"
read
if [[ ! -f "plexee.plexforboxee-${APPVERSION}.zip.xml" ]] ;then
echo "Unable to find signature file"
echo "Download it to $PWD and resume this script"
if [[ ! -f "plexee.plexforboxee-${APPVERSION}.zip.xml" ]] ;then
echo "Unable to find signature file - exiting"
exit 1
fi
fi
if ! scp plexee.plexforboxee-${APPVERSION}.zip* "root@${APPREPO}:${APPPATH}/download" ;then
echo "Unable to upload plexee.plexforboxee-${APPVERSION}.zip and signature to ${APPREPO} - exiting"
exit 1
fi
if ! ssh root@${APPREPO} "chmod 777 ${APPPATH}/download ; restorecon ${APPPATH}/download" ;then
echo "Unable to change permissions on ${APPPATH}/download"
fi
if scp root@${APPREPO}:${APPPATH}/index.xml ${TMPDIR}/index.xml ; then
sed -i "s/<version>[0-9]\.[0-9][0-9]?<\/version>/<version>${APPVERSION}<\/version>/g" ${TMPDIR}/index.xml
sed -i "s/(v. [0-9]\.[0-9][0-9]?)/(v. ${APPVERSION})/g" ${TMPDIR}/index.xml
else
echo "Unable to download ${APPPATH}/index.xml -exiting"
exit 1
fi
if ! scp ${TMPDIR}/index.xml ${APPPATH}/download/plexee.plexforboxee-latest.zip "root@${APPREPO}:${APPPATH}/" ; then
echo "Unable to upload new repository index - exiting"
exit 1
fi
rm -Rf ${TMPDIR}
fi