[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: libcifpp-data.postrm cron and piuparts (was: Re: Help requested, don't know what to do)



Hi Joost,

Op 02-01-2023 om 11:52 schreef Joost van Baal-Ilić:
I think best would be to "exit 0" if your package is removed.  E.g. check for
the existence of some file under /usr of your package, and 'exit 0' with no
output if the file is not there.

There was a check already to see if we should stop early, without any warning or output. Unfortunately, the cron job was run in dash (by piu-parts). And dash does not know the variable EUID.

So I ended up rewriting the script to use the following and that seems to work:

# Get the effective UID, but do so in a compatible way (we may be running dash)
euid=${EUID:-$(id -u)}
if [ "${euid}" -ne 0 ] ; then
then echo "Please run as root"
exit
fi

regards and thanks for all the helpful feedback,

-maarten


Reply to: