forked from wwjjbb/Luna-II
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdate
executable file
·65 lines (51 loc) · 1.18 KB
/
update
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
#!/bin/bash
METADATA="package/metadata.json"
APPNAME=$(grep '"Id"' $METADATA | sed -E 's/^\s+".*": "(.*)",/\1/')
_basename=$(basename "$0")
_SHORT_OPTIONS="h?i"
_LONG_OPTIONS="help,install"
_install=0
show_help() { echo "Usage: ${_basename} [OPTIONS]...
Upgrade plasmoid.
Options:
-h, --help display this help text and exit
-i, --install install instead of upgrading
"; }
#canonicalize options
_args=$(getopt \
--longoptions $_LONG_OPTIONS \
--name ${_basename} \
--options $_SHORT_OPTIONS \
-- "$@"
)
if [ $? != 0 ] ; then show_help ; exit 1 ;
else set -- $_args ; fi
# Transform long options to short ones
for arg in "$@"; do
shift
case "$arg" in
'--install') set -- "$@" '-i' ;;
'--help') set -- "$@" '-h' ;;
*) set -- "$@" "$arg" ;;
esac
done
while getopts $_SHORT_OPTIONS opt; do
case "$opt" in
h | ? )
show_help
exit 0
;;
i )
_install=1
;;
esac
done
if [ $_install = 1 ]; then
plasmapkg2 --install package
else
plasmapkg2 --upgrade package
fi
echo
echo '------------------------------------------------'
echo
plasmoidviewer -a $APPNAME