-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAppRun
More file actions
executable file
·85 lines (67 loc) · 1.7 KB
/
Copy pathAppRun
File metadata and controls
executable file
·85 lines (67 loc) · 1.7 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
81
82
83
84
85
#!/usr/bin/env zsh
builtin emulate -L zsh -o extendedglob -o typesetsilent \
-o noshortloops -o warncreateglobal
integer QEC=$?
##
## Get source directory and load functions
##
0=${${ZERO:-${(%):-%x}}:A}
[[ -f $0 ]];QEC+=$?
[[ $0:h == $APPDIR:A ]];QEC+=$?
fpath+=($0:h/functions)
source $0:h/lib/appimage-functions.zsh;QEC+=$?
if ((QEC));then
builtin print -r -P -- %B%F{1}Error:%b non-zero error code \
\(%F{27}$QEC%F{1}\)occurred, exiting…
exit QEC
fi
builtin autoload -Uz -- catch throw
local -a match mbegin mend reply opts
local MATCH REPLY T1 T3
integer MBEGIN MEND
local -A Opts
z4::load-colors||exit 1
z4::parse-opts Opts opts "$@"||exit 1
##
## Variables
##
local CVER NVER VERF
local CDIR_PFX=${XDG_DATA_HOME:-$HOME/.local}/\
share/zinit/zinit \
CACHE_DIR=${XDG_CACHE_HOME:-$HOME/.cache}/z4
command mkdir -p $CACHE_DIR
##
## MAIN ACTIONS (opts: -I/--INSTALL, -E/--EVAL, -R/--RUN)
##
z4::install-version-check $CDIR_PFX $APPDIR
CVER=$reply[1] NVER=$reply[2] VERF=$reply[3]
# (-i/--install) Install?
local CVER NVER VERF
if ((Opts[-i]));then
if [[ $NVER != $CVER ]]; then
CVER=$reply[1] NVER=$reply[2] VERF=$reply[3]
z4::install $APPDIR $VERF:h
fi
fi
[[ -z $NVER ]]&&NVER=$(<$APPDIR/version.dat)
# (-e/--eval) Output load code?
if ((Opts[-e]));then
z4::eval-code $APPDIR $VERF:h $NVER $CVER
fi
# (-r/--run) Run?
if ((Opts[-r]));then
z4::run $VERF:h $NVER
fi
if ((Opts[-u]));then
if [[ ! -e $VERF:h ]];then
+m {I}{lhi}Zinit 4{i} is not installed!
elif z4::uninstall $VERF:h;then
+m {S}uninstall complete!
else
+m {E}problems during uninstall
fi
fi
if ((Opts[-h]));then
z4::usage $NVER
fi
return 0