Register
It is currently Mon Nov 24, 2014 7:52 am

bash package manager.


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Sat Feb 25, 2006 1:46 pm   

Joined: Fri Oct 14, 2005 9:30 am
Posts: 61
http://www.bashscripts.org/downloads/Sc ... ing.tar.gz
This script is nothing serious, I just wanted to see if you could create a installer out of bash. What the script does, if you examine the code, is create a tar.gz archive from the files and renames it (purely so that you don;t get confused with other tar.gz files) to another extension. then the script mkbash generates a file called bash.installer which renames the archive to a tar.gz archive and extracts it to a location specified in the script. This is all tarred and gzipped into another .tar.gz file which is renamed to .bash (again so you don't get confused with .tar.gz files). The installer (called installbash) just renames this archive to a tar.gz, extracts it, runs bash.installer which then extracts the archive with the files in into the appropriate directory. To see what I mean download the script and install it using runme (you need to be root).
To test this script, download this test archive and examine it or extract it using my script or a archive manager.
I just wanted to see if I could create a whole kind of rpm/deb thing from bash and other common unix utils.
Some hints:
1. Akways run makeinstaller in the folder that contains the files you want in - it will just create an archive out of all the files in that folder.
2. Again run installbash in the folder that contains the archive.bash file.
If people like it I may add more features.

Here is the code for the files:
makeinstaller
Code:
#!/bin/bash
echo "Making installer from files in current directory"
tar -cf bashinstall.tar *
gzip -9 bashinstall.tar
rename bashinstall.tar.gz archive.bash.install bashinstall.tar.gz
mkbash
if [[ -e bash.installer ]]
then
echo "bash.installer found, continuing with script"
else
echo "ERROR!";
echo "No bash.installer file found in current directory, please create one with mkbash";
exit 1;
fi
tar -cf install.tar archive.bash.install bash.installer
gzip -9 install.tar
rename install.tar.gz archive.bash install.tar.gz
echo "archive.bash created in `pwd` "
rm -f archive.bash.install bash.installer

mkbash
Code:
#!/bin/bash
echo "bash.installer will be created in `pwd`/.bash.installer"
read -p "Press enter to continue" enter
read -p "Where would you like the files to be installed (no trailing slash) - eg /usr/local : " extdir
echo "Ok, generating bash.installer"
echo "
#!/bin/bash
if [[ -d $extdir ]]
then
echo " "
else
mkdir -p $extdir; chmod 777 $extdir
fi
rename archive.bash.install bashinstall.tar.gz archive.bash.install
cp bashinstall.tar.gz $extdir
rm -f bashinstall.tar.gz
cd $extdir
tar -zxf bashinstall.tar.gz
echo "Files extracted in $extdir"
rm -f $extdir/bashinstall.tar.gz
exit 0
" >> bash.installer

installbash
Code:
#!/bin/bash
checkforroot ()
{
clear
echo ""
echo "This script needs to be run as root."
echo "Now checking for root permissions"
sleep 1
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."
sleep 1
echo ""
echo "**************** ERROR !! **************"
exit
fi
echo "You are running as root.. good .. moving along now ;) "
sleep 2
}
checkforroot
if [[ -e archive.bash ]]
then
echo " "
else
echo "No archive.bash found";
exit;
fi
rename archive.bash install.tar.gz archive.bash
tar -zxvf install.tar.gz
chmod 777 bash.installer
./bash.installer
rm -f bash.installer
rm -f install.tar.gz
exit


Top
 Profile WWW  
 PostPosted: Tue Apr 18, 2006 3:10 am   

Joined: Fri Oct 14, 2005 9:30 am
Posts: 61
I have updated the script, and have now started to create a repository for the archive.bash files on my website. To see what I mean download the scripts from:
http://www.bashscripts.org/downloads/Sc ... ing.tar.gz


Top
 Profile WWW  
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: No registered users and 3 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