Skip to content

Commit

Permalink
Set 'setKey' and 'webpwd' only on new installations.
Browse files Browse the repository at this point in the history
Change debian postinst scripts to run some shell commands for setting
'setKey' and 'webpwd' parameter only if no weakforce is already installed
(or configurations are left). This is necessary because running these
commands if weakforce is already runnig they will fail and upgrading
exits with failure.
postinst maintainer script is only run _without_ additional arguments
beside 'configure' if it's a new installation.
See https://www.debian.org/doc/debian-policy/ch-maintainerscripts.html#summary-of-ways-maintainer-scripts-are-called
  • Loading branch information
herrwagner committed Aug 28, 2024
1 parent c1a356f commit b08a6ad
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
12 changes: 7 additions & 5 deletions builder-support/debian/wforce-trackalert.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ case "$1" in
adduser --quiet --system --home /var/spool/wforce --shell /bin/false --ingroup wforce --disabled-password --disabled-login --gecos "wforce" wforce
echo "done"
fi
echo -n "Modifying trackalert.conf to replace password and key..."
SETKEY=`echo "makeKey()" | trackalert | grep setKey`
WEBPWD=`dd if=/dev/urandom bs=1 count=32 2>/dev/null | base64 | rev | cut -b 2-14 | rev`
sed -e "s#--WEBPWD#$WEBPWD#" -e "s#--SETKEY#$SETKEY#" -i $TRACKALERTCONF
echo "done"
if [ -z "$2" ]; then
echo -n "Modifying trackalert.conf to replace password and key..."
SETKEY=`echo "makeKey()" | trackalert | grep setKey`
WEBPWD=`dd if=/dev/urandom bs=1 count=32 2>/dev/null | base64 | rev | cut -b 2-14 | rev`
sed -e "s#--WEBPWD#$WEBPWD#" -e "s#--SETKEY#$SETKEY#" -i $TRACKALERTCONF
echo "done"
fi
;;

*)
Expand Down
12 changes: 7 additions & 5 deletions builder-support/debian/wforce.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ case "$1" in
mv /etc/wforce.conf /etc/wforce/wforce.conf && \
echo "Moved /etc/wforce.conf to /etc/wforce/wforce.conf"
fi
echo -n "Modifying wforce.conf to replace password and key..."
SETKEY=`echo "makeKey()" | wforce | grep setKey`
WEBPWD=`dd if=/dev/urandom bs=1 count=32 2>/dev/null | base64 | rev | cut -b 2-14 | rev`
sed -e "s#--WEBPWD#$WEBPWD#" -e "s#--SETKEY#$SETKEY#" -i $WFORCECONF
echo "done"
if [ -z "$2" ]; then
echo -n "Modifying wforce.conf to replace password and key..."
SETKEY=`echo "makeKey()" | wforce | grep setKey`
WEBPWD=`dd if=/dev/urandom bs=1 count=32 2>/dev/null | base64 | rev | cut -b 2-14 | rev`
sed -e "s#--WEBPWD#$WEBPWD#" -e "s#--SETKEY#$SETKEY#" -i $WFORCECONF
echo "done"
fi
;;

*)
Expand Down

0 comments on commit b08a6ad

Please sign in to comment.