From f9a8dfcd51e481a49355d94a3e74f2762519378f Mon Sep 17 00:00:00 2001 From: rhatto Date: Sun, 11 Feb 2007 14:29:54 +0000 Subject: changed repository layout to trunk/, tags/ and branches/ scheme git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@181 04377dda-e619-0410-9926-eae83683ac58 --- src/createpkg | 480 --------------------------- src/jail-commit | 93 ------ src/lspkg | 88 ----- src/metapkg | 60 ---- src/mkjail | 150 --------- src/rebuildpkg | 87 ----- src/repos | 135 -------- src/simplaret | 997 -------------------------------------------------------- src/templatepkg | 220 ------------- 9 files changed, 2310 deletions(-) delete mode 100644 src/createpkg delete mode 100755 src/jail-commit delete mode 100755 src/lspkg delete mode 100755 src/metapkg delete mode 100755 src/mkjail delete mode 100755 src/rebuildpkg delete mode 100755 src/repos delete mode 100755 src/simplaret delete mode 100755 src/templatepkg (limited to 'src') diff --git a/src/createpkg b/src/createpkg deleted file mode 100644 index 5ab979f..0000000 --- a/src/createpkg +++ /dev/null @@ -1,480 +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="/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 -#--------------------------------------------------- - -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) echo -e "$CL_ALERT $BASENAME: could not update the repository $2 $CL_OFF" ;; - 4) echo -e "$CL_ALERT $BASENAME: could not create folder $2 $CL_OFF" ;; - 5) echo -e "$CL_ALERT $BASENAME: script not found for $2 $CL_OFF" ;; - $ERROR_WGET) - echo -e "$CL_ERROR $BASENAME: error downloading source/package for $2 $CL_OFF" ;; - $ERROR_MAKE) - echo -e "$CL_ERROR $BASENAME: error compiling $2 source code $CL_OFF" ;; - $ERROR_INSTALL) - echo -e "$CL_ERROR $BASENAME: error installing $2 $CL_OFF" ;; - $ERROR_MD5) - echo -e "$CL_ERROR $BASENAME: error on source code integrity check for $2 $CL_OFF" ;; - $ERROR_CONF) - echo -e "$CL_ERROR $BASENAME: error configuring the source code for $2 $CL_OFF" ;; - $ERROR_HELP) - exit 0 ;; # its supposed to never happen here :P - $ERROR_TAR) - echo -e "$CL_ERROR $BASENAME: error decompressing source code for $2 $CL_OFF" ;; - $ERROR_MKPKG) - echo -e "$CL_ERROR $BASENAME: error creating package $2 $CL_OFF" ;; - $ERROR_GPG) - echo -e "$CL_ERROR $BASENAME: error verifying GPG signature the source code for $2 $CL_OFF" ;; - $ERROR_PATCH) - echo -e "$CL_ERROR $BASENAME: error patching the source code for $2 $CL_OFF" ;; - $ERROR_VCS) - echo -e "$CL_ERROR $BASENAME: error downloading $2 source from version control system $CL_OFF" ;; - $ERROR_MKDIR) - echo -e "$CL_ERROR $BASENAME: make directory $2 error, aborting $CL_OFF" ;; - $ERROR_INSTPKG) - echo -e "$CL_ERROR $BASENAME: install package $2 error, aborting $CL_OFF" ;; - $ERROR_DEPEN) - echo -e "$CL_ERROR $BASENAME: dependency solve error, aborting $CL_OFF" ;; - *) echo -e "$CL_ERROR $BASENAME: unknown error or user interrupt $CL_OFF" ;; - $SCRIPT_OR_PACKAGE_NOT_FOUND) - echo -e "$CL_ERROR $BASENAME: SlackBuild or package not found $CL_OFF" ;; - esac - - exit $1 - -} - -function build_repo { - - # Checkout a new slackbuild working copy - BASEDIR="`dirname $SLACKBUILDS`" - mkdir -p $BASEDIR || handle_error 4 $BASEDIR - cd $BASEDIR - svn checkout $SVN - cd $SLACKBUILDS - -} - -function usage { - - # Help mensage - echo -e "$CL_COMMU Usage: createpkg [--install/-i] package-name $CL_OFF" - echo -e "$CL_COMMU createpkg --no-deps/-np package-name $CL_OFF" - echo -e "$CL_COMMU createpkg --search/-s package-name $CL_OFF" - echo -e "$CL_COMMU createpkg --info/-f package-name $CL_OFF" - echo -e "$CL_COMMU createpkg --list/-l $CL_OFF" - echo -e "$CL_COMMU createpkg --sync $CL_OFF" - echo -e "$CL_COMMU createpkg --help/-h $CL_OFF" - -} - -function check_config { - - # check the configuration - TMP=${TMP:=/tmp}; - REPOS=${REPOS:=$TMP}; - # Create $TMP and $REPOS if need - [ ! -e $TPM ] && mkdir $TMP - [ ! -e $REPOS ] && mkdir $REPOS - # - SLACKBUILDS=${SLACKBUILDS:=/var/slackbuilds} - SVN=${SVN:=svn://slack.sarava.org/slackbuilds} - SYNC=${SYNC:=no} - BASEDIR="`dirname $SLACKBUILDS`" - -} - -function solve_dep { - # Solve dependency - local PACK="$1" - local COND="$2" - local VER="$3" - - # Check package in local system - INSTALLED=`eval "ls /var/log/packages/ | egrep '^$PACK-[^-]+-[^-]+-[^-]+$'"` - CHECK=$? - - # TODO: Make check version procedures - if [ -z "$INSTALLED" ]; then - if [ $CHECK -ne 0 ]; then - # Check package in SlackBuilds tree - echo -e "$CL_MENSG $BASENAME: processing $PACKAGE dependency $PACK $CL_OFF" - 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=$DEFAULT_ARCH simplaret --update - ARCH=$DEFAULT_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" ] && build_repo - -} - -function sync_repo { - - # Synchronize repository - cd $SLACKBUILDS - svn update || build_repo - #simplaret --update - -} - -function find_slackbuild { - - # Find SlackBuild script in the repository - find $SLACKBUILDS -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]` - echo -e "$CL_COMMU $NAME_UP: $CL_OFF" - - PKG_DIR=`dirname $i` - if [ -e $PKG_DIR/slack-desc ]; then - eval "cat $PKG_DIR/slack-desc | grep '^$PACKAGE:' | cut -f2- -d:" - echo -e "$CL_OFF" - else - eval "cat $i | grep '^$PACKAGE:' | cut -f2- -d:" - echo -e "$CL_OFF" - fi - - if [ -e $PKG_DIR/slack-required ]; then - echo -e "$CL_COMMU slack-required $CL_OFF" - cat $PKG_DIR/slack-required | sed 's/^/ /' - fi - done - fi - -} - -function list_builds { - - # List all available SlackBuilds - cd $SLACKBUILDS - 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 - echo -e "$CL_COMMU $j $CL_OFF" - ( - cd $j - BUILD="`ls *.SlackBuild 2>/dev/null`" - if [ "$BUILD" != "" ]; then - # level 3 - for k in $BUILD; do - echo -e "$CL_MENSG $k $CL_OFF" - done - else - BUILD="" - fi - for k in *; do - if [ -d $k ]; then - echo -e "$CL_MENSG $k.SlackBuild $CL_OFF" - fi - done - ) - fi - done - ) - fi - done -} - -function color_select { - # Select color mode: gray, color or none (*) - # CL_COMMU - Communication - # CL_MENSG - Commum messages - # CL_ERROR - Error messages - # CL_OFF - turn off color - case "$1" in - 'gray') - CL_COMMU="\033[37;1m" - CL_MENSG="\033[37;1m" - CL_ERROR="\033[30;1m" - CL_ALERT="\033[37m" - CL_OFF="\033[m" - ;; - 'color') - CL_COMMU="\033[34;1m" # green - CL_MENSG="\033[32;1m" # blue - CL_ERROR="\033[31;1m" # red - CL_ALERT="\033[33;1m" # yellow - CL_OFF="\033[m" # normal - ;; - *) - CL_COMMU="" - CL_MENSG="" - CL_ERROR="" - CL_ALERT="" - CL_OFF="" - ;; - esac -} - -#--------------------------------------------------- -# Starting createpkg -#--------------------------------------------------- -# Common functions -COMMON="/usr/libexec/simplepkg/common.sh" -SIMPLEPKG_CONF="/etc/simplepkg/simplepkg.conf" - -# Loading error codes -error_codes - -# First load simplepkg helper functions -source $COMMON && source $SIMPLEPKG_CONF -if [ $? -ne 0 ]; then - echo -e "$CL_ERROR error: file $COMMON not found, check your $BASENAME installation $CL_OFF" - exit 1 -fi - -# 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 - -# 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 - -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="1" - ;; - '--no-deps'|'-nd') - [ $# -ne 2 ] && handle_error 2 # two parameters is required - NO_DEPS="1" - 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" == "yes" ] && sync_repo - -# Get SlackBuild script -BUILD_SCRIPT="`find_slackbuild $PACKAGE`" - -# 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 - echo -e "$CL_ERROR error: None package select $CL_OFF" - 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/'` -fi - -# Check SlackBuild script found -[ -z "$BUILD_SCRIPT" ] && handle_error 5 $PACKAGE - -# Get dirname and script name from slackbuild -SCRIPT_BASE="`dirname $BUILD_SCRIPT`" -SCRIPT_NAME="`basename $BUILD_SCRIPT`" -echo -e "$CL_MENSG $BASENAME: found script $PACKAGE.SlackBuild, now checking for dependencies $CL_OFF" - -# 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" != "1" ]; then - # this routine checks for dependencies in package's slack-required - ( cat $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 - echo -e "$CL_MENSG $BASENAME: dependency solve error $CL_OFF" - exit 1 - fi - echo -e "$CL_MENSG $BASENAME: done checking for $PACKAGE dependencies $CL_OFF" -else - echo -e "$CL_MENSG $BASENAME: no unmet dependencies for $PACKAGE $CL_OFF" -fi - -echo -e "$CL_MENSG $BASENAME: processing $SCRIPT_NAME $CL_OFF" - -# Built package -cd $SCRIPT_BASE -# Execute SlackBuild script with variables protection -( INTERACT=no ./$SCRIPT_NAME ) - -# Check if package was built -handle_error $? $PACKAGE - -PKG_TGZ="`ls -1 -c $REPOS/$PACKAGE-*-*-*tgz | head -n 1`" - -#mkdir -p $REPOS${SCRIPT_BASE/$SLACKBUILDS} -#mv $PKG_TGZ $REPOS${SCRIPT_BASE/$SLACKBUILDS}/ - -if [ "$INSTALL" == "1" ]; then - # as we dont have the full package file name, we'll - # use the newer file name that matches our wildcard: - - upgradepkg --install-new $PKG_TGZ -fi diff --git a/src/jail-commit b/src/jail-commit deleted file mode 100755 index 8de547c..0000000 --- a/src/jail-commit +++ /dev/null @@ -1,93 +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" - -if [ -f "$COMMON" ]; then - source $COMMON -else - echo "error: file $COMMON found, check your `basename $0` installation" - exit 1 -fi - -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 - - rm -f $TEMPLATE_BASE.perms - touch $TEMPLATE_BASE.perms - cd $TEMPLATE_BASE.d - - for file in `find`; do - if [[ -f "$file" && -f "$1/$file" ]]; then - if ! diff $file $1/$file; then - echo updating $file - cp -af $1/$file $file - fi - perms="`numeric_perm $1/$file`" - owner="`get_owner $1/$file`" - group="`get_group $1/$file`" - echo "$file;$owner;$group;$perms" >> $TEMPLATE_BASE.perms - fi - done - -} - -function template_svn_commit { - - if [ "$TEMPLATES_UNDER_SVN" == "1" ] && \ - [ "$TEMPLATE_STORAGE_STYLE" == "own-folder" ]; then - cd `basedir $TEMPLATE_BASE` - svn commit -m "changes for `date`" - fi - -} - -if [ -f $JAIL_LIST ]; then - for jailpath in `cat $JAIL_LIST`; do - jail="`basename $jailpath`" - search_template $jail --update - if [ "$?" == "0" ]; then - echo updating $jailpath... - if [ -d "$TEMPLATE_BASE.d" ] || [ -a "$TEMPLATE_BASE.template" ]; then - templatepkg -u $jail $jailpath - template_merge $jailpath - template_svn_commit $TEMPLATE_BASE - fi - fi - done -fi - -# main jail -search_template main --update -if [ "$?" == "0" ]; then - if [ -a "$TEMPLATE_BASE.template" ] || [ -a "$TEMPLATE_BASE.template" ]; then - echo updating main installation... - templatepkg -u main - template_merge / - template_svn_commit $TEMPLATE_BASE - fi -fi - diff --git a/src/lspkg b/src/lspkg deleted file mode 100755 index e3add47..0000000 --- a/src/lspkg +++ /dev/null @@ -1,88 +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 found, check your `basename $0` installation" - exit 1 -fi - -function usage { - echo "usage: `basename $0` [option expression]" -} - -if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then - usage - 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 -" -elif [ "$1" == "-v" ] || [ "$1" == "--view" ] ; then - if [ ! -z "$2" ]; then - if $(ls /var/log/packages/$2* &> /dev/null); then - for file in $(ls /var/log/packages/$2*); do - less $file - done - else echo $2: package not found on /var/log/packages - fi - else - usage - exit 1 - fi -elif [ "$1" == "-p" ] && [ "$1" == "--print" ]; then - if [ -f "$2" ]; then - tar ztvf $2 - else echo $2: file not found - fi -elif [ "$1" == "-r" ] && [ "$1" == "--remove" ]; then - if [ ! -z "$2" ]; then - if `ls /var/log/packages/$1* &> /dev/null`; then - removepkg /var/log/packages/$1* - fi - fi -elif [ "$1" == "-s" ] || [ "$1" == "--search" ]; then - if [ ! -z "$2" ]; then - grep $2 /var/log/packages/* - fi -elif [ "$1" == "-d" ] || [ "$1" == "--description" ]; then - if [ ! -z "$1" ]; then - for file in `lspkg $2`; do - name="`package_name $file.tgz`" - echo "package description for $name:" - echo "" - grep -e "^$name:" $file | sed -e "s/^$name:/ /" - done - else - usage - exit 1 - fi -else - if `ls /var/log/packages/$1* &> /dev/null`; then - ls /var/log/packages/$1* - else echo $1: package not found on /var/log/packages - fi -fi diff --git a/src/metapkg b/src/metapkg deleted file mode 100755 index e83ee4d..0000000 --- a/src/metapkg +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -# -# metapkg v0.1: install or remove a pkgtool metapackage -# -# feedback: rhatto at riseup.net | GPL -# -# Metapkg 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. -# -# Metapkg 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 -# -# A metapackage is a file containing a list of packages. -# This script just installs all the packages in a metapackage. -# Remeber that mkjail template == metapkg metapackage. -# - -COMMON="/usr/libexec/simplepkg/common.sh" -ROOT="/" - -function usage { - echo "usage: [ROOT=/otherroot] `basename $0` --option [metapackage]" - echo "options: --install, --remove" - exit 1 -} - -if [ -f "$COMMON" ]; then - source $COMMON -else - echo "error: file $COMMON found, check your `basename $0` installation" - exit 1 -fi - -if [ -z "$2" ]; then - usage -else - eval_config `basename $0` -u -fi - -if [ ! -f "$BASE_CONF/$2.template" ]; then - echo error: template $2 not found - exit 1 -else - TEMPLATE="$BASE_CONF/$2.template" - unset server -fi - -if [[ "$1" == "--install" ]]; then - install_packages -elif [[ "$1" == "--remove" ]]; then - remove_packages -else - usage -fi diff --git a/src/mkjail b/src/mkjail deleted file mode 100755 index 3be3efb..0000000 --- a/src/mkjail +++ /dev/null @@ -1,150 +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 copy_template_files { - - # copy template files into jail - # usage: copy_template_files - - if [ -d "$1" ]; then - echo "$BASENAME: copying template files..." - if [ -d "$TEMPLATE_BASE.d" ]; then - if [ "$TEMPLATES_UNDER_SVN" == "1" ]; then - rsync -av --exclude=.svn $TEMPLATE_BASE.d/ $JAIL_ROOT/$server/ - else - rsync -av $TEMPLATE_BASE.d/ $JAIL_ROOT/$server/ - fi - fi - fi - -} - -function set_jail_perms { - - # set template file permissions under a jail - # usage: set_jail_perms - - if [ -s "$TEMPLATE_BASE.perms" ]; then - cat $TEMPLATE_BASE.perms | while read entry; do - file="`echo $entry | cut -d ";" -f 1`" - if [ -a "$TEMPLATE_BASE.d/$file" ] && [ -a "$1/$file" ]; then - owner="`echo entry | cut -d ";" -f 2`" - group="`echo entry | cut -d ";" -f 3`" - perms="`echo entry | cut -d ";" -f 4`" - chmod $perms $1/$file - chown $owner:$group $1/$file - fi - done - fi - -} - -function exec_post_install_scripts { - - # exec post installation scripts - # usage: exec_post_install_script - - if [ -z "$2" ]; then - return 1 - fi - - echo "$BASENAME: executing template scripts..." - if [ -d "$TEMPLATE_BASE.s" ]; then - for script in `ls $TEMPLATE_BASE.s/`; do - if [ -x "$TEMPLATE_BASE.s/$script" ]; then - exec $TEMPLATE_BASE.s/$script $1 $2 - fi - done - fi - -} - -function jailist_update { - - # update the jail list file - # usage: jailist_update - - if [ -f "$JAIL_LIST" ]; then - if ! grep -q "^$1" $JAIL_LIST; then - echo $1 >> $JAIL_LIST - fi - else - echo $1 > $JAIL_LIST - fi - -} - -if [ -z "$1" ]; then - usage -else - server="$1" - eval_config $BASENAME -u -fi - -if [ ! -z "$2" ]; then - search_template $2 - result="$?" -else - result="$?" - search_default_template -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 -exec_post_install_scripts $JAIL_ROOT $server -jailist_update $JAIL_ROOT/$server - -echo $BASENAME: done creating $server jail - diff --git a/src/rebuildpkg b/src/rebuildpkg deleted file mode 100755 index 6d3d10c..0000000 --- a/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/src/repos b/src/repos deleted file mode 100755 index 465714b..0000000 --- a/src/repos +++ /dev/null @@ -1,135 +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 -# - -function svn_add_meta { - find *meta -exec svn add {} 2> /dev/null \; - find . -name *meta -exec svn add {} 2> /dev/null \; -} - -function gen_filelist { - for file in `find | grep -e ".tgz$"`; do ls -l $file; done > FILELIST.TXT - echo "Created new FILELIST.TXT" - if [ -d "patches" ]; then - for file in `find patches | grep -e ".tgz$"`; do ls -l $file; done > patches/FILE_LIST - echo "Created new patches/FILE_LIST" - fi -} - -function gen_packages_txt { - echo '' > PACKAGES.TXT - find . -type f -name '*.meta' -exec cat {} \; >> PACKAGES.TXT - cat PACKAGES.TXT | gzip -9 -c - > PACKAGES.TXT.gz - echo "Created new PACKAGES.TXT and PACKAGES.TXT.gz" - if [ -d "patches" ]; then - find patches -type f -name '*.meta' -exec cat {} \; >> patches/PACKAGES.TXT - cat patches/PACKAGES.TXT | gzip -9 -c - > patches/PACKAGES.TXT.gz - echo "Created new patches/PACKAGES.TXT and patches/PACKAGES.TXT.gz" - fi -} - -function gen_md5_checksums { - echo '' > CHECKSUMS.md5 - find . -type f -name '*.tgz' -exec md5sum {} \; >> CHECKSUMS.md5 - cat CHECKSUMS.md5 | gzip -9 -c - > CHECKSUMS.md5.gz - echo "Created new CHECKSUMS.md5 and CHECKSUMS.md5.gz" - if [ -d "patches" ]; then - find patches -type f -name '*.tgz' -exec md5sum {} \; >> patches/CHECKSUMS.md5 - cat patches/CHECKSUMS.md5 | gzip -9 -c - > patches/CHECKSUMS.md5.gz - echo "Created new patches/CHECKSUMS.md5 and patches/CHECKSUMS.md5.gz" - fi -} - -function gen_meta { - if [ ! -f $1 ]; then - echo "File not found: $1" - exit 1; - else - echo "Processing $1" - fi - if [ "`echo $1|grep -E '(.*{1,})\-(.*[\.\-].*[\.\-].*).tgz[ ]{0,}$'`" == "" ]; then - return; - fi - NAME=$(echo $1|sed -re "s/(.*\/)(.*.tgz)$/\2/") - LOCATION=$(echo $1|sed -re "s/(.*)\/(.*.tgz)$/\1/") - SIZE=$( expr `gunzip -l $1 | tail -n 1|awk '{print $1}'` / 1024 ) - USIZE=$( expr `gunzip -l $1 | tail -n 1|awk '{print $2}'` / 1024 ) - REQUIRED=$(tar xzfO $1 install/slack-required 2>/dev/null|xargs -r -iZ echo -n "Z,"|sed -e "s/,$//") - CONFLICTS=$(tar xzfO $1 install/slack-conflicts 2>/dev/null|xargs -r -iZ echo -n "Z,"|sed -e "s/,$//") - SUGGESTS=$(tar xzfO $1 install/slack-suggests 2>/dev/null|xargs -r ) - METAFILE=${NAME%tgz}meta - echo "PACKAGE NAME: $NAME" > $LOCATION/$METAFILE - if [ -n "$DL_URL" ]; then - echo "PACKAGE MIRROR: $DL_URL" >> $LOCATION/$METAFILE - fi - echo "PACKAGE LOCATION: $LOCATION" >> $LOCATION/$METAFILE - echo "PACKAGE SIZE (compressed): $SIZE K" >> $LOCATION/$METAFILE - echo "PACKAGE SIZE (uncompressed): $USIZE K" >> $LOCATION/$METAFILE - echo "PACKAGE REQUIRED: $REQUIRED" >> $LOCATION/$METAFILE - echo "PACKAGE CONFLICTS: $CONFLICTS" >> $LOCATION/$METAFILE - echo "PACKAGE SUGGESTS: $SUGGESTS" >> $LOCATION/$METAFILE - echo "PACKAGE DESCRIPTION:" >> $LOCATION/$METAFILE - tar xzfO $1 install/slack-desc | grep -E '\w+\:'|grep -v '^#' >> $LOCATION/$METAFILE - echo "" >> $LOCATION/$METAFILE -} - -function do_all { - for pkg in `find . -type f -name '*.tgz' -print`; do - gen_meta $pkg - done - $0 PACKAGESTXT - $0 FILELIST - $0 MD5 -} - -function show_usage { - echo "`basename $0` [pkg [file]|all|new|svnmeta|PACKAGESTXT|FILELIST|MD5]" -} - -case "$1" in - pkg) - if [ -n "$2" ]; then - gen_meta $2 - else - show_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 - ;; - FILELIST) - gen_filelist - ;; - MD5) - gen_md5_checksums - ;; - usage) - show_usage - ;; - *) - do_all - svn_add_meta - ;; -esac diff --git a/src/simplaret b/src/simplaret deleted file mode 100755 index 8735074..0000000 --- a/src/simplaret +++ /dev/null @@ -1,997 +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