pimoroni / clean-shutdown

Python daemon to watch a GPIO pin and trigger a clean shutdown.
MIT License
125 stars 40 forks source link

get.pimoroni.com/zerolipo rm -r hangs #25

Closed trickv closed 1 year ago

trickv commented 4 years ago

Hi there,

I ran the script at https://get.pimoroni.com/zerolipo today to install this little service (which seems to be working great, btw!) but I ran into a little snag in the zerolipo install script. I can't find a source for it on github but feel free to point me in another direction?

The "little bug" was on line 1101:

1098     else # custom block starts here
1099         echo -e "\nFinalising Install...\n"
1100         cd $installdir/$gitclonedir && ./setup.sh -y zerolipo
1101         cd $installdir && rm -r $installdir/$gitclonedir &> /dev/null
1102     fi

the rm -r should probably include a -f (--force) flag, because git had marked one of the .git metadata files to remove the writable bit, and thus rm will prompt - but it's wrapped in a script redirected to /dev/null so the install script appeared to hang. I found out what was happening on another shell and running the same command:

pi@pi:~ $ rm -r Pimoroni/clean-shutdown/
rm: remove write-protected regular file 'Pimoroni/clean-shutdown/.git/objects/1c/2f8b6af8fcf33eda999a1719ff8c96372ef3e8'?

I'd recommend changing the rm -r to rm -rf

HTH!