Skip to content

Commit

Permalink
Debian support
Browse files Browse the repository at this point in the history
do not break if user 'user' does not exist
  • Loading branch information
Patrick Schleizer committed Jul 13, 2019
1 parent ff33e22 commit 6336fad
Showing 1 changed file with 26 additions and 18 deletions.
44 changes: 26 additions & 18 deletions debian/tb-updater.postinst
Expand Up @@ -22,6 +22,29 @@ true "
#####################################################################
"

download() {
mkdir --parents "/var/cache/tb-binary"
chown user:user "/var/cache/tb-binary"

if ischroot --default-false ; then
chroot_maybe="--is-chroot"
fi

if [ -f /etc/secbrowser-qubes ] || [ -f /usr/local/etc/secbrowser-qubes ]; then
tool=download-secbrowser
else
tool=update-torbrowser
fi

## TODO:
#tpo_downloader_debug="$tpo_downloader_debug"

runuser --preserve-environment -u user -- \
$tool \
$chroot_maybe \
--postinst
}

true "INFO: debhelper beginning here."

#DEBHELPER#
Expand All @@ -32,27 +55,12 @@ true "anon_shared_inst_tb: $anon_shared_inst_tb"
true "tb_onion: $tb_onion"
true "tb_disable_anon_ws_dnf_conf: $tb_disable_anon_ws_dnf_conf"

mkdir --parents "/var/cache/tb-binary"
chown user:user "/var/cache/tb-binary"

if ischroot --default-false ; then
chroot_maybe="--is-chroot"
fi

if [ -f /etc/secbrowser-qubes ] || [ -f /usr/local/etc/secbrowser-qubes ]; then
tool=download-secbrowser
if id user >&/dev/null ; then
download
else
tool=update-torbrowser
true "INFO: user 'user' does not exist. Skip downloading."
fi

## TODO:
#tpo_downloader_debug="$tpo_downloader_debug"

runuser --preserve-environment -u user -- \
$tool \
$chroot_maybe \
--postinst

true "
#####################################################################
## INFO: END : $DPKG_MAINTSCRIPT_PACKAGE $DPKG_MAINTSCRIPT_NAME $@
Expand Down

0 comments on commit 6336fad

Please sign in to comment.