forked from anticapitalista/apt-notifier
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathmx-updater-view-auto-update-logs
executable file
·41 lines (38 loc) · 1.29 KB
/
mx-updater-view-auto-update-logs
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
#!/bin/bash
# MX Linux mx-updater-view-auto-update-logs pkexec wrapper to retain QT environment
# Usage:
# mx-updater-view-auto-update-logs apps ...
# adapted from mx-pkexec by dolphin_oracle for MX-Linux
# original code by fehlix for MX-Linux
if [ "$EUID" != "0" ]; then
# normal user
QTENV="/tmp/mx-updater-view-auto-update-logs-qtenv.$EUID.$PPID.$$.$RANDOM$RANDOM"
env | grep -E '^QT_|^LANG=' | sed -e 's/^/export /' 2>/dev/null > "$QTENV"
chmod +r "$QTENV"
pkexec /usr/lib/apt-notifier/pkexec-wrappers/mx-updater-view-auto-update-logs "--qtenv" "$QTENV" "${@}"
if [ -f "$QTENV" ] ; then
rm $QTENV
fi
fi
if [ "$EUID" = "0" ]; then
# root user
if [ "x$1" = "x--qtenv" ]; then
QTENV="$2"
shift
shift
if [ -r "$QTENV" -a "$QTENV" != "${QTENV#/tmp/mx-updater-view-auto-update-logs-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-view-auto-update-logs.sh"
#shift
echo Starting "$RUN" "${@}"
command -v "$RUN" >/dev/null || { echo "mx-updater-view-auto-update-logs: Command '$RUN' not found"; exit 1; }
export NO_AT_BRIDGE=1
exec "$RUN" "${@}"
fi
exit