-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpkgMe
executable file
·87 lines (82 loc) · 2.77 KB
/
pkgMe
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
#!/bin/csh
cd war
set NAME = 'Jaxogram'
if ($USER == 'pgr') then
set SERVER_URL = 'http://10.110.2.103/jaxogram'
set SERVER_DIR = $HOME'/.gvfs/build on ottokar/sites/jaxogram'
else
set SERVER_URL = 'http://192.168.1.150:8080'
set SERVER_DIR = '<unknown server directory>'
endif
echo "Testing for the simulator requires type:privileged to be removed."
echo "Remove it? [Y or n]"
set RESP = "$<"
if ($RESP == 'Y') then
# first is to remove the line with "type" : "privileged"
sed -i".bak" '/\"type\":/d' manifest.webapp
# then, zip to "application.zip"
zip ${SERVER_DIR:q}/application.zip -x \*/.DS_Store -r manifest.webapp index.html favicon.ico js style applogos images
# and restore
mv manifest.webapp.bak manifest.webapp
else
zip ${SERVER_DIR:q}/application.zip -x \*/.DS_Store -r manifest.webapp index.html favicon.ico js style applogos images
endif
# create "install.html"
cat > ${SERVER_DIR:q}/install.html << End-Of-File
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width"/>
<title>$NAME Install</title>
</head>
<body>
<p>$NAME Installation Page</p>
<div id="status" style="background-color:#edee88">Installing...<div>
<script>
var manifestUrl = location.href.substring(
0, location.href.lastIndexOf("/")
) + "/package.webapp";
try {
var req = navigator.mozApps.installPackage(manifestUrl);
req.onsuccess = function() {
document.getElementById("status").textContent = (
"Sucessfully installed from\n" + this.result.origin
);
};
req.onerror = function() {
document.getElementById("status").textContent = (
"Error during install:\n" + this.error.name
);
};
}catch (error) {
document.getElementById("status").textContent = (
"Problem during install:\n" + error
);
}
</script>
</body>
</html>
End-Of-File
# create "package.webapp"
cat > ${SERVER_DIR:q}/package.webapp << End-Of-File
{
`grep -m 1 -e '\"name\":' manifest.webapp`
"package_path": "$SERVER_URL/application.zip",
`grep -m 1 -e '\"version\":' manifest.webapp`
`awk '/ *"developer":/, /.*^ },/ {print}' manifest.webapp`
`awk '/ *"locales":/, /.*^ },/ {print}' manifest.webapp`
"size": `stat -c %s '${SERVER_DIR:q}/application.zip'`
}
End-Of-File
# `grep -m 1 -e '\"type\":' manifest.webapp`
# `awk '/ *"permissions":/, /.*^ },/ {print}' manifest.webapp`
# `awk '/ *"locales":/, /.*^ },/ {print}' manifest.webapp`
# `awk '/ *"activities":/, /.*^}/ {print}' manifest.webapp`
echo === ${SERVER_DIR:q}/package.webapp
cat ${SERVER_DIR:q}/package.webapp
echo
echo === ${SERVER_DIR:q}/install.html
cat ${SERVER_DIR:q}/install.html
echo
echo === zip file: ${SERVER_DIR:q}/application.zip