Register
It is currently Mon Nov 24, 2014 10:16 am

script need explaining


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Thu Jan 30, 2014 9:04 am   

Joined: Thu Jan 30, 2014 9:03 am
Posts: 1
Would someone be able to help me understand a script

-----------------------------
MOUNTED=`mount | grep "mounts/root" | wc -l`
if [ "$MOUNTED" == "1" ]; then
echo "Mount point, mounts/root seems to be mounted. Unmounting."
sudo umount mounts/root
fi

LOOP=`sudo losetup -a | grep "root.img" | cut -d : -f 1 | grep -o -E "[0-9]+"`
if [ -z $LOOP ]; then
echo "No loopback device found for root.img. Unable to continue..."
else
sudo mount /dev/loop$LOOP mounts/root
MOUNTED=`mount | grep "mounts/root" | wc -l`
if [ "$MOUNTED" == "1" ]; then
echo "Removing existing files.."
sudo rm -rf mounts/root/*
echo "Copying over new root filesystem.."
sudo cp -prd tmp/root/ mounts/
echo "Filesystem copied. Unmounting..."
sleep 5
sudo umount mounts/root
sleep 5
echo "Moving root.img over to main.."
sudo cp -f images/root.img mounts/main/
echo "Removing old temporary root filesystem.."
sudo rm -rf tmp/root/ >/dev/null
sudo mount -o remount mounts/main
else
echo "Unable to mount root.img to mounts/root"
fi
fi

-----------------

I am having problems running it in my machine?


Top
 Profile  
 PostPosted: Sat Feb 01, 2014 12:01 pm   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 568
Quote:
I am having problems running it in my machine?
this doesn't explain much what happens when you run it.

what do you want to use this script for?
where did you get it?


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP