1. VectorLinux Core
  2. vabs

Source

vabs / var / vabs / VL-ISO-STD / src / VL-ISO-STD.SlackBuild

#!/usr/bin/bash
# This script assumes it will be launched within "/NAME/VERSION/src" dir.
# With all sources in "src" Your Vector Linux .txz package, slack-desc,
# and slack-required will be found in "VERSION" dir. The extraction and
# build will be in a temp dir created in "NAME" dir, and then removed on exit.
# Comment out second to last line to keep this dir intact.
#
# This Template was compiled from the contributions of many users of the Vector
# Linux forum at http://forum.vectorlinux.com and from tidbits collected 
# from all over the internet. 
#
# Generated by sbbuilder-0.4.14.1, written by Rodrigo Bistolfi 
# (rbistolfi) and Raimon Grau Cuscó (Kidd) for VectorLinux.
#
# Please put your name below if you add some original scripting lines.
# AUTHORS = 

NAME="VL-ISO"            #Enter package Name!
VERSION=${VERSION:-"7.1"}      #Enter package Version!
VER=$(echo $VERSION|sed 's/-/_/') #this fixes - in version
VL_PACKAGER=${VL_PACKAGER:-"Uelsk8s"}   #Enter your Name!
LINK=${LINK:-"http://ftp-osl.osuosl.org/pub/vectorlinux/vec7/VL-SOURCE/$NAME.tar.xz"}  #Enter URL for package here!

#SYSTEM VARIABLES
#----------------------------------------------------------------------------
BUILDNUM=${BUILDNUM:-"A1"}
VL_VERSION="STD"
ARCH=${ARCH:-"$(uname -m)"}
CONFIG_OPTIONS=${CONFIG_OPTIONS:-""}
LDFLAG_OPTIONS=${LDFLAG_OPTIONS:-""}
ADDRB=${ADDRB:-""} #Add deps that need to be added to the slack-required file here
EXRB=${EXRB:-""} #Add deps that need to be excluded from the slack-required file here
MAKEDEPENDS=${MAKEDEPENDS:-"cdrkit bootsplash cpio"} #Add deps needed TO BUILD this package here.
#----------------------------------------------------------------------------

#CFLAGS SETUP
#--------------------------------------------
if [[ "$ARCH" = i?86 ]]; then
  ARCH=i586
  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  CONFIGURE_TRIPLET="i486-vector-linux"
  LIBDIRSUFFIX=""
  THEME=std-7-Boot
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fpic"
  CONFIGURE_TRIPLET="x86_64-vlocity-linux"
  LIBDIRSUFFIX="64"
  THEME=std-71
elif [ "$ARCH" = "powerpc" ]; then
  SLKCFLAGS="-O2"
  CONFIGURE_TRIPLET="powerpc-vlocity-linux"
  LIBDIRSUFFIX=""
  THEME=std-71
fi

export CFLAGS="$SLKCFLAGS $CFLAG_OPTIONS"
export CXXFLAGS=$CFLAGS
export LDFLAGS="$LDFLAGS $LDFLAG_OPTIONS"
CDLABEL="VL${LIBDIRSUFFIX}-$VERSION"
CDNAME="$CDLABEL-STD-$BUILDNUM.iso"
#--------------------------------------------

# DO NOT EXECUTE if NORUN is set to 1
if [ "$NORUN" != "1" ]; then

#SETUP PACKAGING ENVIRONMENT
#--------------------------------------------
CWD=$(pwd)
cd ../
RELEASEDIR=$(pwd)
cd $CWD
mkdir -p $RELEASEDIR/tmp
TMP=$RELEASEDIR/tmp
PKG=$TMP/package-$NAME
#--------------------------------------------



if [ $UID != 0 ]; then
   echo "You are not authorized to run this script. Please login as root"
   exit 1
fi


#GET THE SOURCE
#--------------------------------------------
for SRC in $(echo $LINK);do
if [ ! -f $CWD/$(basename $SRC) ]
then
        wget --no-check-certificate -c $SRC
fi
done
#--------------------------------------------


rm -rf $PKG
cd $TMP
rm -rf $NAME-$VERSION


#EXTRACT SOURCES
#-----------------------------------------------------
echo "Extracting source..."
mkdir -p $NAME-$VERSION || exit 1
cd $TMP/$NAME-$VERSION
tar xvf $CWD/$NAME.tar.xz || exit 1
#-----------------------------------------------------




