-
Notifications
You must be signed in to change notification settings - Fork 19
/
helper.sh
executable file
·66 lines (51 loc) · 1.16 KB
/
helper.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
#!/bin/bash
printUsage() {
echo "Usage: helper.sh install|uninstall|upgrade|package name-of-the-script"
echo " or: helper.sh show-dev-console"
}
install() {
local scriptName=$1
kpackagetool5 -i "$scriptName"
}
uninstall() {
local scriptName=$1
kpackagetool5 -r "$scriptName"
}
upgrade() {
local scriptName=$1
kpackagetool5 -u "$scriptName"
}
package() {
local scriptName=$1
[[ ! -d "$scriptName" ]] && {
echo "No such script '$scriptName'"
exit 1
}
cd "$scriptName" || exit 1
local scriptVersion=$(grep -Po "Version=\K(.*)" metadata.desktop)
zip -r "$scriptName-$scriptVersion.kwinscript" contents metadata.desktop
cd ..
}
show-dev-console() {
qdbus org.kde.plasmashell /PlasmaShell showInteractiveKWinConsole
}
main() {
local command=$1
case $command in
install|uninstall|upgrade|package)
[[ -z "$2" ]] && {
printUsage
exit 1
}
$command "$2"
;;
show-dev-console)
$command
;;
*)
printUsage
exit 1
;;
esac
}
main $*