-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall_local.sh
executable file
·161 lines (138 loc) · 3.03 KB
/
install_local.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#!/bin/bash
#
# Clippie: Gnome Shell gaste-client extension
# Copyright (C) 2021 Steeve McCauley
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
ME=$(basename $0)
MD=$(dirname $0)
ED=eclipse@blackjackshellac.ca
USR_SHARE=~/.local/share
ICONS=$USR_SHARE/icons/hicolor
EXTENSIONS=$USR_SHARE/gnome-shell/extensions
SCHEMAS=schemas
DST="$EXTENSIONS/$ED"
puts() {
echo -e $*
}
log() {
puts $*
}
info() {
log "INFO" $*
}
warn() {
log "WARN" $*
}
die() {
log "FATAL" $*
exit 1
}
run() {
info $*
$*
[ $? -ne 0 ] && die "Run command failed: $*"
}
help() {
cat << HELP
Installer for $ED
$ ./$ME [options]
-i : install (default)
-u : uninstall
-s : show current installation type
-d : debug install (symlink to source)
-h : help (this)
HELP
exit 0
}
declare -i DEBUG=${CLIPPIE_DEBUG:=0}
while getopts ":iusdh" opt; do
case $opt in
d)
DEBUG=1
;;
s)
if [ -L "$DST" ]; then
info "Debug installation: $DST"
info " symlink to $(readlink -f $DST)"
elif [ -d "$DST" ]; then
info "Normal installation: $DST"
ls -ld "$DST"
elif [ -e "$DST" ]; then
ls -l $DST
die "Invalid destination exists: $DST"
else
info "Not installed"
fi
exit 0
;;
i)
info "Install - default"
;;
u)
info "Uninstall $DST"
if [ -L "$DST" ]; then
info "Removing symlink"
run rm -f "$DST"
elif [ -d "$DST" ]; then
info "Deleting installation"
cd "$DST"
[ $? -ne 0 ] && die "failed to change to destination $DST"
cd "$EXTENSIONS"
if [ -d "$ED" ]; then
run rm -rf "$ED"
res=$?
[ $res -ne 0 ] && die "Failed to delete $DST [$res]"
fi
elif [ -e "$DST" ]; then
die "Invalid destination exists: $DST"
else
warn "Not installed"
fi
exit 0
;;
h)
help
;;
*)
die "Unknown option $opt"
;;
esac
done
[ $DEBUG -ne 0 ] && warn "DEBUG is enabled"
run cd $MD
if [ $DEBUG -ne 0 ]; then
run ./bin/pot_create.sh
fi
run cd $ED
#run mkdir -p $SCHEMAS
#run cp -puv schemas/*.xml $SCHEMAS/
run glib-compile-schemas --strict $SCHEMAS
ldir="$(pwd)"
[ ! -d "$EXTENSIONS" ] && run mkdir -p $EXTENSIONS
if [ $DEBUG -ne 0 ]; then
warn "DEBUG is enabled"
info "Creating symlink to $ldir"
run cd $EXTENSIONS
[ ! -L "$ED" ] && run rm -rfv $ED
run ln -sf $ldir .
else
info "Installing extension in $EXTENSIONS/$ED"
[ -L "$EXTENSIONS/$ED" ] && rm -v $EXTENSIONS/$ED
run rsync -av . $EXTENSIONS/$ED
fi
run cd $EXTENSIONS/$ED
pwd
info "Alt-F2 'r' to restart gnome shell"