Code: Select all
#!/bin/bash
# SRC = Source Link
# TMP = /tmp/$NAME folder
# TMP_SRC = /tmp/$NAME-src
SRC=http://repository.slacky.eu/slackware-13.37/network/google-chrome/15.0.874.106/google-chrome-15.0.874.106-i386-1sl.txz
DEP_1=http://repository.slacky.eu/slackware-13.37/libraries/gconfmm/2.28.2/gconfmm-2.28.2-i486-3sl.txz
DEP_3=http://repository.slacky.eu/slackware-13.37/libraries/libsigc++/2.2.9/libsigc++-2.2.9-i486-1sl.txz
DEP_4=http://repository.slacky.eu/slackware-13.37/libraries/glibmm/2.27.99.2/glibmm-2.27.99.2-i486-1sl.txz
DEP_2=http://carroll.cac.psu.edu/pub/linux/distributions/slackware/slackware-13.37/extra/google-chrome/google-chrome-pam-solibs-1.1.3-i486-1.txz
NAME='Google Chrome'
F_NAME=Google-Chrome
TMP=/tmp/$F_NAME
TMP_SRC=/tmp/$F_NAME-src
F_32=$TMP_SRC/google-chrome-15.0.874.106-i386-1sl.txz
DP_1=$TMP_SRC/gconfmm-2.28.2-i486-3sl.txz
DP_2=$TMP_SRC/libsigc++-2.2.9-i486-1sl.txz
DP_3=$TMP_SRC/glibmm-2.27.99.2-i486-1sl.txz
DP_4=$TMP_SRC/google-chrome-pam-solibs-1.1.3-i486-1.txz
CPU=`uname -m`
CWD=`pwd`
D_LAST=$TMP_SRC/chrome
WRK=$CWD/$F_NAME-$CPU.lzm
#Functions
mkfolder () {
if [ -e $1 ]; then
rm -Rf $1
else
mkdir $1
fi }
progressbar () {
# Set wget for display the progress bar only
local flag=false c count cr=$'\r' nl=$'\n'
while IFS='' read -d '' -rn 1 c
do
if $flag
then
printf '%c' "$c"
else
if [[ $c != $cr && $c != $nl ]]
then
count=0
else
((count++))
if ((count > 1))
then
flag=true
fi
fi
fi
done
}
download () {
# Download with progressbar function
wget --progress=bar:force $1 2>&1 | progressbar
}
txz2xzm () {
# Convert Slackware's Pkgs in Porteus modules
PATH=.:$(dirname $0):/usr/lib:$PATH
. liblinuxlive || exit 1
TMPDIR=/tmp/txz2xzm$$
installpkg -root $TMPDIR $1
if [ $? != 0 ]; then echo "error installing $NAME"; exit; fi
# optimalization procedures, this doesn't hurt
find $TMPDIR/usr{/local,/}{man,info} -type l -name "*.gz" 2>/dev/null | xargs -r gunzip -f
find $TMPDIR/usr{/local,/}{man,info} -type f -name "*.gz" 2>/dev/null | xargs -r gunzip
rm -f $TMPDIR/{usr,usr/local,var}/man/cat*/*
rm -f $TMPDIR/install > /dev/null 2>&1
mksquashfs $TMPDIR "$2" -b 256K
if [ $? != 0 ]; then echo "error building $NAME"; exit; fi
rm -Rf $TMPDIR
}
dir2xzm () {
# Compress directory in module
PATH=.:$(dirname $0):/usr/lib:$PATH
. liblinuxlive || exit 1
if [ ! -d "$1" -o "$2" = "" ]; then
echo
echo "Convert directory tree into .xzm compressed module"
echo "usage: $0 source_directory output_file.xzm"
exit 1
fi
create_module "$1" "$2"
if [ $? != 0 ]; then echo "error building compressed image"; exit 1; fi
}
xzm2dir () {
# Unpack module in directory
if [ ! -d "$2" ]; then
echo
echo "Convert .xzm compressed module back into directory tree"
echo "usage: $0 source_file.xzm existing_output_directory"
exit 1
fi
PATH=.:$(dirname $0):/usr/lib:$PATH
. liblinuxlive || exit 1
unsquashfs -f -dest "$2" "$1"
}
cleaner () {
# Cleanning of the system
if [ -d $TMP ]; then
rm -Rf $TMP
fi
if [ -d $TMP_SRC ]; then
rm -Rf $TMP_SRC
fi
if [ -d /tmp/$F_NAME-merged ]; then
rm -Rf /tmp/$F_NAME-merged
fi
}
echo "What is your name ?"
read builder
if [ "$builder" = "" ]; then
builder=porteus
fi
CPU=`uname -m`
VER_APP=12.0.742.91
CWD=`pwd`
F_LAST=$CWD/${F_NAME}-$VER_APP-1$builder.xzm
LOG_XZM=$CWD/${F_NAME}-$VER_APP-1$builder.log
clear
echo "===============> PORTEUS <==============="
echo
echo "Welcome to $NAME Installer for Porteus"
echo "Press any key to begin the installation"
read
clear
echo "Downloading...."
cleaner
mkfolder $TMP
mkfolder $TMP_SRC
cd $TMP_SRC
download $SRC
download $DEP_1
download $DEP_2
download $DEP_3
download $DEP_4
checker () {
if [ -e "$1" ]; then
echo $1 : OK
else
echo $1 : Failed
exit
fi
}
echo "Checking of files..."
checker $F_32
checker $DP_1
checker $DP_2
checker $DP_3
checker $DP_4
echo "Preparing of $NAME..."
mkdir /tmp/${F_NAME}-merged
cd $TMP_SRC
for x in `ls *.t?z`; do installpkg -root /tmp/$F_NAME-merged $x; done
clear
if [ -d /tmp/$F_NAME-merged ]; then
echo "Building the module..."
echo "Type your block size for compression of the module OR press ENTER"
echo "Block Sizes available :"
echo "64K"
echo "128K"
echo "256K"
echo "512K"
echo "1024K"
echo "Type your block size : "
read B_SIZE
if [ "$B_SIZE" != "" ]; then
if [ -e $F_LAST ]; then
rm -Rf $F_LAST
fi
mksquashfs /tmp/$F_NAME-merged $F_LAST -b $B_SIZE
else
if [ -e $F_LAST ]; then
rm -Rf $F_LAST
fi
mksquashfs /tmp/$F_NAME-merged $F_LAST -b 256K
fi
else
echo "Build failed!"
fi
clear
if [ -e "$F_LAST" ]; then
echo "===============> PORTEUS <==============="
echo "Your module $NAME is ready!"
echo "Thanks to the Porteus Community!"
echo "-----------------------------------------"
echo "Your module is saved in the folder $CWD"
echo "-----------------------------------------"
echo "Cleaning the system..."
rm -Rf $TMP
rm -Rf $TMP_SRC
if [ -e $LOG_XZM ]; then rm -Rf $LOG_XZM
fi
touch $LOG_XZM
LOG_PKGS=`cd /tmp/$F_NAME-merged/var/log/packages && ls -1`
touch $LOG_XZM
echo '=====> Compiled on Porteus <=====' >> $LOG_XZM
echo 'Compiled with success' >> $LOG_XZM
echo 'App: '$NAME >> $LOG_XZM
echo '=== Version ===' >> $LOG_XZM
echo $VER_APP >> $LOG_XZM
echo '=== Name of Builder ===' >> $LOG_XZM
echo $builder >> $LOG_XZM
echo '=== Included Packages ===' >> $LOG_XZM
echo $LOG_PKGS >> $LOG_XZM
echo '=== Settings ===' >> $LOG_XZM
echo '$TMP: '$TMP >> $LOG_XZM
echo 'TMP_SRC: '$TMP_SRC >> $LOG_XZM
echo '=== CPU ===' >> $LOG_XZM
echo $CPU >> $LOG_XZM
echo '==== Support Details ====' >> $LOG_XZM
echo $MCH_FULL >> $LOG_XZM
rm -Rf /tmp/${F_NAME}-merged
else
clear
echo "Build failed!"
echo "Please report this bug to the Porteus Forum!"
echo "Do you make a log?"
read ans_log
if [ "$ans_log" = "y" ]; then
LOG_PKGS=`cd /tmp/$F_NAME-merged/var/log/packages && ls -1`
touch $LOG_XZM
echo '=====> Compiled on Porteus <=====' >> $LOG_XZM
echo 'Compiled without success' >> $LOG_XZM
echo 'App: '$NAME >> $LOG_XZM
echo '=== Version ===' >> $LOG_XZM
echo $VER_APP >> $LOG_XZM
echo '=== Name of Builder ===' >> $LOG_XZM
echo $builder >> $LOG_XZM
echo '=== Included Packages ===' >> $LOG_XZM
echo $LOG_PKGS >> $LOG_XZM
echo '=== Settings ===' >> $LOG_XZM
echo '$TMP: '$TMP >> $LOG_XZM
echo 'TMP_SRC: '$TMP_SRC >> $LOG_XZM
echo '=== CPU ===' >> $LOG_XZM
echo $CPU >> $LOG_XZM
echo '==== Support Details ====' >> $LOG_XZM
echo $MCH_FULL >> $LOG_XZM
echo "Cleaning the system"
cleaner
rm -Rf /tmp/${F_NAME}-merged
fi
fi