This script was written in the idea that you are starting from an unmounted drive. It can work with a mounted drive, but not a drive running your save file in use (/mnt/home drive)... See post below.
Step 1: open a text editor (preferably one with copy&paste ability to avoid typing mistakes) (geany works wonderfully)
Step 2: copy each of the following to a blank document in root folder:
File name: mntsave-2fs.sh
Code: Select all
#!/bin/bash
echo Script written by Cody A. Taylor
echo ' '
if [ -n "$DRIVE" ]
then
echo Trying to mount "$DRIVE"
mount /dev/$DRIVE /mnt/$DRIVE
else
echo You need to set variable '$DRIVE'
echo For Example
echo '#export DRIVE=sdb1'
fi
echo ' '
if [ -n "$FILE" ]
then
echo Making dir '"save"' and mounting "$FILE" there
cd /mnt
mkdir save
mount -t ext2 -o loop /mnt/$DRIVE/$FILE /mnt/save
else
echo You need to ser variable '$FILE'
echo For Example
echo '#export FILE=pup_save-name.2fs'
fi
echo ' '
echo 'Thanks for using the mount script'
echo 'Send questions to codemister99@gmail.com'
exit 0
Code: Select all
#!/bin/bash
echo Written by Cody A. Taylor
umount /mnt/save
if [ -n "$DRIVE" ]
then
umount /mnt/$DRIVE
cd /mnt
rmdir save
else
echo You must set the variable '$DRIVE' again, sorry.
fi
echo Your now ready to use the mount script again.
exit 0
Code: Select all
cd /root
chmod +x mntsave-2fs.sh
chmod +x umntsave-2fs.sh
Code: Select all
alias mountsave='bash /root/mntsave-2fs.sh'
alias umountsave='bash /root/umntsave-2fs.sh'
Code: Select all
export DRIVE=sda1
export FILE=pup_save.2fs
Step 6: Finally run the mount script using the alias mountsave.
Step 7: Now you can cd /mnt/save and should be able to use the file
Step 8: Now that your done, clean up what your doing by running the second script with the alias umountsave.
I would be happy to answer any questions. This script should work with any linux at all.
note: This may or may not work if you encrypt your save file. Other people will have to verify being able to mount an encrypted save file.