#PATCHES
#-----------------------------------------------------
# Put any Patches here *NOTE this only works if all 
# your patches use the -p1 strip option!
#-----------------------------------------------------
for i in $CWD/patches/*;do
  patch -p1 <$i
  mkdir -p $PKG/usr/doc/$NAME-$VERSION/patches/
  cp $i $PKG/usr/doc/$NAME-$VERSION/patches/
done
#-----------------------------------------------------
 
 

#SET PERMISSIONS
#-----------------------------------------
echo "Setting permissions..."
chown -R root:root .
find . -perm 664 -exec chmod 644 {} \;
find . -perm 777 -exec chmod 755 {} \;
find . -perm 2777 -exec chmod 755 {} \;
find . -perm 775 -exec chmod 755 {} \;
find . -perm 2755 -exec chmod 755 {} \;
find . -perm 774 -exec chmod 644 {} \;
find . -perm 666 -exec chmod 644 {} \;
find . -perm 600 -exec chmod 644 {} \;
find . -perm 444 -exec chmod 644 {} \;
find . -perm 400 -exec chmod 644 {} \;
find . -perm 440 -exec chmod 644 {} \;
find . -perm 511 -exec chmod 755 {} \;
find . -perm 711 -exec chmod 755 {} \;
find . -perm 555 -exec chmod 755 {} \;
#-----------------------------------------



#CONFIGURE & MAKE
#----------------------------------------------------------------------
#
#-----------------------------------------------------------------------

DISTRO=$(echo $CONFIGURE_TRIPLET|cut -d'-' -f2)
echo $DISTRO

echo "Configuring source..."
#get the pkgs. we have a list in $CWD/pkgs. slapt-get from repo?
slapt-get --update
for i in $(cat $CWD/pkgs);do
  dir=$(echo $i|cut -d'/' -f1)
  pkg=$(echo $i|cut -d'/' -f2)
  slapt-get --install --reinstall --download-only --no-dep $pkg
  #mv the pkgs.
  mv /home/ftp/pub/veclinux/packages/$pkg*t?z ISO/packages/$dir/
done

#mv the kernel from the kernel-pkg to the iso.
cd ISO/packages/
mkdir PKG
cd PKG
kern="$(ls ../a/kernel-[0-9]*txz)"
echo "Using $kern"
explodepkg $kern
mv -v boot/vmlinuz* ../../isolinux/kernel/sata
sed -i '/^if/d' install/doinst.sh
sed -i '/^fi/d' install/doinst.sh
makepkg $kern
cd ../ && rm -r PKG
kern_ver=$(echo $kern|cut -d'-' -f2)

#Create PACKAGES.TXT in the iso.
./makeinfo-slack all
./makeinfo-slapt all
cd $TMP/$NAME-$VERSION

#copy the veclinux folder to the ISO.
cp -r $CWD/veclinux ISO

#Make initrd with modules that match kernel
installpkg ISO/packages/a/kernel-modules-$kern_ver*txz
mkdir -v $TMP/INITRD && cd $TMP/INITRD
lzcat $TMP/$NAME-$VERSION/ISO/isolinux/pyinit.lz|cpio -id 
rm -r lib/modules/*
cp -v $CWD/modules .
sh modules $kern_ver
cp -r $CWD/$THEME /etc/bootsplash/themes/
echo "Creating $THEME splash file"
splash -s -f /etc/bootsplash/themes/$THEME/config/bootsplash-800x600.cfg >../bootsplash
echo "Creating initrd"
find . | cpio -o -H newc >../init-sm 
cd ..
echo "Appending bootsplash to initrd"
echo bootsplash | cpio -o -H newc >> init-sm
echo "Compressing initrd"
xz -F lzma init-sm 
mv -v init-sm.lzma $TMP/$NAME-$VERSION/ISO/isolinux/pyinit.lz 
echo "initrd created"
cd $TMP/$NAME-$VERSION

#copy the ISO splash and message
cp -v $CWD/$DISTRO/* ISO/isolinux/

#create the iso.
mkisofs -o "$CDNAME" -v -J -R -D -A "$CDLABEL" -V "$CDLABEL" \
-no-emul-boot -boot-info-table -boot-load-size 4 \
-b isolinux/isolinux.bin -c isolinux/isolinux.boot ISO

#######################################################################
#Miscellenious tweaks and things outside a normal ./configure go here #
#######################################################################


echo "Creating package $CDNAME.txz"
mv $CDNAME $RELEASEDIR/$CDNAME.txz

cd $CWD
echo "Cleaning up temp files..." && rm -rf $TMP
echo "Package Complete"
fi
#--------------------------------------------------------------

# vim: set tabstop=4 shiftwidth=4 foldmethod=marker : ##