From 52a3537b8ebca3a5146cf363ffa6d716f2b00da0 Mon Sep 17 00:00:00 2001 From: rhatto Date: Fri, 6 Mar 2009 02:03:53 +0000 Subject: removing old 0.6 branch git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@798 04377dda-e619-0410-9926-eae83683ac58 --- branches/0.6/src/createpkg | 515 --------------------- branches/0.6/src/jail-commit | 170 ------- branches/0.6/src/jail-update | 61 --- branches/0.6/src/lspkg | 132 ------ branches/0.6/src/mkbuild | 732 ----------------------------- branches/0.6/src/mkjail | 113 ----- branches/0.6/src/rebuildpkg | 87 ---- branches/0.6/src/repos | 87 ---- branches/0.6/src/simplaret | 1045 ------------------------------------------ branches/0.6/src/templatepkg | 959 -------------------------------------- 10 files changed, 3901 deletions(-) delete mode 100644 branches/0.6/src/createpkg delete mode 100755 branches/0.6/src/jail-commit delete mode 100755 branches/0.6/src/jail-update delete mode 100755 branches/0.6/src/lspkg delete mode 100755 branches/0.6/src/mkbuild delete mode 100755 branches/0.6/src/mkjail delete mode 100755 branches/0.6/src/rebuildpkg delete mode 100755 branches/0.6/src/repos delete mode 100755 branches/0.6/src/simplaret delete mode 100755 branches/0.6/src/templatepkg (limited to 'branches/0.6/src') diff --git a/branches/0.6/src/createpkg b/branches/0.6/src/createpkg deleted file mode 100644 index 373c8cc..0000000 --- a/branches/0.6/src/createpkg +++ /dev/null @@ -1,515 +0,0 @@ -#!/bin/bash -# -# createpkg: package builder using http://slack.sarava.org/slackbuilds scripts -# feedback: rhatto at riseup.net | gpl -# -# createpkg is free software; you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation; either version 2 of the License, or any later version. -# -# createpkg is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -# A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 59 Temple -# Place - Suite 330, Boston, MA 02111-1307, USA -# -# /etc/simplepkg/slackbuildrc parameters: -# -# SLACKBUILDS_DIR="/folder/to/place/slackbuilds", defaults to /var/slackbuilds -# SVN="svn://repository", defaults do svn://slack.sarava.org/slackbuilds -# SYNC="yes|no", whether to always update the repository -# -# TODO -# -# - optionally show a dependency tree before create the package -# - in function solve_dep: resolve program versions -# - mkdir source directory - error... (please check!) - -#--------------------------------------------------- -# Createpkg functions -#--------------------------------------------------- - -CREATEPKG_VERSION="1.1.1" - -function error_codes { - - # Slackbuilds error codes - ERROR_WGET=31 # wget error - ERROR_MAKE=32 # make source error - ERROR_INSTALL=33 # make install error - ERROR_MD5=34 # md5sum error - ERROR_CONF=35 # ./configure error - ERROR_HELP=36 # dasable - ERROR_TAR=37 # tar error - ERROR_MKPKG=38 # makepkg error - ERROR_GPG=39 # gpg check error - ERROR_PATCH=40 # patch error - ERROR_VCS=41 # cvs error - ERROR_MKDIR=42 # make directory error - - # Createpkg error codes - ERROR_INSTPKG=200 # installpkg error - ERROR_DEPEN=201 # dependency error - SCRIPT_OR_PACKAGE_NOT_FOUND=202 # Script or package not found -} - -function handle_error { - - # This function deals with internal createpkg errors - # and also with non-zero exit codes from slackbuilds - # Input: $1 - error code - # Output: Error mensage - # - # check slackbuild exit status are: - # - # ERROR_WGET=31; ERROR_MAKE=32; ERROR_INSTALL=33 - # ERROR_MD5=34; ERROR_CONF=35; ERROR_HELP=36 - # ERROR_TAR=37; ERROR_MKPKG=38 ERROR_GPG=39 - # ERROR_PATCH=40; ERROR_VCS=41; ERROR_MKDIR=42 - # - # thanks to rudsonalves at yahoo.com.br for this spec. - - # we don't want to process when exit status = 0 - [ "$1" == "0" ] && return - - # Exit codes - case $1 in - 2) usage ;; - 3) eecho $alert "$BASENAME: could not update the repository $2" ;; - 4) eecho $alert "$BASENAME: could not create folder $2" ;; - 5) eecho $alert "$BASENAME: script not found for $2" ;; - $ERROR_WGET) - eecho $error "$BASENAME: error downloading source/package for $2" ;; - $ERROR_MAKE) - eecho $error "$BASENAME: error compiling $2 source code" ;; - $ERROR_INSTALL) - eecho $error "$BASENAME: error installing $2" ;; - $ERROR_MD5) - eecho $error "$BASENAME: error on source code integrity check for $2" ;; - $ERROR_CONF) - eecho $error "$BASENAME: error configuring the source code for $2" ;; - $ERROR_HELP) - exit 0 ;; # its supposed to never happen here :P - $ERROR_TAR) - eecho $error "$BASENAME: error decompressing source code for $2" ;; - $ERROR_MKPKG) - eecho $error "$BASENAME: error creating package $2" ;; - $ERROR_GPG) - eecho $error "$BASENAME: error verifying GPG signature the source code for $2" ;; - $ERROR_PATCH) - eecho $error "$BASENAME: error patching the source code for $2" ;; - $ERROR_VCS) - eecho $error "$BASENAME: error downloading $2 source from version control system" ;; - $ERROR_MKDIR) - eecho $error "$BASENAME: make directory $2 error, aborting" ;; - $ERROR_INSTPKG) - eecho $error "$BASENAME: install package $2 error, aborting" ;; - $ERROR_DEPEN) - eecho $error "$BASENAME: dependency solve error, aborting" ;; - *) eecho $error "$BASENAME: unknown error or user interrupt" ;; - $SCRIPT_OR_PACKAGE_NOT_FOUND) - eecho $error "$BASENAME: SlackBuild or package not found" ;; - esac - - exit $1 - -} - -function build_repo { - - # Checkout a new slackbuild working copy - BASEDIR="`dirname $SLACKBUILDS_DIR`" - mkdir -p $BASEDIR || handle_error 4 $BASEDIR - cd $BASEDIR - svn checkout $SVN - cd $SLACKBUILDS_DIR - -} - -function usage { - - # Help message - eecho $commun "Createpkg version $CREATEPKG_VERSION\n" - eecho $commun "Usage: createpkg [--install/-i] package-name" - eecho $commun " createpkg --no-deps/-np package-name" - eecho $commun " createpkg --search/-s package-name" - eecho $commun " createpkg --info/-f package-name" - eecho $commun " createpkg --list/-l" - eecho $commun " createpkg --sync" - eecho $commun " createpkg --help/-h" -} - -function check_config { - - # check the configuration - TMP=${TMP:=/tmp}; - REPOS=${REPOS:=$MAKEPKG_REPOS}; - # Create $TMP and $REPOS if need - [ ! -e $TPM ] && mkdir $TMP - [ ! -e $REPOS ] && mkdir $REPOS - # - SLACKBUILDS_DIR=${SLACKBUILDS_DIR:=/var/slackbuilds} - SVN=${SVN:=svn://slack.sarava.org/slackbuilds} - SYNC=${SYNC:=$no} - SYNC=`convert_boolean $SYNC` - BASEDIR="`dirname $SLACKBUILDS_DIR`" - -} - -function solve_dep { - - # Solve dependency - local PACK="$1" - local COND="$2" - local VER="$3" - - # Check package in local system - PACK="`echo $PACK | sed -e 's/\+/\\\+/'`" - INSTALLED=`eval "ls /var/log/packages/ | egrep -E '^$PACK-[^-]+-[^-]+-[^-]+$'"` - CHECK=$? - - # TODO: Make check version procedures - if [ -z "$INSTALLED" ]; then - if [ $CHECK -ne 0 ]; then - # Check package in SlackBuilds tree - eecho $messag "$BASENAME: processing $PACKAGE dependency $PACK" - SYNC=$no CREATEPKG_CHILD=$CREATEPKG_CHILD createpkg --install $PACK - - # check if the package was built and installed - EXIT_CODE="$?" - - if [ "$EXIT_CODE" == "5" ]; then - - # exit code 5 == slackbuild not found - # try to use simplaret - ARCH=$CREATE_ARCH simplaret --update - ARCH=$CREATE_ARCH simplaret --install $PACK - EXIT_CODE="$?" - if [ "$EXIT_CODE" != "0" ]; then - handle_error $SCRIPT_OR_PACKAGE_NOT_FOUND $PACK - fi - - elif [ "$EXIT_CODE" != "0" ]; then - handle_error $EXIT_CODE $PACK - fi - - fi - fi - -} - -function check_repo { - - # Verify if repository exist - [ ! -d "$SLACKBUILDS_DIR" ] && build_repo - -} - -function sync_repo { - - # Synchronize repository - cd $SLACKBUILDS_DIR - exit # svn update || build_repo - #simplaret --update - -} - -function find_slackbuild { - - # Find SlackBuild script in the repository - find $SLACKBUILDS_DIR -iname $1.SlackBuild - -} - -function info_builds { - - # Show packages info - if [ "$PKG_PATH" != "" ]; then - for i in $PKG_PATH; do - PACKAGE=`basename $i .SlackBuild` - NAME_UP=`echo $PACKAGE | tr [a-z] [A-Z]` - eecho $commun "$NAME_UP: " - - PKG_DIR=`dirname $i` - if [ -e $PKG_DIR/slack-desc ]; then - eval "cat $PKG_DIR/slack-desc | grep '^$PACKAGE:' | cut -f2- -d:" - eecho $normal - else - eval "cat $i | grep '^$PACKAGE:' | cut -f2- -d:" - eecho $normal - fi - - if [ -e $PKG_DIR/slack-required ]; then - eecho $commun "slack-required" - cat $PKG_DIR/slack-required | sed 's/^/ /' - fi - done - fi - -} - -function list_builds { - - # List all available SlackBuilds - cd $SLACKBUILDS_DIR - echo "Sarava SlackBuilds list" - # level 1 - for i in *; do - if [ -d $i ]; then - echo -e " $i: " - ( - cd $i - # level 2 - for j in *; do - if [ -d $j ]; then - eecho $commun " $j" - ( - cd $j - BUILD="`ls *.SlackBuild 2>/dev/null`" - if [ "$BUILD" != "" ]; then - # level 3 - for k in $BUILD; do - eecho $messag " $k" - done - else - BUILD="" - fi - for k in *; do - if [ -d $k ]; then - eecho $messag " $k.SlackBuild" - fi - done - ) - fi - done - ) - fi - done - -} - -function load_parameters { - - # Load Createpkg parameters - MAKEPKG_REPOS="`eval_parameter MAKEPKG_REPOS /var/simplaret/repos`" - SOURCE_DIR="`eval_parameter SOURCE_DIR /var/simplaret/sources`" - SLACKBUILDS_DIR="`eval_parameter SLACKBUILDS_DIR /var/simplaret/slackbuilds`" - - COLOR_MODE="`eval_parameter COLOR_MODE none`" - CREATE_ARCH="`eval_parameter CREATE_ARCH $(default_arch)`" - CREATE_CLEANUP="`eval_boolean_parameter CREATE_CLEANUP $yes`" - - REMOVE_OLD_PACKAGE="`eval_boolean_parameter REMOVE_OLD_PACKAGE $off`" - MOVE_BIN_PACKAGE="`eval_boolean_parameter MOVE_BIN_PACKAGE $off`" -} - -#--------------------------------------------------- -# Starting createpkg -#--------------------------------------------------- -# Common functions -COMMON="/usr/libexec/simplepkg/common.sh" -SIMPLEPKG_CONF="/etc/simplepkg/simplepkg.conf" -BASENAME="`basename $0`" - -if [ -f "$COMMON" ]; then - source $COMMON -else - echo "error: file $COMMON found, check your $BASENAME installation" - mk_exit 0 -fi - -set_constants - -# Load simplepkg.conf variables -load_parameters -#eval_config $BASENAME - -# Loading error codes -error_codes - -# Load slackbuildrc definitions -if [ -f ~/.slackbuildrc ]; then - source ~/.slackbuildrc -else - source /etc/slackbuildrc 2>/dev/null -fi - -# Select color mode: gray, color or none (*) -color_select $COLOR_MODE - -# This is used to show how many children process we have -if [ -z "$CREATEPKG_CHILD" ]; then - CREATEPKG_CHILD=1 -else - let CREATEPKG_CHILD++ -fi - -BASENAME="`basename $0`[$CREATEPKG_CHILD]" - -check_config -check_repo - -INSTALL=$off -NO_DEPS=$off - -case $1 in - '--search'|'-s') - [ $# -ne 2 ] && handle_error 2 # two parameters is required - find_slackbuild $2 - exit - ;; - '--info'|'-f') - [ $# -ne 2 ] && handle_error 2 # two parameters is required - PKG_PATH=`find_slackbuild $2` - info_builds - exit - ;; - '--install'|'-i') - [ $# -ne 2 ] && handle_error 2 # two parameters is required - PACKAGE="$2" - INSTALL=$on - ;; - '--no-deps'|'-nd') - [ $# -ne 2 ] && handle_error 2 # two parameters is required - NO_DEPS=$on - PACKAGE="$2" - ;; - '--sync') - sync_repo - exit 0 - ;; - '--help'|'-h'|'') - usage - exit 0 - ;; - '--list'|'-l') - list_builds - exit 0 - ;; - *) - if [ "${1:0:1}" != "-" ]; then - PACKAGE="$1" - else - handle_error 2 - fi - ;; -esac - -# Synchronize repository -[ $SYNC -eq $yes ] && sync_repo - -# Get SlackBuild script -BUILD_SCRIPT="`find_slackbuild $PACKAGE`" - -# Check SlackBuild script found -if [ -z "$BUILD_SCRIPT" ]; then - handle_error 5 $PACKAGE -fi - -# Select one SlackBuild -if [ "`echo $BUILD_SCRIPT | wc -w`" -gt 1 ]; then - AUX="$PS3" - PS3="Choice: " - LIST=`echo $BUILD_SCRIPT | sed 's/ /\n/g' | sed -r 's/.*\/(.*)\.SlackBuild$/\1/'`" EXIT" - - select PACKAGE in `echo $LIST`; do - break - done - - if [ "$PACKAGE" = "EXIT" ]; then - eecho $error "error: None package select" - exit 1 - fi - - # Select only one SlackBuild in BUILD_SCRIPT - BUILD_SCRIPT=`echo $BUILD_SCRIPT | sed 's/ /\n/g' | grep "/$PACKAGE.SlackBuild"` - PS3="$AUX" -else - #PACKAGE=`echo $BUILD_SCRIPT | sed -r 's/.*\/(.*)\.SlackBuild$/\1/'` - PACKAGE=`basename $BUILD_SCRIPT .SlackBuild` -fi - -# Get dirname and script name from slackbuild -SCRIPT_BASE="`dirname $BUILD_SCRIPT`" -SCRIPT_NAME="`basename $BUILD_SCRIPT`" -eecho $messag "$BASENAME: found script $PACKAGE.SlackBuild, now checking for dependencies" - -# Sets the package's slack-required -if [ -f "$SCRIPT_BASE/$PACKAGE.slack-required" ]; then - SLACK_REQUIRED="$SCRIPT_BASE/$PACKAGE.slack-required" -elif [ -f "$SCRIPT_BASE/slack-required" ]; then - SLACK_REQUIRED="$SCRIPT_BASE/slack-required" -fi - -if [ ! -z "$SLACK_REQUIRED" -a $NO_DEPS -ne $on ]; then - # this routine checks for dependencies in package's slack-required - ( grep '^[^#]' $SLACK_REQUIRED | while read dep; do - if [ ! -z "$dep" ]; then - PROGRAM="`echo $dep | awk '{ print $1 }'`" - CONDITION="`echo $dep | awk '{ print $2 }' | tr [=\>\<] [egl]`" - VERSION="`echo $dep | awk '{ print $3 }' | tr -dc '[:digit:]'`" - solve_dep $PROGRAM $CONDITION $VERSION - fi - true - done ) - if [ $? -ne 0 ]; then - eecho $messag "$BASENAME: dependency solve error" - exit 1 - fi - eecho $messag "$BASENAME: done checking for $PACKAGE dependencies" -else - eecho $messag "$BASENAME: no unmet dependencies for $PACKAGE" -fi - -eecho $messag "$BASENAME: processing $SCRIPT_NAME" - -# Change to script base directory -cd $SCRIPT_BASE - -# Make MAKEPKG_REPOS -[ ! -e $MAKEPKG_REPOS ] && mkdir -p $MAKEPKG_REPOS - -# Run SlackBuild script -( - SRC_DIR=${SRC_DIR:=$SOURCE_DIR} \ - SRC=${SRC_DIR:=$SOURCE_DIR} \ - ARCH=${ARCH:=$CREATE_ARCH} \ - COLOR=${COLOR:=$COLOR_MODE} \ - REPOS=${REPOS:=$MAKEPKG_REPOS} \ - CLEANUP=${CLEANUP:=$CREATE_CLEANUP} \ - INTERACT=no sh ./$SCRIPT_NAME -) - -# Check if package was built -handle_error $? $PACKAGE - -# Get package name -PKG_NAME="`ls -1 -c $MAKEPKG_REPOS/$PACKAGE-*-*-*.tgz | head -n 1 | xargs basename`" - -# Select repository directory -[ $MOVE_BIN_PACKAGE -eq $on ] && NEW_REPOS=$MAKEPKG_REPOS/$( echo ${SCRIPT_BASE#$SLACKBUILDS_DIR/} ) || NEW_REPOS=$MAKEPKG_REPOS - -# Create repository directory -[ ! -e $NEW_REPOS ] && mkdir -p $NEW_REPOS 2>/dev/null - -# Remove old packages from repository tree -[ $REMOVE_OLD_PACKAGE -eq $on ] && rm $NEW_REPOS/$PACKAGE-*-*-*.tgz 2>/dev/null - -# Move package to SlackBuilds-like tree -[ $MOVE_BIN_PACKAGE -eq $on ] && mv $MAKEPKG_REPOS/$PKG_NAME $NEW_REPOS/ - -# Install package -if [ "$INSTALL" -eq $on ]; then - # as we dont have the full package file name, we'll - # use the newer file name that matches our wildcard: - - upgradepkg --install-new $NEW_REPOS/$PKG_NAME -fi - -# Update repository FILELIST.TXT, ... -( - cd $MAKEPKG_REPOS - gen_filelist -) diff --git a/branches/0.6/src/jail-commit b/branches/0.6/src/jail-commit deleted file mode 100755 index f2695d7..0000000 --- a/branches/0.6/src/jail-commit +++ /dev/null @@ -1,170 +0,0 @@ -#!/bin/bash -# -# jail-commit: update config files from a jail to a template -# feedback: rhatto@riseup.net | gpl -# -# Jail-commit is free software; you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation; either version 2 of the License, or any later version. -# -# Jail-commit is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -# A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 59 Temple -# Place - Suite 330, Boston, MA 02111-1307, USA -# - -COMMON="/usr/libexec/simplepkg/common.sh" -BASENAME="`basename $0`" - -if [ -f "$COMMON" ]; then - source $COMMON - eval_config $BASENAME -else - echo "error: file $COMMON found, check your $BASENAME installation" - exit 1 -fi - -function usage { - - echo $BASENAME: commit a jail configuration into a template - echo "usage: \"$BASENAME [ [template]]\"" - echo " \"$BASENAME --all\" to commit all templates" - echo " \"$BASENAME --help\" for help" - -} - -function template_merge { - - # copy differences between the jail - # and the template in the template folder - - # usage: template_merge - - if [ -z "$1" ] || [ ! -d "$TEMPLATE_BASE.d" ]; then - return 1 - fi - - echo "" > $TEMPLATE_BASE.perms.tmp - cd $TEMPLATE_BASE.d - - for file in `find | grep -v -e "/.svn$" | grep -v -e "/.svn/" | grep -v -e "^\.$"`; do - - if [[ -e "$file" && -e "$1/$file" ]]; then - - if [ ! -d "$file" ] && [ ! -h "$file" ]; then - if ! diff $file $1/$file; then - echo Updating $file - cp -af $1/$file $file - fi - elif [ -h "$file" ]; then - if [ "`readlink $file`" != "`readlink $1/$file`" ]; then - rm -f $file - ln -s `readlink $1/$file` $file - fi - fi - - perms="`numeric_perm $1/$file`" - owner="`get_owner $1/$file`" - group="`get_group $1/$file`" - echo "$file;$owner;$group;$perms" >> $TEMPLATE_BASE.perms.tmp - - else - if [ ! -e "$1/$file" ]; then - echo $BASENAME: warning: missing file `slash $1/$file` - fi - fi - - done - - cat $TEMPLATE_BASE.perms.tmp | sed '/^$/d' > $TEMPLATE_BASE.perms - rm -f $TEMPLATE_BASE.perms.tmp - - if ! svn_check $TEMPLATE_BASE,perms; then - svn add $TEMPLATE_BASE,perms - fi - -} - -function template_svn_commit { - - # issue a svn_commit from a template folder - # usage: template_svn_commit - - if use_svn && [ -d "$1/.svn" ]; then - cd $1 - echo First checking out from the repository... - svn update - echo Commiting changes to the repository... - svn commit -m "changes for `date`" - if [ "$?" != "0" ]; then - echo $BASENAME: commit error - fi - fi - -} - -function do_commit { - - # commit jail changes to a repository - # usage: do_commit [template] - - local jailpath template - - jailpath="$1" - jail="`basename $jailpath`" - - if [ ! -z "$2" ]; then - template="$2" - else - template="$jail" - fi - - search_template $template --update - if [ "$?" == "0" ] && ! echo "$TEMPLATE_UPDATE_LIST" | grep -q " `basename $TEMPLATE_BASE` "; then - TEMPLATE_UPDATE_LIST=" $TEMPLATE_UPDATE_LIST `basename $TEMPLATE_BASE` " # the spaces are important - if [ "$jailpath" == "/" ]; then - echo Updating main installation... - else - echo Updating $jailpath... - fi - if [ -d "$TEMPLATE_BASE.d" ] || [ -a "$TEMPLATE_BASE.template" ]; then - SILENT=yes templatepkg -u $template $jailpath - template_merge $jailpath - fi - else - if [ -z "$SILENT" ]; then - echo $BASENAME: template $template not found - fi - return 1 - fi - -} - -TEMPLATE_UPDATE_LIST="" - -if [ "$1" == "--help" ]; then - usage -elif [ "$1" == "--all" ]; then - template_svn_commit $BASE_CONF/templates -elif echo $1 | grep -q -e "^--"; then - usage -elif [ ! -z "$1" ]; then - do_commit $1 $2 - if [ "$?" == "0" ]; then - template_svn_commit `dirname $TEMPLATE_BASE` - fi -else - SILENT="yes" - if [ -e $JAIL_LIST ]; then - for jailpath in `cat $JAIL_LIST`; do - do_commit $jailpath - done - fi - # main jail - do_commit / main - template_svn_commit $BASE_CONF/templates -fi - diff --git a/branches/0.6/src/jail-update b/branches/0.6/src/jail-update deleted file mode 100755 index c5a008f..0000000 --- a/branches/0.6/src/jail-update +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash -# -# jail-update: update config files from a jail to a template -# feedback: rhatto@riseup.net | gpl -# -# Jail-update is free software; you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation; either version 2 of the License, or any later version. -# -# Jail-update is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -# A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 59 Temple -# Place - Suite 330, Boston, MA 02111-1307, USA -# - -COMMON="/usr/libexec/simplepkg/common.sh" -BASENAME="`basename $0`" - -if [ -f "$COMMON" ]; then - source $COMMON - eval_config $BASENAME -else - echo "error: file $COMMON found, check your $BASENAME installation" - exit 1 -fi - -function usage { - - echo "$BASENAME: update a jail configuration from a template" - echo "usage: $BASENAME [template]" - -} - -if [ -z "$1" ] || [ "$1" == "--help" ] || echo $1 | grep -q -e "^--"; then - usage - exit 1 -fi - -if [ -z "$2" ]; then - template_name="`basename $1`" -else - template_name="$2" -fi - -search_template $template_name --update - -if [ "$?" != "0" ]; then - echo $BASENAME: template $template_name not found - exit 1 -elif [ ! -d "$1" ]; then - echo $BASENAME: jail $1 not found - exit 1 -fi - -update_template_files -copy_template_files $1 -set_jail_perms $1 - diff --git a/branches/0.6/src/lspkg b/branches/0.6/src/lspkg deleted file mode 100755 index 01900f2..0000000 --- a/branches/0.6/src/lspkg +++ /dev/null @@ -1,132 +0,0 @@ -#!/bin/bash -# -# lspkg v0.3: view installed and contents of slackware packages -# -# feedback: rhatto at riseup.net | gpl -# -# Lspkg is free software; you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation; either version 2 of the License, or any later version. -# -# Lspkg is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -# A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 59 Temple -# Place - Suite 330, Boston, MA 02111-1307, USA -# - -COMMON="/usr/libexec/simplepkg/common.sh" - -if [ -f "$COMMON" ]; then - source $COMMON -else - echo "error: file $COMMON not found, check your `basename $0` installation" - exit 1 -fi - -function head_line { - echo "usage: [ROOT=/otherroot] `basename $0` [option expression]" -} - -function usage { - head_line - echo " -options are: - - -v, --view: view installed package contents - -p, --print: print the contents of a package file - -r, --remove: remove matching packages - -s, --search: search a file under installed packages - -d, --description: show matching packages' descriptions -" -} - -# ----------------------------------------------------- -# lspkg -# ----------------------------------------------------- - -if [ $# -eq 2 ]; then - LIST_PKGS="`ls /$ROOT/var/log/packages/$2-[0-9]* 2> /dev/null`" - if [ -z "$LIST_PKGS" ]; then - LIST_PKGS="`ls /$ROOT/var/log/packages/$2* 2> /dev/null`" - fi -elif [ $# -eq 1 ]; then - LIST_PKGS="`ls /$ROOT/var/log/packages/$1-[0-9]* 2> /dev/null`" - if [ -z "$LIST_PKGS" ]; then - LIST_PKGS="`ls /$ROOT/var/log/packages/$1* 2> /dev/null`" - fi -else - LIST_PKGS="`ls /$ROOT/var/log/packages/ 2> /dev/null`" -fi - -LIST_PKGS="`slash $LIST_PKGS`" - -case $1 in - "-h"|"--help") - usage - ;; - "-v"|"--view") - if [ ! -z "$2" ]; then - if [ ! -z "$LIST_PKGS" ]; then - for file in $LIST_PKGS; do - less $file - done - else - if [ ! -z "$ROOT" ]; then - echo "$2: package not found on /$ROOT/var/log/packages" - else - echo "$2: package not found on /var/log/packages" - fi - fi - else - head_line - exit 1 - fi - ;; - "-p"|"--print") - if [ -f "$2" ]; then - tar ztvf $2 - else - echo $2: file not found - fi - ;; - "-r"|"--remove") - if [ ! -z "$2" ]; then - if [ ! -z "$LIST_PKGS" ]; then - removepkg /$ROOT/var/log/packages/$1-[0-9]* - fi - fi - ;; - "-s"|"--search") - if [ ! -z "$2" ]; then - eval "grep -l '\/$2$' /$ROOT/var/log/packages/*" - fi - ;; - "-d"|"--description") - if [ ! -z "$2" ]; then - for file in $LIST_PKGS; do - pack="`package_name $file`" - echo -e " Package description for $file:\n" - sed -n "/^$pack:/ { s/$pack://; p; }" $file - done - else - head_line - exit 1 - fi - ;; - *) - if [ ! -z "$LIST_PKGS" ]; then - for pack in $LIST_PKGS; do - echo $pack - done - else - if [ ! -z "$ROOT" ]; then - echo "$1: package not found on /$ROOT/var/log/packages" - else - echo "$1: package not found on /var/log/packages" - fi - fi - ;; -esac diff --git a/branches/0.6/src/mkbuild b/branches/0.6/src/mkbuild deleted file mode 100755 index 60566dd..0000000 --- a/branches/0.6/src/mkbuild +++ /dev/null @@ -1,732 +0,0 @@ -#!/bin/bash -# -# mkbuild: SlackBuild scripts maker -# feedback: rudsonaalves at yahoo.com.br | gpl -# -# mkbuild is free software; you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation; either version 2 of the License, or any later version. -# -# mkbuild is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -# A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 59 Temple -# Place - Suite 330, Boston, MA 02111-1307, USA -# -# -# Based in model generic.SlackBuild of Luiz -# -# Version 1.0.0 -PROG_VERSION=1.0.0 -PROG_NAME=`basename $0` - -#-------------------------------------------------------------------- -# Functions -#-------------------------------------------------------------------- -function mkbuild_use() - -{ - # mkbuild help function - echo " -NAME - mkbuild - create SlackBuild script from .mkbuild input file - -SYNOPSIS - mkbuild [OPIONS] [mkbuild_file] - -DESCRIPTION - input file with build rules and variables - - Input options: - -a, --author - author name - -ai, --author_initials - author signature - -cs, --const_string - construction string to source name - -u, --url - url address to source - -pn, --pkg_name - package name - -sn, --src_name - source name - -pv, --pkg_version - package version - -md, --model - SlackBuild model file - -j, --jobs - Number of jobs to run simultaneously - --prefix - Prefix install directory - - Program options: - -h, --help - this help mesage - -c, --commit - commit SlackBuilds in local svn tree - -v, --version - program version - -V, --verbose - print debug information - -EXAMPLES - mkbuild --prefix /usr/local pyrex.mkbuild - build pyrex.SlackBuild with prefix /usr/local and pyrex.mkbuild - variables and options definitions. - -AUTHOR - Written by Rduson R. Alves - -AVAILABILITY - by svn: svn checkout svn://slack.sarava.org/simplepkg - this mkbuild is found in branches/0.6/ - -REPORTING BUGS - Report bugs to - -COPYRIGHT - Copyright © 2006 Free Software Foundation, Inc. - This is free software. You may redistribute copies of it under the - terms of the GNU General Public License - . There is NO WARRANTY, to the - extent permitted by law. -" | less -} - -function error_codes { - - # Start error codes function - NULL_STRING=499 - ERROR_FILE_NOT_FOUND=500 - ERROR_CONSTRUCTION=501 - ERROR_PROGRAM=502 - ERROR_INPUT_PAR=503 -} - -function mkbuild_error { - - # Error function - case $1 in - "$ERROR_FILE_NOT_FOUND") - echo "File $2 not found!" - ;; - "$ERROR_CONSTRUCTION") - echo "Construction error in $2 variable." - ;; - "$ERROR_PROGRAM") - echo "Program logical error." - ;; - "$ERROR_INPUT_PAR") - echo "Input parameter $2 error. See \"mkbuild --help\"." - ;; - "$NULL_STRING") - mkbuild_use - ;; - *) - echo "Unknow error!" - ;; - esac - exit $1 -} - -function set_parameters { - - # Get and set mkbuild variables with parameters input - # Use: set_parameters $@ - # where $@ are the parameters input - # - ALL_PAR=( $@ ) # all parameters - N_PAR=$# # number of parameters - - i=0 # start counter - - # analyze all the parameters - while [ $i -lt $N_PAR ]; do - # get parameter[i] - PAR=${ALL_PAR[$i]} - case $PAR in - '-c'|'--commit') - # Commit directory - COMMIT=$on - ;; - '-d'|'--debug') - # Debug mode - set -x - ;; - '-h'|'--help' ) - # Show help mesage - mkbuild_use && exit 0 - ;; - '-v'|'--version') - # Show program version - echo -e "\n$PROG_NAME version $PROG_VERSION\n" && exit 0 - ;; - '-V' | '--verbose') - # Enable verbose mode - VERBOSE=1 - ;; - '-a'|'--author') - # Enter with author name - let i++ - AUTHOR=${ALL_PAR[$i]} - [ ${AUTHOR:0:1} = "-" ] && mkbuild_error $ERROR_INPUT_PAR AUTHOR - ;; - '-ai'|'--author_initials') - # Enter with author name - let i++ - AUTHOR_INITIALS=${ALL_PAR[$i]} - [ ${AUTHOR_INITIALS:0:1} = "-" ] && mkbuild_error $ERROR_INPUT_PAR AUTHOR_INITIALS - ;; - '-cs'|'--const_string') - # Enter with construction source name string - let i++ - CONST_STRING=${ALL_PAR[$i]} - [ ${CONST_STRING:0:1} = "-" ] && mkbuild_error $ERROR_INPUT_PAR CONST_STRING - ;; - '-md'|'--model') - # Enter with SlackBuild model - let i++ - MODEL=${ALL_PAR[$i]} - [ ${MODEL:0:1} = "-" ] && mkbuild_error $ERROR_INPUT_PAR MODEL - ;; - '-j'|'--jobs') - # Enter with SlackBuild model - let i++ - NUMJOBS=${ALL_PAR[$i]} - [ ${NUMJOBS:0:1} = "-" ] && mkbuild_error $ERROR_INPUT_PAR NUMJOBS - [ ! is_number $NUMJOBS ] && mkbuild_error $ERROR_INPUT_PAR NUMJOBS - NUMJOBS="-j$NUMJOBS" - ;; - '--prefix') - # Enter with SlackBuild model - let i++ - PREFIX=${ALL_PAR[$i]} - [ ${PREFIX:0:1} = "-" ] && mkbuild_error $ERROR_INPUT_PAR PREFIX - ;; - '-pn'|'--pkg_name') - # Enter with package name - let i++ - PKG_NAME=${ALL_PAR[$i]} - [ ${PKG_NAME:0:1} = "-" ] && mkbuild_error $ERROR_INPUT_PAR PKG_NAME - ;; - '-pv'|'pkg_version') - # Enter with package version - let i++ - VERSION=${ALL_PAR[$i]} - [ ${VERSION:0:1} = "-" ] && mkbuild_error $ERROR_INPUT_PAR VERSION - ;; - '-sn'|'--src_name') - # Enter with source name - let i++ - SRC_NAME=${ALL_PAR[$i]} - [ ${SRC_NAME:0:1} = '-' ] && mkbuild_error $ERROR_INPUT_PAR SRC_NAME - ;; - '-u'|'--url') - # Enter with url address - let i++ - URL=${ALL_PAR[$i]} - [ ${URL:0:1} = '-' ] && mkbuild_error $ERROR_INPUT_PAR URL - ;; - *) - # mkbuild input file - MK_INPUT_FILE="${PAR//.mkbuild}.mkbuild" - [ ! -e $MK_INPUT_FILE ] && mkbuild_error $ERROR_FILE_NOT_FOUND $MK_INPUT_FILE - ;; - esac - let i++ - done -} - -function get_variable { - - # Get variable value from mkbuild file (MK_INPUT_FILE) - [ $# -ne 1 ] && mkbuild_error $ERROR_PROGRAM - [ -z $MK_INPUT_FILE ] && echo "Warning: no [mkbuild_file]." && return 0 - - grep "^\[\[${1}\]\]" $MK_INPUT_FILE | cut -f2- -d= | tr -d '\"' -} - -function edit_file { - - # Edit file $3, by change string [[$1]] to $2 - local STR_OLD - local STR_NEW - - [ $# -ne 3 ] && mkbuild_error $ERROR_PROGRAM - STR_OLD=$( echo $1 | sed 's/\//\\\//g' ) - STR_NEW=$( echo $2 | sed 's/\//\\\//g' ) - eval "sed 's/\[\[$STR_OLD\]\]/$STR_NEW/' $3 > $AUX_TMP" - mv $AUX_TMP $3 -} - -function edit_file_full { - - # Edit file $3, by change string $1 to $2 - local STR_OLD - local STR_NEW - - [ $# -ne 3 ] && mkbuild_error $ERROR_PROGRAM - STR_OLD=$( echo $1 | sed 's/\//\\\//g' ) - STR_NEW=$( echo $2 | sed 's/\//\\\//g' ) - eval "sed 's/$STR_OLD/$STR_NEW/' $3 > $AUX_TMP" - mv $AUX_TMP $3 -} - -function start_build { - - # Build initial sections - [ $# -ne 1 ] && mkbuild_error $ERROR_PROGRAM - - edit_file "SLACKBUILD AUTHOR" "$AUTHOR" $1 - edit_file "SLACKBUILD AUTHOR INITIALS" $AUTHOR_INITIALS $1 - edit_file "SOURCE NAME" "$SRC_NAME" $1 - edit_file "PROGRAM NAME" "$PKG_NAME" $1 - edit_file "PACKAGE NAME" "$PKG_NAME" $1 - edit_file "DECOMPRESSOR" "$DECOMPRESSOR" $1 - edit_file "DECOMPRESSOR TEST FLAG" "$DECOMPRESSOR_TEST_FLAG" $1 - edit_file "PROGRAM URL" "$URL" $1 - edit_file "ARCH" "$ARCH" $1 - [ `is_number $NUMJOBS` ] && NUMJOBS="-j${NUMJOBS}" - edit_file "NUMBER OF JOBS" "$NUMJOBS" $1 - edit_file "VERSION" $VERSION $1 - edit_file "SOURCE NAME CONSTRUCTION STRING" "$CONST_STRING" $1 - edit_file "EXTENSION" "$EXTENSION" $1 - edit_file "DOWNLOAD FOLDER URL" "$URL_BASE" $1 - edit_file "OTHER CONFIGURE ARGS" "$OPTIONS" $1 - edit_file "DOCUMENTATION FILES" "$DOCFILES" $1 - edit_file "PREFIX" "$PREFIX" $1 - - edit_file_full "\$EXTENSION" "$EXTENSION" $1 -} - -function clear_files { - - # Remove temporary files - rm $AUX_TMP 2>/dev/null - rm $SLACKBUILD_TEMP 2>/dev/null - chmod 755 *.SlackBuild -} - -function set_status { - - # Set status section - # $1 - Section - # $2 - Status - # $3 - file - [ $# -ne 3 ] && mkbuild_error $ERROR_PROGRAM - if [ "`get_status $1 $3`" != "all" ]; then - eval "sed 's/^<$1>.*$/<$1> $2/' $3" > $AUX_TMP - mv $AUX_TMP $3 - else - echo "Warning: Section $1 have status all. Can't change!" - fi -} - -function get_status { - - # Get status from section - # $1 - Section - # $2 - file - [ $# -ne 2 ] && mkbuild_error $ERROR_PROGRAM - eval "sed '/^<$1>.*$/! d' $2" -} - -function activate_sections { - - # Enable and desable sections - ACTIONS_LIST=`sed '/^#>>/,/< off/, /^<\/[a-z].*>$/ d' $SLACKBUILD_TEMP > $AUX_TMP - # Remove sections names - sed '/^<.*$/ d' $AUX_TMP > $SLACKBUILD_TEMP - # Remove clear lines - sed ':i ; $! N; s/\n// ; t i' $SLACKBUILD_TEMP | sed 's///g' | sed 's///g' | sed 's//\n/g' > $AUX_TMP - sed '1,/^#\!/ {/^#\!/ b; d }' $AUX_TMP > $SLACKBUILD -} - -function section_edit { - - # Edits a section substituting its content - [ -z $MK_INPUT_FILE ] && return 0 - - SECTION_LIST=`grep '^#>[a-z]' $MK_INPUT_FILE | cut -c3-` - - # Check for sections change - [ -z "$SECTION_LIST" ] && return 0 - - # Change sections - for i in $SECTION_LIST; do - if [ "$i" = "slackdesc" ]; then - # Special slackdesc section - slackdesc_edit > $AUX_TMP - mv $AUX_TMP $SLACKBUILD_TEMP - else - # Others sections - section_change $i - fi - done -} - -function slackdesc_edit { - - # Edit slackdesc section - sed -n '1,/|-----/ { // b; /|-----/ b; p; }' $SLACKBUILD_TEMP - echo -n $PKG_NAME | tr [a-z+\-] " " - echo -n "|-----handy-ruler" - let N=18+${#PKG_NAME} - for i in `seq $N $SLACKDESC_LEN`; do - echo -n "-" - done - echo -en "|\n" - - sed -n '/#>slackdesc/,/#/! d' $SLACKBUILD_TEMP > $AUX_TMP" - # Paste new section - eval "sed -n '/#>$1/,/#<$1/ { /^#>/ b; /^#> $AUX_TMP" - # Copy second halt - eval "sed '/^<\/$1>/,$ ! d' $SLACKBUILD_TEMP >> $AUX_TMP" - - mv $AUX_TMP $SLACKBUILD_TEMP -} - -function make_slack_required { - - # Build slack-required file - [ -e slack-required ] && mv slack-required slack-required.old - [ -z "$SLACK_REQUIRED" ] && return 0 - - echo -e "# Dependency list to $SRC_NAME\n#\n# dependency [condition] [version]]" > slack-required - - echo $SLACK_REQUIRED | sed 's/:/\n/g' | while read i; do - REQ=`echo $i | awk '{ print $1 }'` - CON=`echo $i | awk '{ print $2 }'` - VER=`echo $i | awk '{ print $3 }'` - echo -e "$REQ\t\t$CON\t\t$VER" >> slack-required - done -} - -function change_others_parameters { - - # Change others parameters started by '[[' in .mkbuild file - grep '\[\[[A-Za-z]' $MK_INPUT_FILE | while read i; do - CHANGE="`echo $i | sed 's/\[\[\(.*\)\]\]=\"\(.*\)\"/\1/'`" - VALUE="`echo $i | sed 's/\[\[\(.*\)\]\]=\"\(.*\)\"/\2/'`" - edit_file "$CHANGE" "$VALUE" $SLACKBUILD - done -} - -function commit_slackbuild { - - # Commit SlackBuild in local Slack.Sarava tree - if [ $UID -ne 0 ]; then - echo "Only root can commit SlackBuilds..." - return 1 - fi - - # check SlackBuilds directory - [ ! -e $SLACKBUILDS_DIR ] && createpkg --sync - - # Get SlackBuild path - # Get SlackBuild path in parameter file - SLACKBUILD_PATH=`validate_parameter "$SLACKBUILD_PATH" "SLACKBUILD PATH" ""` - # Get SlackBuild path in slackbuild local tree - if [ $? -ne 0 ]; then - SLACKBUILD_PATH=`find $SLACKBUILDS_DIR -name $SLACKBUILD | xargs dirname` - fi - # Get SlackBuild path in gentoo-portage tree - if [ "$SLACKBUILD_PATH" == "" ]; then - # Mount SlackBuild path - [ $VERBOSE -eq $on ] && echo -e "\nFind SlackBuild PATH in Slack.Sarava tree..." - AUX=`lynx -connect_timeout=10 -dump http://gentoo-portage.com/Search?search=$PKG_NAME | sed -n '/Results:/,+1 { /Results:/ b ; p }' | head --lines=1 | tr -d " "` - [ ! -z $AUX ] && SLACKBUILD_PATH="`dirname $AUX | tr - /`/`basename $AUX`" || SLACKBUILD_PATH="others/unclassified/$PKG_NAME" - fi - - # change to SlackBuilds directory - cd $SLACKBUILDS_DIR/ - - # Add SlackBuild scripts - # check path - [ ! -e $SLACKBUILD_PATH ] && svn_mkdir $SLACKBUILD_PATH - # add SlackBuild - svn_add $SLACKBUILD $SLACKBUILD_PATH - - # check slack-required - # add slack-required - [ -e $WORK/slack-required ] && svn_add slack-required $SLACKBUILD_PATH - - cd $WORK -} - -function svn_mkdir { - - # svn make directory - [ $# -ne 1 ] && mkbuild_error 0 - - echo "svn_mkdir $1 $2" - DIR_LIST=`echo $1 | tr '/' ' '` - - DIR="" - for i in $DIR_LIST; do - DIR=$DIR/$i - [ ! -e ${DIR:1} ] && svn mkdir ${DIR:1} - done -} - -function svn_add { - - # svn add file - [ $# -ne 2 ] && mkbuild_error 0 - - # copy file - if [ -e $2/$1 ]; then - echo "$2/$1 exist. Overwriter it." - cp $WORK/$1 $2/ - else - cp $WORK/$1 $2/ - # add file to svn tree - svn add $2/$1 - fi -} - -function is_number { - - # Check if $1 is a number - local -i int - if [ $# -eq 0 ]; then - return 1 - else - (let int=$1) 2>/dev/null - return $? # Exit status of the let thread - fi -} - -function validate_parameter { - - # Validate parameter in .mkbuild file - if [ ! -z "$1" ]; then - echo "$1" - else - local STRING="`get_variable "$2"`" - if [ -z "$STRING" ]; then - [ ! -z "$3" ] && echo "$3" || return 1 - else - echo "$STRING" - fi - fi -} - -function decompress_find { - - # Find decompressor program and test flag - case $EXTENSION in - 'gz'|'GZ') - DECOMPRESSOR="gunzip" - DECOMPRESSOR_TEST_FLAG="-t"$NULL_STRING - ;; - 'bz2'|'BZ2') - DECOMPRESSOR="bunzip2" - DECOMPRESSOR_TEST_FLAG="-t" - ;; - 'zip'|'ZIP') - DECOMPRESSOR="unzip" - DECOMPRESSOR_TEST_FLAG="-t" - ;; - *) - mkbuild_error $ERROR_CONSTRUCTION "DECOMPRESSOR" - ;; - esac -} - -#============================= -# Main Program -#============================= -#----------------------------- -# Common functions -COMMON="/usr/libexec/simplepkg/common.sh" -SIMPLEPKG_CONF="/etc/simplepkg/simplepkg.conf" -WORK=`pwd` -LANG=en_US - -if [ -f "$COMMON" ]; then - source $COMMON -else - echo "error: file $COMMON found, check your $BASENAME installation" - mk_exit 0 -fi - -# Start constants -set_constants - -# Set commit off -COMMIT=$off -# Set verbose off -VERBOSE=$off -# Createpkg and mkbuild section -SLACKBUILDS_DIR="`eval_parameter SLACKBUILDS_DIR /var/slackbuilds`" -# Auxiliar file -AUX_TMP=/tmp/mkbuild_tmp.$RANDOM -# Derectory to SlackBuild models -MODEL_DIR=${MODEL_DIR:="/etc/simplepkg/defaults/mkbuild"} -# SlackDesk line length -SLACKDESC_LEN=78 - -# Load error codes -error_codes - -[ $# -eq 0 ] && mk_exit $NULL_STRING - -# Configure input parameters -set_parameters $@ - -[ $VERBOSE -eq $on ] && echo -e "$PROG_NAME version $PROG_VERSION\n" - -# Get values -# Author name -AUTHOR=${AUTHOR:="`get_variable "SLACKBUILD AUTHOR"`"} -[ -z "$AUTHOR" ] && mkbuild_error $ERROR_CONSTRUCTION "SLACKBUILD AUTHOR" -[ $VERBOSE -eq $on ] && echo "[[SLACKBUILD AUTHOR]]=\"$AUTHOR\"" - -# Author initials -STR_MOUNT=`echo $AUTHOR | sed 's/ /\n/g' | sed 's/^\([A-Z]\).*/\1/' | sed ':i; $!N; s/\n//; ti' | tr [A-Z] [a-z]` -AUTHOR_INITIALS="`validate_parameter "$AUTHOR_INITIALS" "SLACKBUILD AUTHOR INITIALS" "$STR_MOUNT"`" || mkbuild_error $ERROR_CONSTRUCTION "SLACKBUILD AUTHOR INITIALS" -[ $VERBOSE -eq $on ] && echo "[[SLACKBUILD AUTHOR INITIALS]]=\"$AUTHOR_INITIALS\"" - -# URL program -URL=`validate_parameter "$URL" "DOWNLOAD FOLDER URL" ""` || mkbuild_error $ERROR_CONSTRUCTION "URL" -[ $VERBOSE -eq $on ] && echo "[[URL]]=\"$URL\"" - -STR_MOUNT="`echo $URL | rev | cut -c1-3 | rev | tr -d '.'`" -if [ $STR_MOUNT = "gz" -o $STR_MOUNT = "tgz" -o $STR_MOUNT = "bz2" -o $STR_MOUNT = "zip" ]; then - SOURCE_NAME=`basename $URL` - URL_BASE=`dirname $URL` -else - URL_BASE=$URL -fi -[ $VERBOSE -eq $on ] && echo "[[DOWNLOAD FOLDER URL]]=\"$URL_BASE\"" - -# Extension -EXTENSION=`validate_parameter "$EXTENSION" "EXTENSION" "$STR_MOUNT"` || mkbuild_error $ERROR_CONSTRUCTION "EXTENSION" -[ $VERBOSE -eq $on ] && echo "[[EXTENSION]]=\"$EXTENSION\"" - -# Build archteture -ARCH=`validate_parameter "$ARCH" "ARCH" "i486"` -[ $VERBOSE -eq $on ] && echo "[[ARCH]]=\"$ARCH\"" - -# Source name -STR_MOUNT=`echo $SOURCE_NAME | sed -r 's/(.*)-(.*)\.(.*\..*)$/\1/'` -SRC_NAME=`validate_parameter "$SRC_NAME" "SOURCE NAME" "$STR_MOUNT"` || mkbuild_error $ERROR_CONSTRUCTION "SOURCE NAME" -[ $VERBOSE -eq $on ] && echo "[[SOURCE NAME]]=\"$SRC_NAME\"" - -# Package name -STR_MOUNT=`echo $SRC_NAME | tr [A-Z_] [a-z\-]` -PKG_NAME=`validate_parameter "$PKG_NAME" "PACKAGE NAME" "$STR_MOUNT"` -[ $VERBOSE -eq $on ] && echo "[[PACKAGE NAME]]=\"$PKG_NAME\"" - -# Version -STR_MOUNT=`echo $SOURCE_NAME | sed -r 's/(.*)-(.*)\.(.*\..*)$/\2/'` -VERSION=`validate_parameter "$VERSION" "VERSION" $STR_MOUNT` || mkbuild_error $ERROR_CONSTRUCTION "VERSION" -[ $VERBOSE -eq $on ] && echo "[[VERSION]]=\"$VERSION\"" - -# Construction source name string -CONST_STRING="`validate_parameter "$CONST_STRING" "SOURCE NAME CONSTRUCTION STRING" "\\\$SRC_NAME-\\\$VERSION.tar.$EXTENSION"`" -[ $VERBOSE -eq $on ] && echo "[[SOURCE NAME CONSTRUCTION STRING]]=\"$CONST_STRING\"" - -# Build Source Name -[ -z $SOURCE_NAME ] && SOURCE_NAME=`eval "echo $CONST_STRING"` -[ $VERBOSE -eq $on ] && echo "SOURCE_NAME=\"$SOURCE_NAME\"" - -# Decompressor program and test flag -DECOMPRESSOR=`validate_parameter "$DECOMPRESSOR" "DECOMPRESSOR" ""` || decompress_find -[ $VERBOSE -eq $on ] && echo "[[DECOMPRESSOR]]=\"$DECOMPRESSOR\"" - -DECOMPRESSOR_TEST_FLAG=`validate_parameter "$DECOMPRESSOR_TEST_FLAG" "DECOMPRESSOR TEST FLAG" ""` || mkbuild_error $ERROR_CONSTRUCTION "DECOMPRESSOR TEST FLAG" -[ $VERBOSE -eq $on ] && echo "[[DECOMPRESSOR TEST FLAG]]=\"$DECOMPRESSOR_TEST_FLAG\"" - -# Documentations list -DOCFILES=`validate_parameter "$DOCFILES" "DOCUMENTATION FILES" "NEWS TODO README AUTHORS INSTALL ChangeLog MAINTAINERS COPYING readme.*"` -[ $VERBOSE -eq $on ] && echo "[[DOCUMENTATION FILES]]=\"$DOCFILES\"" - -# ./configure option -OPTIONS=`validate_parameter "$OPTIONS" "OTHER CONFIGURE ARGS" ""` -[ $VERBOSE -eq $on ] && echo "[[OTHER CONFIGURE ARGS]]=\"$OPTIONS\"" - -# PREFIX -PREFIX=`validate_parameter "$PREFIX" "PREFIX" "/usr"` -[ $VERBOSE -eq $on ] && echo "[[PREFIX]]=\"$PREFIX\"" - -# Number of jobs -NUMJOBS=`validate_parameter "$NUMJOBS" "NUMBER OF JOBS" ""` -[ $VERBOSE -eq $on ] && echo "[[NUMBER OF JOBS]]=\"$NUMJOBS\"" - -# Make slack-required file. -SLACK_REQUIRED=`validate_parameter "$SLACK_REQUIRED" "SLACK REQUIRED" ""` -[ $VERBOSE -eq $on ] && echo "[[SLACK REQUIRED]]=\"$SLACK_REQUIRED\"" - -# SlackBuild model -MODEL=`validate_parameter "$MODEL" "SLACKBUILD MODEL" "generic.mkSlackBuild"` -[ $VERBOSE -eq $on ] && echo "[[SLACKBUILD MODEL]]=\"$MODEL\"" - -# -# Start build SlackBuild -SLACKBUILD=${PKG_NAME}.SlackBuild -SLACKBUILD_TEMP=$SLACKBUILD.tmp -cp $MODEL_DIR/$MODEL $SLACKBUILD_TEMP -[ $VERBOSE -eq $on ] && echo -en "\nStart SlackBuild make" - -# Change strings from model -start_build $SLACKBUILD_TEMP -[ $VERBOSE -eq $on ] && echo -en "\nEdit mkSlackBuild model .." - -# On/Off sections -activate_sections -[ $VERBOSE -eq $on ] && echo -en ".\nEnable and desable sections .." - -# Change sections -section_edit -[ $VERBOSE -eq $on ] && echo -en ".\nChange sections .." - -# Remove off sections -build_slackbuild -[ $VERBOSE -eq $on ] && echo -en ".\nRemove off sections .." - -# Make slack-required file -make_slack_required -[ $VERBOSE -eq $on ] && echo -en ".\nMake slack-required file .." - -if [ -e slack-required ]; then - DEPENDENCY_LIST="`cat slack-required | awk '{print $1}' | grep '^[a-z]' | tr '\012' ' '`" - edit_file "REQUIRES" "$DEPENDENCY_LIST" $SLACKBUILD -else - edit_file "REQUIRES" "Null" $SLACKBUILD -fi - -# Others changes -change_others_parameters -[ $VERBOSE -eq $on ] && echo -en ".\nEdit others [[]] parameters .." - -# Clear temporary files -clear_files -[ $VERBOSE -eq $on ] && echo -e ".\nRemove temporary files ..." - -[ $COMMIT -eq $on ] && commit_slackbuild diff --git a/branches/0.6/src/mkjail b/branches/0.6/src/mkjail deleted file mode 100755 index f6c935c..0000000 --- a/branches/0.6/src/mkjail +++ /dev/null @@ -1,113 +0,0 @@ -#!/bin/bash -# -# mkjail v0.4: chroot jail maker -# -# feedback: rhatto at riseup.net | GPL -# -# Mkjail is free software; you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation; either version 2 of the License, or any later version. -# -# Mkjail is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -# A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 59 Temple -# Place - Suite 330, Boston, MA 02111-1307, USA -# - -COMMON="/usr/libexec/simplepkg/common.sh" -BASENAME="`basename $0`" - -if [ -f "$COMMON" ]; then - source $COMMON -else - echo "error: file $COMMON found, check your `basename $0` installation" - exit 1 -fi - -function usage { - - echo "usage: [ARCH=arch] [VERSION=version] [ROOT=/otherroot] $BASENAME [template]" - exit 1 - -} - -function exec_post_install_scripts { - - # exec post installation scripts - # usage: exec_post_install_script - - local list - - if [ -z "$2" ]; then - return 1 - fi - - echo "$BASENAME: executing template scripts..." - if [ -d "$TEMPLATE_BASE.s" ]; then - for file in $TEMPLATE_BASE.s/*; do - if [ -x "$file" ]; then - $file $1 $2 - fi - done - fi - -} - -function jailist_update { - - # update the jail list file - # usage: jailist_update - - if [ "$ADD_TO_JAIL_LIST" == "1" ]; then - touch $JAIL_LIST - if ! grep -q -e "^$1\$" $JAIL_LIST; then - echo $1 >> $JAIL_LIST - fi - fi - -} - -if [ -z "$1" ]; then - usage -else - server="$1" - eval_config $BASENAME -u -fi - -if [ ! -z "$2" ]; then - search_template $2 - result="$?" -else - search_default_template - result="$?" -fi - -if [ "$result" != "0" ]; then - exit 1 -fi - -TEMPLATE="$TEMPLATE_BASE.template" - -if [ ! -d "$JAIL_ROOT/$server" ]; then - mkdir -p $JAIL_ROOT/$server -else - if [ ! -z "`ls $JAIL_ROOT/$server | grep -v 'lost+found'`" ]; then - echo $BASENAME: error: folder $JAIL_ROOT/$server already exists and seens to be not empty - echo $BASENAME: probably the jail $1 already exists - exit 1 - fi -fi - -echo "$BASENAME: instaling packages into $JAIL_ROOT/$server using $TEMPLATE..." - -install_packages -copy_template_files $JAIL_ROOT/$server -set_jail_perms $JAIL_ROOT/$server -jailist_update $JAIL_ROOT/$server -exec_post_install_scripts $JAIL_ROOT $server - -echo $BASENAME: done creating $server jail - diff --git a/branches/0.6/src/rebuildpkg b/branches/0.6/src/rebuildpkg deleted file mode 100755 index 6d3d10c..0000000 --- a/branches/0.6/src/rebuildpkg +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash -# -# rebuildpkg: build a package from a /var/log/packages entry -# -# feedback: rhatto at riseup.net | gpl -# -# Rebuildpkg is free software; you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation; either version 2 of the License, or any later version. -# -# Rebuildpkg is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -# A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 59 Temple -# Place - Suite 330, Boston, MA 02111-1307, USA -# - -COMMON="/usr/libexec/simplepkg/common.sh" -TMP="/tmp" - -function usage { - echo "usage: ROOT=/otherroot `basename $0` " -} - -if [ -f "$COMMON" ]; then - source $COMMON -else - echo "error: file $COMMON found, check your `basename $0` installation" - exit 1 -fi - -if [ -z "$1" ]; then - usage - exit 1 -fi - -pack="$1" - -for file in `ls $ROOT/var/log/packages/$pack*`; do - if [[ "`package_name $file.tgz`" == "$pack" ]]; then - package_file="$file" - break - fi -done - -if [ -z "$package_file" ]; then - echo error: package $pack does not exist - exit 1 -fi - -if [ -d "$TMP/package-$pack" ]; then - rm -rf $TMP/package-$pack -fi - -mkdir $TMP/package-$pack -cd $TMP/package-$pack - -for file in `grep -v -e "^PACKAGE NAME:" -e "^UNCOMPRESSED PACKAGE SIZE:" \ - -e "^COMPRESSED PACKAGE SIZE:" -e "^PACKAGE LOCATION:" \ - -e "^PACKAGE DESCRIPTION:" -e "^$pack:" -e "^FILE LIST:" $package_file`; do - - if [ "$file" != "install" ] && [ "$file" != "install/slack-desc" ] && [ "$file" != "install/doinst,sh" ]; then - if [ -d /$file ]; then - mkdir -p $TMP/package-$pack/$file - elif [ -f /$file ]; then - cp /$file $TMP/package-$pack/$file - else - echo file /$file was not found, please add it manually, exploding and making the package again - fi - fi - -done - -mkdir $TMP/package-$pack/install -grep "^$pack:" $package_file > $TMP/package-$pack/install/slack-desc - -package_name="`grep "PACKAGE NAME:" $package_file | awk '{ print $3 }'`" - -if [ -f "$ROOT/var/log/scripts/$package_name" ]; then - cp $ROOT/var/log/scripts/$package_name $TMP/package-$pack/install/doinst.sh -fi - -makepkg $package_name.tgz -mv $package_name.tgz $TMP/ -echo "done: package rebuilt and stored at $TMP/$package_name.tgz" diff --git a/branches/0.6/src/repos b/branches/0.6/src/repos deleted file mode 100755 index e4a17ee..0000000 --- a/branches/0.6/src/repos +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash -# -# repos script got from -# http://software.jaos.org/BUILD/slapt-get/FAQ.html#slgFAQ17 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# any later version. -# -# Changes by rhatto at riseup.net to fit http://slack.sarava.org needs -# - -BASENAME="`basename $0`" -REPOS_CONF="/etc/simplepkg/repos.conf" -COMMON="/usr/libexec/simplepkg/common.sh" - -if [ -f "$COMMON" ]; then - source $COMMON -else - echo "error: file $COMMON found, check your $BASENAME installation" - exit 1 -fi - -function usage { - - echo "`basename $0` [pkg [file]|all|new|svnmeta|PACKAGESTXT|FILELIST|MD5]" - -} - -function do_all { - - for pkg in `find . -type f -name '*.tgz' -print`; do - gen_meta $pkg - done - $0 PACKAGESTXT - $0 FILELIST - $0 MD5 - -} - -# --------------------------------- -# main -# --------------------------------- - -case "$1" in - pkg) - if [ -n "$2" ]; then - gen_meta $2 - else - usage - fi - ;; - all) - do_all - ;; - new) - for pkg in `find . -type f -name '*.tgz' -print`; do - if [ ! -f ${pkg%tgz}meta ]; then - gen_meta $pkg - fi - done - ;; - svnmeta) - svn_add_meta - ;; - PACKAGESTXT) - gen_packages_txt . - gen_packages_txt patches - ;; - FILELIST) - gen_filelist - gen_patches_filelist patches - ;; - MD5) - gen_md5_checksums . - gen_md5_checksums patches - ;; - usage) - usage - ;; - *) - do_all - svn_add_meta - ;; -esac - diff --git a/branches/0.6/src/simplaret b/branches/0.6/src/simplaret deleted file mode 100755 index 00b0c25..0000000 --- a/branches/0.6/src/simplaret +++ /dev/null @@ -1,1045 +0,0 @@ -#!/bin/bash -# -# simplaret v0.2: simplepkg's retrieval tool -# feedback: rhatto at riseup.net | gpl -# -# Simplaret is free software; you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation; either version 2 of the License, or any later version. -# -# Simplaret is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -# A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 59 Temple -# Place - Suite 330, Boston, MA 02111-1307, USA -# - -BASENAME="`basename $0`" -REPOS_CONF="/etc/simplepkg/repos.conf" -COMMON="/usr/libexec/simplepkg/common.sh" - -if [ -f "$COMMON" ]; then - source $COMMON -else - echo "error: file $COMMON found, check your $BASENAME installation" - exit 1 -fi - -function simplaret_usage { - - echo "usage: [ARCH=otherarch] [VERSION=otherversion] $BASENAME