#!/usr/bin/bash # This script assumes it will be launched within "/NAME/VERSION/src" dir. # With all sources in "src" Your Vector Linux .tlz 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. NAME="4Pane" #Enter package Name! VERSION=${VERSION:-"0.5.1"} #Enter package Version! VL_PACKAGER=${VL_PACKAGER:-"toothandnail"} #Enter your Name! #SYSTEM VARIABLES #---------------------------------------------------------------------------- BUILDNUM=${BUILDNUM:-"1"} VL_VERSION=${VL_VERSION:-"$(ls /var/log/packages/|grep vlconfig2|cut -d "-" -f4|cut -c 2-5)"} BUILD=${BUILD:-"$BUILDNUM""$VL_VERSION"} ARCH=${ARCH:-$(uname -m)} CONFIG_OPTIONS=${CONFIG_OPTIONS:-""} LDFLAG_OPTIONS=${LDFLAG_OPTIONS:-""} #---------------------------------------------------------------------------- #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 if [ ! -x /usr/bin/requiredbuilder ]; then echo "Requiredbuilder not installed, or not executable." exit 1 fi if [ $VL_PACKAGER = "YOURNAME" ]; then echo 'Who are you? Please edit VL_PACKAGER=${VL_PACKAGER:-YOURNAME} in this script. Change the word "YOURNAME" to your VectorLinux packager name. You may also export VL_PACKAGER, or call this script with VL_PACKAGER="YOUR NAME HERE"' exit 1 fi #CFLAGS SETUP #-------------------------------------------- if [[ "$ARCH" = i?86 ]]; then ARCH=i586 SLKCFLAGS="-O2 -march=i586 -mtune=i686" CONFIGURE_TRIPLET="i486-slackware-linux" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fpic" CONFIGURE_TRIPLET="x86_64-pc-linux" fi export CFLAGS="$SLKCFLAGS $CFLAG_OPTIONS" export CXXFLAGS=$CFLAGS export LDFLAGS="$LDFLAGS $LDFLAG_OPTIONS" #-------------------------------------------- rm -rf $PKG mkdir -p $PKG cd $TMP rm -rf $NAME-$VERSION #EXTRACT SOURCES #----------------------------------------------------- echo "Extracting source..." tar xvf $CWD/$NAME.tar.* || exit 1 #----------------------------------------------------- cd $TMP/$NAME #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 #---------------------------------------------------------------------- # If you are building a KDE-related app, then change the following # arguments in the script below: # --prefix=$(kde-config -prefix) \ # --sysconfdir=/etc/kde \ # # Making these changes will ensure that your package will build in the # correct path and that it will work seamlessly within the KDE environment. # #----------------------------------------------------------------------- echo "Configuring source..." ./configure --prefix=/usr \ --sysconfdir=/etc \ --localstatedir=/var \ --mandir=/usr/man \ --with-included-gettext \ --disable-debug \ --program-prefix="" \ --program-suffix="" \ --build=$CONFIGURE_TRIPLET \ $CONFIG_OPTIONS || exit 1 make || exit 1 make install DESTDIR=$PKG || exit ####################################################################### #Miscellenious tweaks and things outside a normal ./configure go here # ####################################################################### mkdir -p $PKG/usr/share/applications cat << "EOF" >$PKG/usr/share/applications/$NAME.desktop [Desktop Entry] Encoding=UTF-8 Version=1.0 Type=Application Terminal=false Exec=4Pane Name=4Pane Icon=4Pane Comment=wxGTK-based File Manager GenericName=File Manager Categories=Utility;FileManager; EOF mkdir -p $PKG/etc/4Pane cat << "EOF" >$PKG/etc/4Pane/4Pane.conf [Devices] [Devices/Misc] FloppyDevicesAutomount=0 CDRomDevicesAutomount=1 UsbDevicesAutomount=1 FloppyDevicesSupermount=0 CDRomDevicesSupermount=0 UsbDevicesSupermount=0 DeviceDiscoveryType=2 FloppyDevicesInFstab=0 CDDevicesInFstab=0 UsbDevicesInFstab=2 SuppressEmptyUsbDevices=1 NoOfButtons=9 PARTITIONS=/proc/partitions DEVICEDIR=/dev/ FLOPPYINFOPATH=/sys/block/fd CDROMINFO=/proc/sys/dev/cdrom/info ScsiUsbDir=/proc/scsi/usb-storage- SCSISCSI=/proc/scsi/scsi AutomountUsbPrefix=/dev/sd ScsiDevicesDir=/sys/bus/scsi/devices LVMPREFIX=dm- LVM_INFO_FILE_PREFIX=/dev/.udevdb/block@ ASK_BEFORE_UMOUNT_ON_EXIT=0 CHECK_USB_TIMEINTERVAL=3 [Devices/Buttons] [Devices/Buttons/a] Bitmap=harddisk.xpm Tooltip=Hard drive [Devices/Buttons/b] Bitmap=floppy.xpm Tooltip=Floppy disc [Devices/Buttons/c] Bitmap=cdrom.xpm Tooltip=CD or DVDRom [Devices/Buttons/d] Bitmap=cdr.xpm Tooltip=CD or DVD writer [Devices/Buttons/e] Bitmap=UsbPen.xpm Tooltip=USB Pen [Devices/Buttons/f] Bitmap=UsbMem.xpm Tooltip=USB memory card [Devices/Buttons/g] Bitmap=UsbMulticard.xpm Tooltip=USB card-reader [Devices/Buttons/h] Bitmap=harddisk-usb.xpm Tooltip=USB hard drive [Devices/Buttons/i] Bitmap=unknown.xpm Tooltip=Unknown device [Editors] NoOfEditors=1 [Editors/a] Editor=firefox LaunchString=firefox CanUseTabs=0 Ignore=0 IconNo=3 [Editors/Icons] NoOfKnownIcons=7 [Editors/Icons/a] Icon=kwrite.xpm Icontype=9 [Editors/Icons/b] Icon=gedit.xpm Icontype=9 [Editors/Icons/c] Icon=kedit.xpm Icontype=9 [Editors/Icons/d] Icon=firefox.png Icontype=15 [Editors/Icons/e] Icon=editor.xpm Icontype=9 [Editors/Icons/f] Icon=openoffice.png Icontype=15 [Editors/Icons/g] Icon=unknown.xpm Icontype=9 [FileAssociations] [FileAssociations/Audio] dummy= [FileAssociations/Development] dummy= [FileAssociations/Editors] [FileAssociations/Editors/gedit] Ext= Filepath= Command= [FileAssociations/Graphics] [FileAssociations/Graphics/ImageMagick] Ext=gif,xpm,png,jpg,jpeg,JPG,JPEG,bmp Filepath=display Command=display %s [FileAssociations/Graphics/The\ Gimp] Ext=gif,xpm,png,jpg,jpeg,JPG,JPEG,bmp Filepath=gimp Command=gimp %s [FileAssociations/Internet] [FileAssociations/Internet/firefox] Ext=html,htm,HTML,HTM Filepath=firefox Command=firefox %s [FileAssociations/Multimedia] dummy= [FileAssociations/Office] dummy= [FileAssociations/Other] dummy= [FileAssociations/Utilities] dummy= [LaunchExt] count=10 [LaunchExt/a] Ext=html DefaultLabel=firefox DefaultCommand=firefox %s appcount=1 [LaunchExt/a/a] Label=firefox Command=firefox %s [LaunchExt/b] Ext=htm DefaultLabel=firefox DefaultCommand=firefox %s appcount=1 [LaunchExt/b/a] Label=firefox Command=firefox %s [LaunchExt/c] Ext=HTML DefaultLabel=firefox DefaultCommand=firefox %s appcount=1 [LaunchExt/c/a] Label=firefox Command=firefox %s [LaunchExt/d] Ext=HTM DefaultLabel=firefox DefaultCommand=firefox %s appcount=1 [LaunchExt/d/a] Label=firefox Command=firefox %s [LaunchExt/e] Ext=jpg DefaultLabel=ImageMagick DefaultCommand=display %s appcount=2 [LaunchExt/e/a] Label=ImageMagick Command=display %s [LaunchExt/e/b] Label=The Gimp Command=gimp %s [LaunchExt/f] Ext=png DefaultLabel=ImageMagick DefaultCommand=display %s appcount=2 [LaunchExt/f/a] Label=ImageMagick Command=display %s [LaunchExt/f/b] Label=The Gimp Command=gimp %s [LaunchExt/g] Ext=gif DefaultLabel=ImageMagick DefaultCommand=display %s appcount=2 [LaunchExt/g/a] Label=ImageMagick Command=display %s [LaunchExt/g/b] Label=The Gimp Command=gimp %s [LaunchExt/h] Ext=bmp DefaultLabel=ImageMagick DefaultCommand=display %s appcount=2 [LaunchExt/h/a] Label=ImageMagick Command=display %s [LaunchExt/h/b] Label=The Gimp Command=gimp %s [LaunchExt/i] Ext=4Pane DefaultLabel=mousepad DefaultCommand=/usr/bin/mousepad appcount=1 [LaunchExt/i/a] Label=mousepad Command=/usr/bin/mousepad [LaunchExt/j] Ext=txt DefaultLabel=mousepad DefaultCommand=/usr/X11/bin/mousepad appcount=1 [LaunchExt/j/a] Label=mousepad Command=/usr/X11/bin/mousepad [Misc] [Misc/Terminal] TERMINAL=xterm TERMEM_PROMPTFORMAT=%u@%h: %w %$> NoOfEntries=3 a=konsole b=gnome-terminal c=xterm [Misc/Terminal/TERMINAL_FONT] UseSystemDefault=1 pointsize=8 family=74 style=90 weight=90 underlined=0 facename=Sans [Misc/TerminalCommand] TERMINAL_COMMAND=xterm -e NoOfEntries=3 a=konsole -e b=gnome-terminal -x c=xterm -e [Misc/ToolsTerminalCommand] TOOLS_TERMINAL_COMMAND=xterm -hold -e NoOfEntries=2 a=konsole --noclose -e b=xterm -hold -e [Tools] [Tools/Launch] Label=Run a Program Count=4 label_a=df data_a=df -h terminal_a=1 persists_a=1 label_b=du data_b=du -h terminal_b=1 persists_b=1 label_c=md5sum data_c=md5sum %f terminal_c=1 persists_c=1 label_d=Install Package data_d=/sbin/vsuper /sbin/vinstallpkg %f terminal_d=0 persists_d=0 EOF mkdir -p $PKG/usr/share/pixmaps convert $PKG/usr/share/4Pane/bitmaps/4PaneIcon48.png -resize 48x48 -depth 8 $PKG/usr/share/pixmaps/4Pane.png mkdir -p $PKG/usr/doc/$NAME-$VERSION cp -a changeLog INSTALL LICENCE PACKAGERS README \ $PKG/usr/doc/$NAME-$VERSION cat $CWD/$NAME.SlackBuild > $PKG/usr/doc/$NAME-$VERSION/$NAME.SlackBuild mkdir -p $PKG/usr/doc/$NAME-$VERSION/help cp -a $PKG/usr/share/doc/4Pane/* $PKG/usr/doc/$NAME-$VERSION/help rm -rf $PKG/usr/share/doc/* rmdir $PKG/usr/share/doc #---------------------------------------------------------------------- if [ -d $PKG/usr/share/man ] ; then mkdir -p $PKG/usr/man mv $PKG/usr/share/man/* $PKG/usr/man rm $PKG/usr/share/man fi find $PKG/usr/man -type f -exec gzip -9 {} \; if [ -d $PKG/usr/share/info ] ; then mkdir -p $PKG/usr/info mv $PKG/usr/share/info/* $PKG/usr/info rm $PKG/usr/share/info fi find $PKG/usr/info -type f -exec gzip -9 {} \; mkdir -p $PKG/install # This creates the white space in front of "handy-ruler" in slack-desc below. LENGTH=$(expr length "$NAME") SPACES=0 SHIM="" until [ "$SPACES" = "$LENGTH" ]; do SHIM="$SHIM " let SPACES=$SPACES+1 done # Fill in the package summary between the () below. # Then package the description, License, Author and Website. # There may be no more then 11 $NAME: lines in a valid slack-desc. cat > $RELEASEDIR/slack-desc << EOF # HOW TO EDIT THIS FILE: # The "handy ruler" below makes it easier to edit a package description. Line # up the first '|' above the ':' following the base package name, and the '|' # on the right side marks the last column you can put a character in. You must # make exactly 11 lines for the formatting to be correct. It's also # customary to leave one space after the ':'. $SHIM|-----handy-ruler------------------------------------------------------| $NAME: $NAME (a fast and flexible file manager) $NAME: $NAME: $NAME a fast, full-featured graphical file manager. It uses a dual $NAME: twin-pane display. It is also capable of handling archived files, $NAME: automounting devices such as optical or USB devices. It is highly $NAME: configurable $NAME: $NAME: $NAME: License: GPL $NAME: Authors: David Hart $NAME: Website: http://www.4pane.co.uk #---------------------------------------- BUILDDATE: $(date) PACKAGER: $VL_PACKAGER HOST: $(uname -srm) DISTRO: $(cat /etc/vector-version) CFLAGS: $CFLAGS LDFLAGS: $LDFLAGS CONFIGURE: $(awk "/\.\/configure\ /" $TMP/$NAME-$VERSION/config.log) EOF cat $RELEASEDIR/slack-desc > $PKG/install/slack-desc cat << "EOF" >$PKG/install/doinst.sh doinst() { ( cd usr/doc ; rm -rf 4Pane ) ( cd usr/doc ; ln -sf 4Pane-0.5.1/help 4Pane ) ( cd usr/bin ; rm -rf 4pane ) ( cd usr/bin ; ln -sf 4Pane 4pane ) } doinst EOF #STRIPPING #------------------------------------------------------------------------------------------------------------------ cd $PKG echo " " echo "Stripping...." echo " " find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null #------------------------------------------------------------------------------------------------------------------ #FINISH PACKAGE #-------------------------------------------------------------- echo "Finding dependencies..." requiredbuilder -v -y -s $RELEASEDIR $PKG echo "Creating package $NAME-$VERSION-$ARCH-$BUILD.tlz" makepkg -l y -c n $RELEASEDIR/$NAME-$VERSION-$ARCH-$BUILD.tlz cd $CWD echo "Cleaning up temp files..." && rm -rf $TMP echo "Package Complete" #--------------------------------------------------------------