I want to mount another root partition, edit the grub.cfg file with a python script and afterwards umount the partition again. How can I wait for the python script to finish and check if the partition is ready to be umounted? Currently I have tried to use wait but this doesn't do the trick.
if mountpoint $MPOINT; then echo "Already mounted. To prevent potential file loss aborting." else echo "OK, will now mount the needed device." mkdir $MPOINT mount $DEVICE $MPOINT if [ $? -eq 0 ]; then # Edit config file python /usr/bin/grubcfgmgr.py "$MPOINT" & pid=$! else echo "Failed, could not mount. Aborting." rm -rf $MPOINT exit n fi # Umount wait $pid umount $MPOINT if [ $? -eq 0 ]; then echo "OK, umount was succesfull. Will delete empty mount point." rm -rf $MPOINT else echo "Failed, could not umount. Aborting." fi fi