forked from anticapitalista/apt-notifier
-
Notifications
You must be signed in to change notification settings - Fork 10
/
mx-updater-basic-upgrade
executable file
·54 lines (48 loc) · 1.52 KB
/
mx-updater-basic-upgrade
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
#!/bin/bash
# MX Linux mx-updater-basic-upgrade pkexec wrapper to retain QT environment
# Usage:
# mx-updater-basic-upgrade apps ...
# adapted from mx-pkexec by dolphin_oracle for MX-Linux
# original code by fehlix for MX-Linux
if [ "$EUID" != "0" ]; then
# normal user
umask 0022
QTEMP="mx-updater-qtenv"
QTENV=$(mktemp -p ${XDG_RUNTIME_DIR:-/tmp} ${QTEMP}.XXXXXXXXXXXXXXXX)
chmod +r "$QTENV"
printenv | grep -E '^QT_|^LANG=|^LANGUAGE=|^LC_' | sed -e 's/^/export /' 2>/dev/null > "$QTENV"
pkexec /usr/lib/apt-notifier/pkexec-wrappers/mx-updater-basic-upgrade "--qtenv" "$QTENV" "${@}"
if [ -f "$QTENV" ] ; then
rm $QTENV
fi
fi
if [ "$EUID" = "0" ]; then
# root user
# set XDG_RUNTIME_DIR - do nothing if already set
if [ x"$XDG_RUNTIME_DIR" = "x" ]; then
XDG_RUNTIME_DIR=/run/user/0
export XDG_RUNTIME_DIR
[ -d $XDG_RUNTIME_DIR ] || mkdir -p $XDG_RUNTIME_DIR
chmod 700 $XDG_RUNTIME_DIR
chown 0:0 $XDG_RUNTIME_DIR
fi
if [ "x$1" = "x--qtenv" ]; then
QTENV="$2"
shift
shift
if [ -r "$QTENV" ]; then
. $QTENV
rm $QTENV
fi
PATH="/usr/local/bin:$PATH"
fi
#eval set "$@"
#RUN="$1"
RUN="/usr/lib/apt-notifier/pkexec-wrappers/mx-updater-basic-upgrade.sh"
#shift
echo Starting "$RUN" "${@}"
command -v "$RUN" >/dev/null || { echo "mx-updater-basic-upgrade: Command '$RUN' not found"; exit 1; }
export NO_AT_BRIDGE=1
exec "$RUN" "${@}"
fi
exit