Register
It is currently Fri Nov 28, 2014 9:30 pm

Slax Download


All times are UTC - 6 hours


Post new topic Reply to topic  [ 14 posts ] 
Author Message
 PostPosted: Thu Jun 29, 2006 9:57 pm   
User avatar

Joined: Tue May 17, 2005 12:55 am
Posts: 86
Location: Big Easy, Louisiana
Ok, now that I am getting used to some things in bash, I think I'd like to make a script to download my modified Slax from the Lug 8) . The part that I need a little instruction on is how to script in the prompting from the lug on a u/n, and p/w. This script would be helpful as it would just d/l whatever the most current that I have done (speaking of, i think that i am do to make some changes). then in the same script I would have the automatic d/l of the newest user config for it as well. Right now I have a good idea in my head on what I need to do, except for the u/n & p/w bit. Any help wold be greatly appreciated.


Top
 Profile YIM  
 PostPosted: Sun Jul 02, 2006 8:53 pm   
User avatar

Joined: Tue May 17, 2005 12:55 am
Posts: 86
Location: Big Easy, Louisiana
ok here we go so far...

Code:
#!/bin/bash
#
#
#
#################################################
#                                               #
#                                               #
#       this script should d/l my               #
#       modified slax, that is hosted           #
#       at usalug.org.                          #
#################################################

#this script should also download the corrosponding config module as
#well.

cd ~/
mkdir Modified_Slax
cd Modified_Slax

wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/usalugslax.iso

wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/usalug.mo

wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/md5sum.txt


how can i compare the md5 of the iso to the md5sum.txt automatically in the script :?

from there I want to mount the iso and copy all contents to the folder that i created. and then attempt to insert the config module into the a dir. then the user would just have to go to the dir where the make_iso.sh script is that comes with slax. :D


Top
 Profile YIM  
 PostPosted: Sun Jul 02, 2006 9:22 pm   
User avatar

Joined: Tue May 17, 2005 12:55 am
Posts: 86
Location: Big Easy, Louisiana
ok a little update.

Code:
#!/bin/bash
#
#
#
#################################################
#                                               #
#                                               #
#       this script should d/l my               #
#       modified slax, that is hosted           #
#       at usalug.org.                          #
#################################################

#this script should also download the corrosponding config module as
#well.

cd ~/
mkdir Modified_Slax
cd Modified_Slax

wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/usalugslax.iso

wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/usalug.mo

wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/md5sum.txt

md5sum usalugslax.iso>usalug.txt


i am now working on a if statement to check the md5sums, then if they equal, to keep going, if they are different to exit.


Top
 Profile YIM  
 PostPosted: Sun Jul 02, 2006 10:03 pm   
User avatar

Joined: Tue May 17, 2005 12:55 am
Posts: 86
Location: Big Easy, Louisiana
ok another update.

Code:
#!/bin/bash
#
#
#
#################################################
#                                               #
#                                               #
#       this script should d/l my               #
#       modified slax, that is hosted           #
#       at usalug.org.                          #
#################################################

#this script should also download the corrosponding config module as
#well.

cd ~/
mkdir Modified_Slax
cd Modified_Slax

wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/usalugslax.iso

wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/usalug.mo

wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/md5sum.txt

md5sum usalugslax.iso>usalug.txt

read usalug.txt md5

read md5sum.txt answer


Top
 Profile YIM  
 PostPosted: Sun Jul 02, 2006 10:29 pm   
User avatar

Joined: Tue May 17, 2005 12:55 am
Posts: 86
Location: Big Easy, Louisiana
new update :D

Code:
#!/bin/bash
#
#
#
#################################################
#                                               #
#                                               #
#       this script should d/l my               #
#       modified slax, that is hosted           #
#       at usalug.org.                          #
#################################################

#this script should also download the corrosponding config module as
#well.

cd ~/
mkdir Modified_Slax
cd Modified_Slax

wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/usalugslax.iso

wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/usalug.mo

wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/md5sum.txt

md5sum usalugslax.iso>usalug.txt

read usalug.txt md5

read md5sum.txt answer

if [[ $md5 = $answer ]]
then echo "The md5sums match"; else echo "The md5sums don't match...exiting" && exit 1
fi



ok now if i want to mount the iso then the user would have to be run as root right :? cuz i would like to mount the iso and then copy all contents of the iso to the /home/user dir. ....though maybe more realistic to copy it to a new dir. in /home. what you all think :?


Top
 Profile YIM  
 PostPosted: Mon Jul 03, 2006 11:58 am   
User avatar

Joined: Tue May 17, 2005 12:55 am
Posts: 86
Location: Big Easy, Louisiana
update :D

Code:
#!/bin/bash
#
#
#
#################################################
#                                               #
#                                               #
#       this script should d/l my               #
#       modified slax, that is hosted           #
#       at usalug.org.                          #
#################################################

#this script should also download the corrosponding config module as
#well.

clear

