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
The open a terminal. cd to the directory, and execute
Code: Select all
chmod +x packpet
./packpet
And you get what you want.