Map-A-Droid icon indicating copy to clipboard operation
Map-A-Droid copied to clipboard

Ask user before rm -rf'ing in ramdisk create bash script

Open ghost opened this issue 6 years ago • 3 comments

Description

  • Ask user before rm -rf'ing in ramdisk create bash script
  • This also changes from ../name to ./name, partially for a bit more safety. Feel free to cherrypick/revert though.

Motivation and Context

  • It was a TODO item

How Has This Been Tested?

Tried running it myself

Screenshots (if appropriate):

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • [ ] My code follows the code style of this project.
  • [ ] My change requires a change to the documentation.
  • [ ] Where appropriate examples are updated such as config.ini.example
  • [ ] I have updated the documentation accordingly.

ghost avatar Oct 25 '18 21:10 ghost

also i think if you're going to change the path to make the script not work from the place where it sits by default, then a major note belongs being sent to the user about it. really i dont think the path should be changed to break it and require the user to move it manually (which will later have to be moved back or break git pull).

krzee avatar Oct 25 '18 22:10 krzee

Thanks @krzee! Changed back to ../ instead of ./, checks for the return status of mount, exits 1 for any other condition than 'created ramdisk' as far as I can tell

The downside is that the rm/mkdir might fail because it's already mounted or device is busy when it's trying to rm, but if it exists already then the mount command will return 0, so no real harm there.

ghost avatar Oct 26 '18 18:10 ghost

Sorry it took me so long to respond, i have been entertaining visitors from outside the country. The changes look good! The only thing I could suggest would be to make a variable for the dir to mount on. So maybe something like dir="../temp_mad" at the top and then use "$dir" in the rest of the code. That would make it easier for people to change it to your ./temp_mad or whatever other dir they might want it in. I don't see that as a big deal really, i think this PR is ready either way. Thank you! :)

krzee avatar Oct 28 '18 14:10 krzee