echo "You will have to be root to run this script!"
clear
#check for root function
function checkforroot
{
ROOT_UID=0
if [ "$UID" -ne "$ROOT_UID" ]
then
echo ""
echo "**************** ERROR !! **************"
echo "You must be logged in as root to run this script"
echo "Please log in as root and re-run this script."
echo "Program HALTED."
echo ""
echo "**************** ERROR !! **************"
exit
fi
}
checkforroot
#this is going to make a dir. in /home to d/l and then mount the iso.
cd /home
mkdir USALUG
cd USALUG
mkdir Mount

wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/usalugslax.iso

clear

wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/usalug.mo

clear

wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/md5sum.txt

clear

md5sum usalugslax.iso>usalug.txt

read usalug.txt md5

read md5sum.txt answer

if [[ $md5 = $answer ]]
then echo "The md5sums match"; else echo "The md5sums don't match...exiting" && exit 1
fi

mount -o rw,loop=/dev/loop0 usalugslax.iso /home/USALUG/Mount


Top
 Profile YIM  
 PostPosted: Mon Jul 03, 2006 1:21 pm   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 673
Location: Des Moines, Iowa
Lookin good :)


Top
 Profile WWW  
 PostPosted: Mon Jul 03, 2006 8:15 pm   
User avatar

Joined: Tue May 17, 2005 12:55 am
Posts: 86
Location: Big Easy, Louisiana
new update :D

Code:
#!/bin/bash
#
#
#
#################################################
#                                               #
#                                               #
#       this script should d/l my               #
#       modified slax, that is hosted           #
#       at usalug.org.                          #
#################################################

#this script should also download the corrosponding config module as
#well.

clear

echo "You will have to be root to run this script!"
clear
#check for root function
function checkforroot
{
ROOT_UID=0
if [ "$UID" -ne "$ROOT_UID" ]
then
echo ""
echo "**************** ERROR !! **************"
echo "You must be logged in as root to run this script"
echo "Please log in as root and re-run this script."
echo "Program HALTED."
echo ""
echo "**************** ERROR !! **************"
exit
fi
}
checkforroot
#this is going to make a dir. in /home to d/l and then mount the iso.
cd /home
mkdir USALUG
cd USALUG
mkdir Mount

wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/usalugslax.iso

clear

wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/usalug.mo

clear

wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/md5sum.txt

clear

md5sum usalugslax.iso>usalug.txt

read usalug.txt md5

read md5sum.txt answer

if [[ $md5 = $answer ]]
then echo "The md5sums match"; else echo "The md5sums don't match...exiting" && exit 1
fi

mount -o loop=/dev/loop0 usalugslax.iso /home/USALUG/Mount

#this is where we are going to copy the contents of the iso to
mkdir New

clear

cp -R /home/USALUG/Mount /home/USALUG/New

mv usalug.mo /home/USALUG/New/rootcopy

cd /home/USALUG/New/rootcopy

mkdir root
mv usalug.mo root
cd /home/USALUG

#time to clean up
clear
umount Mount

rm md5sum.txt

rm usalug.txt

exit


Top
 Profile YIM  
 PostPosted: Fri Jul 07, 2006 4:38 am   
User avatar

Joined: Tue May 17, 2005 12:55 am
Posts: 86
Location: Big Easy, Louisiana
it didn't work :( not sure what happened.


Top
 Profile YIM  
 PostPosted: Fri Jul 07, 2006 12:23 pm   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 673
Location: Des Moines, Iowa
md5sum usalugslax.iso>usalug.txt

should be

md5sum usalugslax.iso > usalug.txt

that's just from reading it really quick..... not sure if that helps or not, i haven't ran it myself yet.....


Top
 Profile WWW  
 PostPosted: Wed Jul 12, 2006 9:48 pm   
User avatar

Joined: Tue May 17, 2005 12:55 am
Posts: 86
Location: Big Easy, Louisiana
well i did some tinkering....and it works...not quite like i envisioned yet...maybe you guys could give me a little help :idea:

Code:
#!/bin/bash
#
#
#
#################################################
#                                               #
#                                               #
#       this script should d/l my               #
#       modified slax, that is hosted           #
#       at usalug.org.                          #
#################################################

#this script should also download the corrosponding config module as
#well.

clear

echo "You will have to be root to run this script!"
clear
#check for root function
function checkforroot
{
ROOT_UID=0
if [ "$UID" -ne "$ROOT_UID" ]
then
echo ""
echo "**************** ERROR !! **************"
echo "You must be logged in as root to run this script"
echo "Please log in as root and re-run this script."
echo "Program HALTED."
echo ""
echo "**************** ERROR !! **************"
exit
fi
}
checkforroot
#this is going to make a dir. in /home to d/l and then mount the iso.
cd /home
mkdir USALUG
cd USALUG
mkdir Mount

wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/usalugslax.iso

clear
#md5sum usalugslax.iso > usalug.txt
#read usalug.txt md5

wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/usalug.mo

#clear

#wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/md5sum.txt

clear

#read md5sum.txt answer

#if [[ $md5 = $answer ]]
#then echo "The md5sums match"; else echo "The md5sums don't
#match...exiting" && exit 1
#fi

mount -o loop=/dev/loop0 usalugslax.iso /home/USALUG/Mount

#this is where we are going to copy the contents of the iso to
mkdir New

clear

cp -R /home/USALUG/Mount /home/USALUG/New

mv usalug.mo /home/USALUG/New/rootcopy

cd /home/USALUG/New/rootcopy

mkdir root
mv usalug.mo root
cd /home/USALUG

#time to clean up
clear
umount Mount

rm md5sum.txt

rm usalug.txt

exit


it doesn't make the /root folder inside of /home/USALUG/New/Mount/rootcopy....so it doesn't put the usalug.mo in the right dir. other than that...it works :D


Top
 Profile YIM  
 PostPosted: Thu Jul 13, 2006 9:25 pm   
User avatar

Joined: Tue May 17, 2005 12:55 am
Posts: 86
Location: Big Easy, Louisiana
Code:
coastie@foxhole:~/Scripts> cat Slax_Downloader
#!/bin/bash
#
#
#
#################################################
#                                               #
#                                               #
#       this script should d/l my               #
#       modified slax, that is hosted           #
#       at usalug.org.                          #
#################################################

#this script should also download the corrosponding config module as
#well.

clear

echo "You will have to be root to run this script!"
clear
#check for root function
function checkforroot
{
ROOT_UID=0
if [ "$UID" -ne "$ROOT_UID" ]
then
echo ""
echo "**************** ERROR !! **************"
echo "You must be logged in as root to run this script"
echo "Please log in as root and re-run this script."
echo "Program HALTED."
echo ""
echo "**************** ERROR !! **************"
exit
fi
}
checkforroot
#this is going to make a dir. in /home to d/l and then mount the iso.
cd /home
mkdir USALUG
cd USALUG
mkdir Mount

wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/usalugslax.iso

clear
#md5sum usalugslax.iso > usalug.txt
#read usalug.txt md5

wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/usalug.mo

#clear

#wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/md5sum.txt

clear

#read md5sum.txt answer

#if [[ $md5 = $answer ]]
#then echo "The md5sums match"; else echo "The md5sums don't
#match...exiting" && exit 1
#fi

mount -o loop=/dev/loop0 usalugslax.iso /home/USALUG/Mount

#this is where we are going to copy the contents of the iso to
mkdir New

clear

cp -R /home/USALUG/Mount /home/USALUG/New

mv usalug.mo /home/USALUG/New/Mount/rootcopy

cd /home/USALUG/New/Mount/rootcopy

mkdir root
mv usalug.mo root
cd /home/USALUG

#time to clean up
clear
umount Mount

rm usalugslax.iso

#rm md5sum.txt

#rm usalug.txt

exit


i fixed one of the problems, it should now create the dir, and move the usalug.mo to the correct folder :D


Top
 Profile YIM  
 PostPosted: Sun Jul 16, 2006 9:38 pm   
User avatar

Joined: Mon Jul 03, 2006 8:58 pm
Posts: 52
Location: Rochester, NY
Nice script coastie! Here's a couple suggestions to get your md5 checksums working:

coastie wrote:
Code:
wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/usalugslax.iso

clear
#md5sum usalugslax.iso > usalug.txt
#read usalug.txt md5

wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/usalug.mo

#clear

wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/md5sum.txt

clear

#read md5sum.txt answer

if [[ `md5sum -c md5sum.txt` == 0 ]]
then echo "The md5sums match"; else echo "The md5sums don't
match...exiting" && exit 1
fi


If you have the md5sum.txt file that was generated by md5sum for a set of files, you simply need to run the md5sum utility with the -c option and it'll look at the md5sum.txt file and check the file names in it against the files in the current directory and then calculate the md5 for each matching file and compare it against the value in the md5sum.txt file. *whew*

Said another way if your md5sum.txt file looks like:
Code:
abcdef0123456789 foo.txt
0123456789abcdef bar.txt


when you run
Code:
md5sum -c md5sum.txt
it'll check the current directory for foo.txt and bar.txt. It will then calculate the md5 hash for each file and compare those hashes against the hashes in the md5sum.txt file associated with the corresponding file name. If a file is missing or changed, the md5sum check will fail with an exit status of 1.

That way you don't have to calculate the md5 sum of each file yourself and then parse through the md5sum.txt file to find the right hash value to compare your cacluated value against.


Top
 Profile WWW  
 PostPosted: Mon Jul 17, 2006 1:24 pm   
User avatar

Joined: Tue May 17, 2005 12:55 am
Posts: 86
Location: Big Easy, Louisiana
ok figured i'd post where i would like to see this script go. from here i'd like to put in an option for allowing the user to insert files/dir. into the /root dir. eventually this will turn into something for the live disk for usalug :D


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 2 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:  


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