packpet (under development,help requested)

A home for all kinds of Puppy related projects
Post Reply
Message
Author
jimhap
Posts: 63
Joined: Sat 03 Mar 2007, 16:51
Contact:

packpet (under development,help requested)

#1 Post by jimhap »

packpet is a little script I made that can automatically package tgzs out of source packages.

For example:

I download vim source package.

I put the script into the same directory as the vim source is.
Now I run packpet and in a while, the script finishes and volla,
my pets are in there!

Right now it is "workable". That means it will work, but there are bugs.

Volunteers appreciated for help on the script.

TO get my script, copy below to a text editor (like geany).

Code: Select all

#!/bin/sh
#packpet script by jimhap
CDIR=`pwd`
CONFARG=""
for dirs in *
do

	if [ -f "$dirs" ]
	then
		echo "$dirs is not a directory. Skipping the file $dirs...."
		continue
	fi
	
	if [ ! -f "$dirs/configure" ]
	then
		echo "Configure file not found in $dirs. Skipping...."
		continue
	fi
dirlist="$dirlist
$dirs"
done
sleep 1s
clear
printf "List of programs to be compiled and packaged:
$dirlist

\033[1mPRESS CTRL-C NOW IF THE LIST IS INCORRECT"'!!!!!'"

Number of seconds left: "
num=2
printf "$num "
sleep 1s
num=`expr $num - 1`
printf "$num "
sleep 1s
num=`expr $num - 1`
echo -e $num" \033[0m"

mkdir -p buildp
mkdir -p packagedir


for dirs in *
do

	if [ -f "$dirs" ]
	then
		continue
	fi
	
	if [ ! -f "$dirs/configure" ]
	then
		continue
	fi
echo -e "
\033[1m---------------------------------------\033[0m
Compiling and packaging \033[1m""$dirs""\033[0m...
\033[1m---------------------------------------\033[0m"
cd $dirs
./configure --prefix=$CDIR/buildp/$dirs/usr/X11R6 $CONFARG && make && make install
cd ../buildp/$dirs
find -type d > $CDIR/$dirs.folders
find -type f > $CDIR/$dirs.files
	for dirs2 in `find ./usr -type d `
	do

		if [ -f "$dirs2" ]
		then
			continue
		fi
			for dirs3 in `find $dirs2 -type f`
			do
			executelist="$executelist			
cp -r $dirs3 $CDIR/packagedir/$dirs/$dirs2/"
			done
	done
	

echo "
$executelist"

cd $CDIR/packagedir
mkdir -p $dirs
cd $dirs
DIRM=`cat $CDIR/$dirs.folders`
echo "mkdir -p $CDIR/packagedir/$dirs/$DIRM"
mkdir -p $CDIR/packagedir/$dirs/$DIRM
cd $CDIR/$dirs
make uninstall && make distclean

./configure --prefix=/usr/X11R6 $CONFARG && make && make install

FILESTOCOPY=`cat $CDIR/$dirs.files`

cd / 



if [ `pwd` = "/" ]; then
cat > copyfile <<EOF
#!/bin/sh
$executelist
EOF
chmod +x /copyfile
/copyfile
rm /copyfile
cd $CDIR
else
cd /
cat > copyfile <<EOF
#!/bin/sh
$executelist
EOF
chmod +x /copyfile
/copyfile
rm /copyfile
cd $CDIR
fi


mv $CDIR/packagedir/$dirs/ /$dirs
tar -czvf "$dirs".tgz /$dirs

done
Then save it to /root (or where ever the source is or will be stored).

The open a terminal. cd to the directory, and execute

Code: Select all

chmod +x packpet

./packpet

And you get what you want. ;)

Post Reply