From f76d87c78ade79c700b6dd48aeb6b8bbef60cf34 Mon Sep 17 00:00:00 2001 From: rhatto Date: Fri, 13 Apr 2007 21:46:27 +0000 Subject: created 0.6 branch git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@341 04377dda-e619-0410-9926-eae83683ac58 --- branches/0.6/README | 2 + branches/0.6/conf/generic.mkSlackBuild.new | 250 ++++ branches/0.6/conf/repos.conf.new | 41 + branches/0.6/conf/simplepkg.conf.new | 125 ++ branches/0.6/doc/CHANGELOG | 389 +++++++ branches/0.6/doc/COPYING | 340 ++++++ branches/0.6/doc/README | 258 +++++ branches/0.6/doc/README.pt_BR | 254 +++++ branches/0.6/doc/README.simplaret | 143 +++ branches/0.6/doc/README.simplaret.pt_BR | 148 +++ branches/0.6/doc/TODO | 5 + branches/0.6/doc/simplepkg.aux | 30 + branches/0.6/doc/simplepkg.dvi | Bin 0 -> 25288 bytes branches/0.6/doc/simplepkg.html | 201 ++++ branches/0.6/doc/simplepkg.log | 286 +++++ branches/0.6/doc/simplepkg.out | 11 + branches/0.6/doc/simplepkg.pdf | Bin 0 -> 69718 bytes branches/0.6/doc/simplepkg.tex | 241 ++++ branches/0.6/install/doinst.sh | 3 + branches/0.6/install/slack-desc | 19 + branches/0.6/lib/common.sh | 713 ++++++++++++ branches/0.6/simplepkg.SlackBuild | 73 ++ branches/0.6/src/createpkg | 511 +++++++++ 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 | 1196 ++++++++++++++++++++ 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 ++++++++++++++++ .../openoffice/openoffice.d/etc/profile.d/lang.csh | 33 + .../openoffice/openoffice.d/etc/profile.d/lang.sh | 33 + .../openoffice/openoffice.d/opt/OpenOffice.org | 1 + branches/0.6/templates/openoffice/openoffice.perms | 0 .../openoffice/openoffice.s/post-install.sh | 22 + .../0.6/templates/openoffice/openoffice.template | 60 + branches/0.6/templates/slackware/slackware.perms | 0 .../0.6/templates/slackware/slackware.template | 566 +++++++++ .../vserver-legacy.d/etc/apache/httpd.conf | 1046 +++++++++++++++++ .../vserver-legacy.d/etc/apache/php.ini | 1122 ++++++++++++++++++ .../vserver-legacy.d/etc/apache/vhosts | 0 .../vserver-legacy/vserver-legacy.d/etc/hosts | 21 + .../vserver-legacy.d/etc/logrotate.d/apache | 11 + .../vserver-legacy/vserver-legacy.d/etc/profile | 87 ++ .../vserver-legacy/vserver-legacy.d/etc/rc.d/rc.0 | 110 ++ .../vserver-legacy/vserver-legacy.d/etc/rc.d/rc.4 | 256 +++++ .../vserver-legacy/vserver-legacy.d/etc/rc.d/rc.6 | 110 ++ .../vserver-legacy/vserver-legacy.d/etc/rc.d/rc.K | 88 ++ .../vserver-legacy/vserver-legacy.d/etc/rc.d/rc.M | 256 +++++ .../vserver-legacy/vserver-legacy.d/etc/rc.d/rc.S | 294 +++++ .../vserver-legacy.d/etc/rc.d/rc.httpd | 21 + .../vserver-legacy.d/etc/rc.d/rc.inet2 | 129 +++ .../vserver-legacy.d/etc/rc.d/rc.inetd | 36 + .../vserver-legacy.d/etc/rc.d/rc.ip_forward | 64 ++ .../vserver-legacy.d/etc/rc.d/rc.local | 5 + .../vserver-legacy.d/etc/rc.d/rc.mysqld | 80 ++ .../vserver-legacy.d/etc/rc.d/rc.postfix | 45 + .../vserver-legacy.d/etc/rc.d/rc.sendmail | 38 + .../vserver-legacy.d/etc/rc.d/rc.serial | 132 +++ .../vserver-legacy.d/etc/rc.d/rc.sshd | 50 + .../vserver-legacy.d/etc/rc.d/rc.syslog | 42 + .../vserver-legacy.d/etc/rc.d/rc.sysvinit | 58 + .../vserver-legacy/vserver-legacy.d/etc/rssh.conf | 48 + .../vserver-legacy.d/etc/ssh/sshd_config | 103 ++ .../vserver-legacy.d/var/www/htdocs/missing.html | 12 + .../vserver-legacy.d/var/www/missing.html | 12 + .../templates/vserver-legacy/vserver-legacy.perms | 36 + .../vserver-legacy/vserver-legacy.s/GPG-KEY | 88 ++ .../vserver-legacy/vserver-legacy.s/devices.tar.gz | Bin 0 -> 322 bytes .../vserver-legacy/vserver-legacy.s/skel.conf | 70 ++ .../vserver-legacy.s/vserver-legacy.sh | 49 + .../vserver-legacy/vserver-legacy.template | 251 ++++ .../vserver/vserver.d/etc/apache/httpd.conf | 1046 +++++++++++++++++ .../templates/vserver/vserver.d/etc/apache/php.ini | 1122 ++++++++++++++++++ .../templates/vserver/vserver.d/etc/apache/vhosts | 0 branches/0.6/templates/vserver/vserver.d/etc/hosts | 21 + .../vserver/vserver.d/etc/logrotate.d/apache | 11 + .../0.6/templates/vserver/vserver.d/etc/profile | 87 ++ .../0.6/templates/vserver/vserver.d/etc/rc.d/rc | 11 + .../0.6/templates/vserver/vserver.d/etc/rc.d/rc.0 | 110 ++ .../0.6/templates/vserver/vserver.d/etc/rc.d/rc.4 | 256 +++++ .../0.6/templates/vserver/vserver.d/etc/rc.d/rc.6 | 110 ++ .../0.6/templates/vserver/vserver.d/etc/rc.d/rc.K | 88 ++ .../0.6/templates/vserver/vserver.d/etc/rc.d/rc.M | 256 +++++ .../0.6/templates/vserver/vserver.d/etc/rc.d/rc.S | 294 +++++ .../templates/vserver/vserver.d/etc/rc.d/rc.httpd | 21 + .../templates/vserver/vserver.d/etc/rc.d/rc.inet2 | 129 +++ .../templates/vserver/vserver.d/etc/rc.d/rc.inetd | 36 + .../vserver/vserver.d/etc/rc.d/rc.ip_forward | 64 ++ .../templates/vserver/vserver.d/etc/rc.d/rc.local | 5 + .../templates/vserver/vserver.d/etc/rc.d/rc.mysqld | 80 ++ .../vserver/vserver.d/etc/rc.d/rc.postfix | 45 + .../vserver/vserver.d/etc/rc.d/rc.sendmail | 38 + .../templates/vserver/vserver.d/etc/rc.d/rc.serial | 132 +++ .../templates/vserver/vserver.d/etc/rc.d/rc.sshd | 50 + .../templates/vserver/vserver.d/etc/rc.d/rc.syslog | 42 + .../vserver/vserver.d/etc/rc.d/rc.sysvinit | 58 + .../0.6/templates/vserver/vserver.d/etc/rssh.conf | 48 + .../vserver/vserver.d/etc/ssh/sshd_config | 103 ++ .../vserver/vserver.d/var/www/htdocs/missing.html | 12 + .../vserver/vserver.d/var/www/missing.html | 12 + branches/0.6/templates/vserver/vserver.perms | 37 + branches/0.6/templates/vserver/vserver.s/GPG-KEY | 88 ++ .../0.6/templates/vserver/vserver.s/devices.tar.gz | Bin 0 -> 320 bytes .../0.6/templates/vserver/vserver.s/vserver.sh | 55 + branches/0.6/templates/vserver/vserver.template | 250 ++++ branches/0.6/utils/add-gpl | 33 + branches/0.6/utils/add-slack-required | 63 ++ branches/0.6/utils/convert-template-scheme | 35 + branches/0.6/utils/exec-slackbuild | 88 ++ branches/0.6/utils/merge-template | 37 + branches/0.6/utils/metapkg | 72 ++ branches/0.6/utils/searchpkg | 36 + 115 files changed, 18459 insertions(+) create mode 100644 branches/0.6/README create mode 100644 branches/0.6/conf/generic.mkSlackBuild.new create mode 100644 branches/0.6/conf/repos.conf.new create mode 100644 branches/0.6/conf/simplepkg.conf.new create mode 100644 branches/0.6/doc/CHANGELOG create mode 100644 branches/0.6/doc/COPYING create mode 100644 branches/0.6/doc/README create mode 100644 branches/0.6/doc/README.pt_BR create mode 100644 branches/0.6/doc/README.simplaret create mode 100644 branches/0.6/doc/README.simplaret.pt_BR create mode 100644 branches/0.6/doc/TODO create mode 100644 branches/0.6/doc/simplepkg.aux create mode 100644 branches/0.6/doc/simplepkg.dvi create mode 100644 branches/0.6/doc/simplepkg.html create mode 100644 branches/0.6/doc/simplepkg.log create mode 100644 branches/0.6/doc/simplepkg.out create mode 100644 branches/0.6/doc/simplepkg.pdf create mode 100644 branches/0.6/doc/simplepkg.tex create mode 100644 branches/0.6/install/doinst.sh create mode 100644 branches/0.6/install/slack-desc create mode 100644 branches/0.6/lib/common.sh create mode 100755 branches/0.6/simplepkg.SlackBuild create mode 100644 branches/0.6/src/createpkg create mode 100755 branches/0.6/src/jail-commit create mode 100755 branches/0.6/src/jail-update create mode 100755 branches/0.6/src/lspkg create mode 100755 branches/0.6/src/mkbuild create mode 100755 branches/0.6/src/mkjail create mode 100755 branches/0.6/src/rebuildpkg create mode 100755 branches/0.6/src/repos create mode 100755 branches/0.6/src/simplaret create mode 100755 branches/0.6/src/templatepkg create mode 100755 branches/0.6/templates/openoffice/openoffice.d/etc/profile.d/lang.csh create mode 100755 branches/0.6/templates/openoffice/openoffice.d/etc/profile.d/lang.sh create mode 120000 branches/0.6/templates/openoffice/openoffice.d/opt/OpenOffice.org create mode 100644 branches/0.6/templates/openoffice/openoffice.perms create mode 100755 branches/0.6/templates/openoffice/openoffice.s/post-install.sh create mode 100644 branches/0.6/templates/openoffice/openoffice.template create mode 100644 branches/0.6/templates/slackware/slackware.perms create mode 100644 branches/0.6/templates/slackware/slackware.template create mode 100644 branches/0.6/templates/vserver-legacy/vserver-legacy.d/etc/apache/httpd.conf create mode 100644 branches/0.6/templates/vserver-legacy/vserver-legacy.d/etc/apache/php.ini create mode 100644 branches/0.6/templates/vserver-legacy/vserver-legacy.d/etc/apache/vhosts create mode 100644 branches/0.6/templates/vserver-legacy/vserver-legacy.d/etc/hosts create mode 100644 branches/0.6/templates/vserver-legacy/vserver-legacy.d/etc/logrotate.d/apache create mode 100644 branches/0.6/templates/vserver-legacy/vserver-legacy.d/etc/profile create mode 100755 branches/0.6/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.0 create mode 100644 branches/0.6/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.4 create mode 100755 branches/0.6/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.6 create mode 100755 branches/0.6/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.K create mode 100755 branches/0.6/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.M create mode 100755 branches/0.6/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.S create mode 100644 branches/0.6/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.httpd create mode 100755 branches/0.6/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.inet2 create mode 100644 branches/0.6/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.inetd create mode 100644 branches/0.6/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.ip_forward create mode 100755 branches/0.6/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.local create mode 100644 branches/0.6/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.mysqld create mode 100644 branches/0.6/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.postfix create mode 100644 branches/0.6/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.sendmail create mode 100755 branches/0.6/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.serial create mode 100755 branches/0.6/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.sshd create mode 100755 branches/0.6/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.syslog create mode 100755 branches/0.6/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.sysvinit create mode 100644 branches/0.6/templates/vserver-legacy/vserver-legacy.d/etc/rssh.conf create mode 100644 branches/0.6/templates/vserver-legacy/vserver-legacy.d/etc/ssh/sshd_config create mode 100644 branches/0.6/templates/vserver-legacy/vserver-legacy.d/var/www/htdocs/missing.html create mode 100644 branches/0.6/templates/vserver-legacy/vserver-legacy.d/var/www/missing.html create mode 100644 branches/0.6/templates/vserver-legacy/vserver-legacy.perms create mode 100644 branches/0.6/templates/vserver-legacy/vserver-legacy.s/GPG-KEY create mode 100644 branches/0.6/templates/vserver-legacy/vserver-legacy.s/devices.tar.gz create mode 100644 branches/0.6/templates/vserver-legacy/vserver-legacy.s/skel.conf create mode 100644 branches/0.6/templates/vserver-legacy/vserver-legacy.s/vserver-legacy.sh create mode 100644 branches/0.6/templates/vserver-legacy/vserver-legacy.template create mode 100644 branches/0.6/templates/vserver/vserver.d/etc/apache/httpd.conf create mode 100644 branches/0.6/templates/vserver/vserver.d/etc/apache/php.ini create mode 100644 branches/0.6/templates/vserver/vserver.d/etc/apache/vhosts create mode 100644 branches/0.6/templates/vserver/vserver.d/etc/hosts create mode 100644 branches/0.6/templates/vserver/vserver.d/etc/logrotate.d/apache create mode 100644 branches/0.6/templates/vserver/vserver.d/etc/profile create mode 100755 branches/0.6/templates/vserver/vserver.d/etc/rc.d/rc create mode 100755 branches/0.6/templates/vserver/vserver.d/etc/rc.d/rc.0 create mode 100644 branches/0.6/templates/vserver/vserver.d/etc/rc.d/rc.4 create mode 100755 branches/0.6/templates/vserver/vserver.d/etc/rc.d/rc.6 create mode 100755 branches/0.6/templates/vserver/vserver.d/etc/rc.d/rc.K create mode 100755 branches/0.6/templates/vserver/vserver.d/etc/rc.d/rc.M create mode 100755 branches/0.6/templates/vserver/vserver.d/etc/rc.d/rc.S create mode 100644 branches/0.6/templates/vserver/vserver.d/etc/rc.d/rc.httpd create mode 100755 branches/0.6/templates/vserver/vserver.d/etc/rc.d/rc.inet2 create mode 100644 branches/0.6/templates/vserver/vserver.d/etc/rc.d/rc.inetd create mode 100644 branches/0.6/templates/vserver/vserver.d/etc/rc.d/rc.ip_forward create mode 100755 branches/0.6/templates/vserver/vserver.d/etc/rc.d/rc.local create mode 100644 branches/0.6/templates/vserver/vserver.d/etc/rc.d/rc.mysqld create mode 100644 branches/0.6/templates/vserver/vserver.d/etc/rc.d/rc.postfix create mode 100644 branches/0.6/templates/vserver/vserver.d/etc/rc.d/rc.sendmail create mode 100755 branches/0.6/templates/vserver/vserver.d/etc/rc.d/rc.serial create mode 100755 branches/0.6/templates/vserver/vserver.d/etc/rc.d/rc.sshd create mode 100755 branches/0.6/templates/vserver/vserver.d/etc/rc.d/rc.syslog create mode 100755 branches/0.6/templates/vserver/vserver.d/etc/rc.d/rc.sysvinit create mode 100644 branches/0.6/templates/vserver/vserver.d/etc/rssh.conf create mode 100644 branches/0.6/templates/vserver/vserver.d/etc/ssh/sshd_config create mode 100644 branches/0.6/templates/vserver/vserver.d/var/www/htdocs/missing.html create mode 100644 branches/0.6/templates/vserver/vserver.d/var/www/missing.html create mode 100644 branches/0.6/templates/vserver/vserver.perms create mode 100644 branches/0.6/templates/vserver/vserver.s/GPG-KEY create mode 100644 branches/0.6/templates/vserver/vserver.s/devices.tar.gz create mode 100644 branches/0.6/templates/vserver/vserver.s/vserver.sh create mode 100644 branches/0.6/templates/vserver/vserver.template create mode 100755 branches/0.6/utils/add-gpl create mode 100755 branches/0.6/utils/add-slack-required create mode 100755 branches/0.6/utils/convert-template-scheme create mode 100755 branches/0.6/utils/exec-slackbuild create mode 100755 branches/0.6/utils/merge-template create mode 100755 branches/0.6/utils/metapkg create mode 100755 branches/0.6/utils/searchpkg diff --git a/branches/0.6/README b/branches/0.6/README new file mode 100644 index 0000000..d4d1463 --- /dev/null +++ b/branches/0.6/README @@ -0,0 +1,2 @@ +See doc/README for more information. +Portuguese documentation at doc/README.pt_BR. diff --git a/branches/0.6/conf/generic.mkSlackBuild.new b/branches/0.6/conf/generic.mkSlackBuild.new new file mode 100644 index 0000000..6b5473e --- /dev/null +++ b/branches/0.6/conf/generic.mkSlackBuild.new @@ -0,0 +1,250 @@ +################################################### +## Generic template for SlackBuilds +## +## Version 0.8.1 - Luis ( luis at riseup d0t net) +## +################################################### + all +#!/bin/bash +# +# SlackBuild for [[PROGRAM NAME]] +# [[PROGRAM URL]] +# +# Author: [[SLACKBUILD AUTHOR]] +# + + + all +# Look for slackbuildrc +if [ -f ~/.slackbuildrc ]; then + source ~/.slackbuildrc +elif [ -f /etc/slackbuildrc ]; then + source /etc/slackbuildrc +fi + + + all +# Set variables +CWD="$(pwd)" +SRC_NAME="[[SOURCE NAME]]" +PKG_NAME="[[PACKAGE NAME]]" +ARCH=${ARCH:=[[ARCH]]} +SRC_VERSION=${VERSION:=[[VERSION]]} +PKG_VERSION="$(echo "$SRC_VERSION" | tr '[[:blank:]-]' '_')" +BUILD=${BUILD:=1[[SLACKBUILD AUTHOR INITIALS]]} +SRC_DIR=${SRC_DIR:=$CWD}/$PKG_NAME +TMP=${TMP:=/tmp} +PKG=${PKG:=$TMP/package-$PKG_NAME} +REPOS=${REPOS:=$TMP} +PREFIX=${PREFIX:=[[PREFIX]]} +PKG_SRC="$TMP/$SRC_NAME-$SRC_VERSION" +CONF_OPTIONS=${CONF_OPTIONS:=[[OTHER CONFIGURE ARGS]]} +NUMJOBS=${NUMJOBS:="-j4"} + + + all +# Set system libraries' path and optmization flags based on $ARCH +LIBDIR="$PREFIX/lib" + +if [ "$ARCH" = "i386" ]; then + SLKCFLAGS="-O2 -march=i386 -mcpu=i686" +elif [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mcpu=i686" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686" +elif [ "$ARCH" = "s390" ]; then + SLKCFLAGS="-O2" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2" + LIBDIR="$PREFIX/lib64" +fi + + + on +# Set error codes (used by createpkg) +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 + + + all +# Clean up any leftovers of previous builds +rm -rf "$PKG_SRC" 2> /dev/null +rm -rf "$PKG" 2> /dev/null + +# Create directories if necessary +mkdir -p "$SRC_DIR" || exit $ERROR_MKDIR +mkdir -p "$PKG" || exit $ERROR_MKDIR +mkdir -p "$REPOS" || exit $ERROR_MKDIR + + + on +# Dowload source if necessary +SRC="$SRC_NAME-$SRC_VERSION.tar.[[SOURCE EXTENSION]]" +URL="[[DOWNLOAD FOLDER URL]]/$SRC" + +if [ ! -s "$SRC_DIR/$SRC" ] || ! [[DECOMPRESSOR]] [[DECOMPRESSOR TEST FLAG]] "$SRC_DIR/$SRC" 2> /dev/null; then + wget "$URL" -O "$SRC_DIR/$SRC" || exit $ERROR_WGET +fi + + + off +# Download source's MD5 checksum if necessary and check it +if [ ! -s "$SRC_DIR/$SRC.[[MD5SUM EXTENSION]]" ]; then + wget "$URL.[[MD5SUM EXTENSION]]" -O "$SRC_DIR/$SRC.[[MD5SUM EXTENSION]]" || exit $ERROR_WGET +fi + +MD5SUM_SRC="$(md5sum "$SRC_DIR/$SRC" | cut -d " " -f 1)" +MD5SUM_URL="$(grep "$SRC[ \t]*$" "$SRC_DIR/$SRC.[[MD5SUM EXTENSION]]" | cut -d " " -f 1)" + +[ "$MD5SUM_SRC" == "$MD5SUM_URL" ] || exit $ERROR_MD5 + + + off +# Import minimized signing key from +# [[SIGNING KEY URL]] +gpg --import << EOKEY || exit $ERROR_GPG +[[SIGNING KEY]] +EOKEY + +# Dowload source's signature if necessary and check it +if [ ! -s "$SRC_DIR/$SRC.sig" ]; then + wget "$URL.sig" -O "$SRC_DIR/$SRC.sig" || exit $ERROR_WGET +fi + +gpg --verify "$SRC_DIR/$SRC.sig" "$SRC_DIR/$SRC" || exit $ERROR_GPG + + + all +# Untar +cd "$TMP" +tar --no-same-owner --no-same-permissions -xvf "$SRC_DIR/$SRC" || exit $ERROR_TAR +cd "$PKG_SRC" + + + off +# Patch source +patches="[[PATCH FILES]] + $PKG_NAME.diff $PKG_NAME-$PKG_VERSION.diff + $PKG_NAME-$PKG_VERSION-$ARCH.diff $PKG_NAME-$ARCH.diff" +for patch in $patches; do + if [ -f "$CWD/$patch" ]; then + patch -Np[[NUMBER OF PREFIX SLASHES TO STRIP]] < "$CWD/$patch" || exit $ERROR_PATCH + elif [ -f "$CWD/patches/$patch" ]; then + patch -Np[[NUMBER OF PREFIX SLASHES TO STRIP]] < "$CWD/patches/$patch" || exit $ERROR_PATCH + fi +done + + + on +# Configure +CFLAGS="$SLKCFLAGS" \ + CXXFLAGS="$SLKCFLAGS" \ + ./configure \ + --prefix="$PREFIX" --libdir="$LIBDIR" "$CONF_OPTIONS" || exit $ERROR_CONF + + + all +# Compile +make $NUMJOBS || exit $ERROR_MAKE + + + all +# Install +make install DESTDIR="$PKG" || exit $ERROR_INSTALL + + + on +# Strip binaries +( cd "$PKG" + 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 +) + + + off +# Compress and link manpages +if [ -d "$PKG/$PREFIX/man" ]; then + ( cd "$PKG/$PREFIX/man" + for manpagedir in $(find . -type d -name "man*") ; do + ( cd $manpagedir + for eachpage in $( find . -type l -maxdepth 1) ; do + ln -s $( readlink $eachpage ).gz $eachpage.gz + rm $eachpage + done + gzip -9 *.? + ) + done + ) +fi + + + off +# Compress info files +if [ -d "$PKG/$PREFIX/info" ]; then + ( cd "$PKG/$PREFIX/info" + rm -f dir + gzip -9 * + ) +fi + + + on +# Install documentation +DOCS="[[DOCUMENTATION FILES]]" +mkdir -p "$PKG/usr/doc/$PKG_NAME-$PKG_VERSION" || exit $ERROR_MKDIR +cp -a $DOCS "$PKG/usr/doc/$PKG_NAME-$PKG_VERSION" + + + on +# Add package description (slack-desc) +mkdir -p "$PKG/install" || exit $ERROR_MKDIR +cat << EODESC > "$PKG/install/slack-desc" +# 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 ':'. + + |-----handy-ruler------------------------------------------------------| +[[SLACK-DESC]] +EODESC + + + off +# Add a post-installation script (doinst.sh) +cat << EOSCRIPT > "$PKG/install/doinst.sh" +config() { + NEW="\$1" + OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r \$OLD ]; then + mv \$NEW \$OLD + elif [ "\$(cat \$OLD | md5sum)" = "\$(cat \$NEW | md5sum)" ]; then + # toss the redundant copy + rm \$NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +config path/to/config_file.new +[[REST OF DOINST.SH]] +EOSCRIPT + + + all +# Build the package +cd "$PKG" +makepkg -l y -c n "$REPOS/$PKG_NAME-$PKG_VERSION-$ARCH-$BUILD.tgz" || exit $ERROR_MKPKG + + + on +# Delete source and build directories if requested +if [ "$CLEANUP" == "yes" ]; then + rm -rf "$PKG_SRC" "$PKG" +fi + diff --git a/branches/0.6/conf/repos.conf.new b/branches/0.6/conf/repos.conf.new new file mode 100644 index 0000000..1d77419 --- /dev/null +++ b/branches/0.6/conf/repos.conf.new @@ -0,0 +1,41 @@ +# +# repository definitions for simplaret +# please dont use any spaces inside a repository definition +# + +# root repositories +ROOT-i386="tds%http://slackware.mirrors.tds.net/pub/slackware/" +ROOT-i386="sarava%http://slack.sarava.org/slackware/" +ROOT-x86_64="sarava%http://slack.sarava.org/slamd64/" +ROOT-x86_64="slackadelic%http://mirror1.slackadelic.com/slamd64/" +ROOT-x86_64="heanet%http://ftp.heanet.ie/pub/slamd64/" +ROOT-powerpc="workaround%http://slackintosh.workaround.ch/pub/slackintosh/" +ROOT-s390="ibiblio%http://distro.ibiblio.org/pub/linux/distributions/slack390/" + +# noarch +NOARCH="sarava%http://slack.sarava.org/packages/noarch" + +# i386 10.2 +REPOS-i386-10.2="sarava%http://slack.sarava.org/packages/slackware/slackware-10.2/" +PATCHES-i386-10.2="sarava%http://slack.sarava.org/packages/slackware/slackware-10.2/patches/" + +# x86_64 10.2 +REPOS-x86_64-10.2="sarava%http://slack.sarava.org/packages/slamd64/slamd64-10.2/" +PATCHES-x86_64-10.2="sarava%http://slack.sarava.org/packages/slamd64/slamd64-10.2/patches/" + +# x86_64 10.2b +REPOS-x86_64-10.2b="sarava%http://slack.sarava.org/packages/slamd64/slamd64-10.2b/" +PATCHES-x86_64-10.2b="sarava%http://slack.sarava.org/packages/slamd64/slamd64-10.2b/patches/" + +# i386 11.0 +REPOS-i386-11.0="sarava%http://slack.sarava.org/packages/slackware/slackware-11.0/" +PATCHES-i386-11.0="sarava%http://slack.sarava.org/packages/slackware/slackware-11.0/patches/" + +# x86_64 11.0 +REPOS-x86_64-11.0="sarava%http://slack.sarava.org/packages/slamd64/slamd64-11.0/" +PATCHES-x86_64-11.0="sarava%http://slack.sarava.org/slamd64/slamd64-11.0/patches/" + +# powerpc 11.0 +REPOS-powerpc-11.0="sarava%http://slack.sarava.org/packages/slackintosh/slackintosh-11.0/" +PATCHES-powerpc-11.0="workaround%http://slackintosh.workaround.ch/pub/slackintosh/11.0/patches/" + diff --git a/branches/0.6/conf/simplepkg.conf.new b/branches/0.6/conf/simplepkg.conf.new new file mode 100644 index 0000000..6a3c687 --- /dev/null +++ b/branches/0.6/conf/simplepkg.conf.new @@ -0,0 +1,125 @@ +# +# /etc/simplepkg/simplepkg.conf +# + +# Default architecture: set this option if you dont want simplepkg +# to use the value from /etc/slackware-version +# DEFAULT_ARCH="i386" + +# Default version: set this option if you dont want simplepkg; +# to use the value from /etc/slackware-version +# DEFAULT_VERSION="11.0" + +# Where jails are placed +JAIL_ROOT="/vservers" + +# Wheter mkjial should add new jails in the jail list; +# to enable it, set to "1" or "yes" +ADD_TO_JAIL_LIST="1" + +# Whether mkjail should clean the package cache before installation +# to enable it, set to "1" or "yes" +SIMPLARET_CLEAN="1" + +# whether mkjail should clean the package cache after the installation; +# to enable it, set to "1" or "yes" +SIMPLARET_DELETE_DOWN="1" + +# Whether mkjail should issue a simplaret --update before install the jail; +# to enable it, set to "1" or "yes" +SIMPLARET_UPDATE="1" + +# Wheter try to download from the next repository on failed download. +SIMPLARET_DOWNLOAD_FROM_NEXT_REPO="1" + +# Wheter delete also patches when simplaret --purge is called; +# to enable it, set to "1" or "yes" +SIMPLARET_PURGE_PATCHES="0" + +# Whether delete each package rigth after its installation; +# to enable it, set to "1" or "yes" +SIMPLARET_DELETE_DURING="0" + +# Delete packages older than N weeks from the cache +SIMPLARET_PURGE_WEEKS="3" + +# Where patches are placed +PATCHES_DIR="/var/simplaret/patches" + +# Place to store your packages +STORAGE="/var/simplaret/packages" + +# Whether to use passive ftp transfers; +# to enable it, set to "1" or "yes" +PASSIVE_FTP="1" + +# Http retrieval tool; +# available parameters are "wget" or "curl" +HTTP_TOOL="wget" + +# Ftp retrieval tool; +# available parameters are "wget", "curl" or "ncftpget" +FTP_TOOL="wget" + +# Set connection timeout in seconds +CONNECT_TIMEOUT="20" + +# ROOT repository package priority +ROOT_PRIORITY="patches slackware extra testing pasture" + +# REPOS repository package priority +REPOS_PRIORITY="patches slackware extra testing pasture" + +# Whether to check package signatures (you should have the repository +# maintainer key on your keyring) +SIGNATURE_CHECKING="0" + +# Whether simplaret will try to solve dependencies by looking +# for packages' slack-required +DEPENDENCY_CHECKING="1" + +# Enabling this option (i.e, setting to "1" or "yes"), simplaret will +# donwload even # already applied patches, a good option when you plan +# to keep local copies of all needed patches for your system +DOWNLOAD_EVEN_APPLIED_PATCHES="0" + +# Enabling this option (i.e, setting to "1" or "yes"), simplaret will +# look at your standard repositories for new packages; if it find a +# package with different version of your current installed package and +# also this package isnt in the packages folder, then the new package +# is applied; if in doubt, just say no or leave blank. Otherwise set it +# either to "yes" or "1" and remember that if enabling this feature can +# cause problems if you use more than one REPOS definition for each +# ARCH and VERSION. Also, this option can be very slow. +CONSIDER_ALL_PACKAGES_AS_PATCHES="0" + +# Enabling this option (i.e, setting to "1" or "yes"), simplaret will +# store patches it finds on ROOT repositories on +# +# $PATCHES_DIR/$ARCH/$VERSION/root-$repository_name. +# +# By default this option is turned off because it breaks the standard +# way to store packages and can cause some confusion, but its an useful +# feature if you like to see all patches apart from common packages and/or +# stored in the same tree. +STORE_ROOT_PATCHES_ON_PATCHES_DIR="0" + +# Set to yes if your templates will be placed in a subversion repository +# This just work if TEMPLATE_STORAGE_STYLE is set to own-folder (default) +TEMPLATES_UNDER_SVN="no" + +# Where your templates will be located. +# Dont change it except you know what you're doing. +TEMPLATE_FOLDER="/etc/simplepkg/templates" + +# This variable controls in which folder / subfolder your templates will +# be stored. Possible values are: +# +# - simplepkg-folder: templates are stored at /etc/simplepkg +# - templates-folder: templates are stored at /etc/simplepkg/templates +# - own-folder: each template stored at its own folder +# at /etc/simplepkg/templates/template-name +# +# This variable has backwards purposes only, so dont change it. +TEMPLATE_STORAGE_STYLE="own-folder" + diff --git a/branches/0.6/doc/CHANGELOG b/branches/0.6/doc/CHANGELOG new file mode 100644 index 0000000..cfaa5d2 --- /dev/null +++ b/branches/0.6/doc/CHANGELOG @@ -0,0 +1,389 @@ +simplepkg changelog +=================== + +0.5pre17 +======== + + - createpkg, lspkg, jail-commit: + - bugfixes + +0.5pre16 +======== + + - doinst.sh: + - small fix + +0.5pre15 +======== + + - simplaret: + - small bugfix + + - common.sh: + - small bugfix + + - mkbuild: + - some changes + +0.5pre14 +======== + + - simplaret + - added variable REPOS_PRIORITY + - added variable SIMPLARET_DOWNLOAD_FROM_NEXT_REPO + + - lspkg: + - small bugfix + + - common.sh: + - on search_template, doesnt return a template from + defaults/ if the function is called with --update + + - utils/add-slack-required: + - command line enhancement + +0.5pre9 - 0.5pre13 +================== + + - bugfix releases + +0.5pre8 +======= + + - lspkg: + - bugfix + + - common.sh: + - bugfix in function slash + +0.5pre7 +======= + + - simplaret: + - fixed bug for ROOT definitions when there is packages + inside of folders different than ROOT_PRIORITY + +0.5pre6 +======= + + - repos: + - FILE_LIST generation fix + + - mkjail: + - new config variable ADD_TO_JAIL_LIST controls wheter to + add new jails into the JAIL_LIST file + +0.5pre5 +======= + + - jail-commit + - SILENT env variable to decrease verbosity + +0.5pre4 +======= + + - templatepkg: + - small fixes + - help usage summary improvements + - now using variable TEMPLATE_FOLDER + - SILENT env variable to decrease verbosity + - option -p | --post-install renamed to -b | --batch-edit + - option -p | --post-install now used to build a package from a template + - option -d | --delete now can also remove post-install scripts + + - common.sh + - small fixes + - now using variable TEMPLATE_FOLDER + + - jail-commit: + - calling templatepkg silently + - small fixes + +0.5pre3 +======= + + - again, lots of bugfixes + + - jail-commit: + - update a template just once if finds more than one entry + for a template in the jailist + +0.5pre2 +======= + + - lots of bugfixes + + - templatepkg: + - now creates missing components in a template + +0.5pre1 +======= + + Lots of changes! + + - repos: cosmetic changes + + - lspkg: + - support for $ROOT env variable + - some improvements + + - CHANGELOG cleanup + + - subversion repository support for templates + + - metapkg moved to utils/ + + - simplaret: + - new config variables: + - STORE_ROOT_PATCHES_ON_PATCHES_DIR + - SIGNATURE_CHECKING + - ROOT=/otherroot works for --install, --remove and --upgrade + - signature checking + - dependency checking through slack-required + + - mkjail: + - added support for slack-required as templates + - templates now can be stored either on + - /etc/simplepkg/template_name.template + - /etc/simplepkg/templates/template_name.template + - /etc/simplepkg/templates/template_name/template_name.template + + - jail-update + - old script renamed to jail-commit + - now update a jail from a template + - svn repository support + + - jail-commit + - new script, commit changes from a jail to the templates + - svn repository support + + - templatepkg: + - major rewrite + - svn repository support + - now supports a tagfile or slack-required as a template + - new/changed options + -c | --create: improvements + -a | --add: changed to add files into a template + -u | --update: update a template + -d | --delete: delete files or folders from a template + -s | --sync: sync /etc/simplepkg/templates working copy + -e | --export: export /etc/simplepkg/templates to a svn repository + -i | --import: grab /etc/simplepkg/templates from a svn repository + -r | --remove: remove a template + -l | --list: list templates + -p | --post-install: add or edit post-installation scripts + -t | --template-edit: edit template package list + -h | --help: display this summary + +0.4.9pre18-23 +============= + + - simplaret: + - enhanced http retrieval: curl support + - enhanced verbosity + - get-patches small changes + - various fixes + +0.4.9pre10-17 +============= + + - lots of simplaret fixes + +0.4.9pre9 +========= + + - createpkg: + - speedup + - ncftpget support + - timeout support + - sets the correct architecture + + - deleted jail-upgrade + + - removed swaret support + +0.4.9pre8 +========= + + - createpkg: bugfix + + - common.sh: + - enhanced config file evaluation + - fixed function default_arch + + - simplaret: + - config evaluation via common.sh + - new config parameter SIMPLARET_PURGE_PATCHES + +0.4.9pre7 +========= + + - repos: added patches/ metafile creation + + - jail-upgrade: + - added option CONSIDER_ALL_PACKAGES_AS_PATCHES + - merged swaret and simplaret upgrade procedures + - act recursively on patches' folder + + - simplaret: lots of changes, most important are: + - new repository scheme, take a look at repos.conf.new. + - --get looks first to PATCHES repositories, then ROOT, + then REPOS and finally at NOARCH repositories; the + firts matching package is downloaded. + - new config parameter ROOT_PRIORITY set the priority + of folder lookup at a ROOT repository, defaults to + "patches slackware extra testing pasture". + - for --get, check if an already existing package + in the local repository has the same version and + build number, otherwise erase the old and download + the new one. + - fixed --get-paches + - added --upgrade option + - added --install + - added --remove + - new config parameter DOWNLOAD_EVEN_APPLIED_PATCHES + + - createpkg: lots of changes + +0.4.9pre6 +========= + + - createpkg: + - fixes + - now with slackbuild error handling + - increased verbosity + + - small fixes on rebuildpkg + + - lspkg enhancements + + - simplaret fix on --purge + + - updated default repos.conf + +0.4.9pre5 +========= + + - added script "repos" + + - moved simplaret to /usr/bin + +0.4.9pre4 +========= + + - createpkg: better command line evaluation, + now using "upgradepkg --install-new" to + install a package and added the command + line option --no-deps so createpkg doesn't + goes down to solve all slack-required + dependencies. + +0.4.9pre3 +========= + + - small fix on createpkg when handling with + slackbuilds with similar names + +0.4.9pre2 +========= + + - fixed simplepkg.SlackBuild + + - fixed doinst.sh + + - re-organized the source repository + + - added createpkg + + - updated README and README.pt_BR + +0.4.8 +===== + + - simplaret: removed extra folder from slamd64 definition + + - fixed a typo + +0.4.7 +===== + + - templatepkg bugfix on blank template lines and on package deletion + changed simplaret working dir in simplaret.conf.new + +0.4.6 +===== + + - small bugfix on jail-update that prevented template update + +0.4.5 +===== + + - vserver template update + +0.4.4 +===== + + - WARNING option on config file for simplaret + + - SILENT env var, if a non-zero value, keeps simplaret + work silenty when purging and works like if WANRING is set + to not null. + + - added SIMPLARET_DELETE_DURING config parameter: when set + to a non-zero value deletes each package rigth after its + installation + +0.4.3 +===== + + - added openoffice.org template + +0.4.2 +===== + + - common.sh: fix on install_packages when handling + with similar package names + +0.4.1 +===== + + - templatepkg: fixed tagfiles and comment handling + +0.4 +=== + + - multi-plataform and version management + + now simplepkg supports jails with architectures and versions + others than the main system, read the docs for details. + + - added simplaret: a small script for downloading packages + + - jail-upgrade + + * arch checking via /etc/slackware-version on each jail + * supports multi-arch and multi-version repository + * integrated with simplaret + + - common.sh: improved functions to support simplaret + +0.3.7-0.3.9 +=========== + + - bugfix releases + +0.3.6 +===== + + - added "-u" option to eval_config to ask for a swaret --update + +0.3.5 +===== + + - "main" jail support for jail-update + +0.3.4 +===== + + - Started changelog :) + diff --git a/branches/0.6/doc/COPYING b/branches/0.6/doc/COPYING new file mode 100644 index 0000000..d60c31a --- /dev/null +++ b/branches/0.6/doc/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 + (at your option) any later version. + + This program 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 + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/branches/0.6/doc/README b/branches/0.6/doc/README new file mode 100644 index 0000000..50b0e9d --- /dev/null +++ b/branches/0.6/doc/README @@ -0,0 +1,258 @@ +Simplepkg: installation manager and metapackage system +------------------------------------------------------ + +Author: Silvio Rhatto +Licence: GPL + +Simplepkg is a non-intrusive package management system running on top of pkgtool. +It uses templates -- lists of installed packages, scripts and configuration files +-- allowing the creation of installation profiles that can be used do install a +complete and configured slackware system in another partition or to create chroot +environments. The same templating scheme extends slackware packaging system, adding +metapackages: a list of packages installed or removed with a single command. + +Documentation +------------- + + English documentation: README | http://slack.sarava.org/node/15 + Portuguese documentation: REAMDE.pt_BR | http://slack.sarava.org/node/12 + +Description +----------- + +All GNU/Linux distributions comes with a well developed packaging system. The question now +is how pratical is the way to install, configure and control any changes in a system. + +As an example, suppose you should keep a list of about 200 slackware machines, some +of them used as desktops, others as mail or webservers. If you lost some hardrives +or usually need to re-install or update some of those boxes. + +Using the slackware installation cd and configuring by hand all the time you got a crash +is a time loss activity and you'll never know if something remained missconfigured. An +alternative is to keep a complete backup of a machine or some parts of the tree, but for +a large number of different boxes this procedure costs a lots of resources. + +Simplepkg offers an alternative sollution for this and other problems related to installation +management, allowing you to keep templates of each machine and install a custom slackware +system with just one or a few commands. Creating and upgrading chroot and vservers is easy +with simplepkg. + +Architecture +------------ + +Simplepkg is a set of scripts wrote in the KISS philosophy. Its a pretty simple system, composed +by the following commands: + + - mkjail: build a slackware jail/installation in a folder + - metapkg: install or remove a metapackage + - templatepkg: create or update a package list of an installation template + - lspkg: show installed packages and its contents + - jail-upgrade: upgrade all or some of the jails/installations + - jail-update: update all configuration files of a template + - rebuildpkg: rebuild a package based on its /var/log/packages entry + - simplaret: package retrieval tool + - createpkg: donwload, compile and package creationg script based on http://slack.sarava.org/slackbuilds + +Simplepkg configs are placed at /etc/simplepkg. Templates are .template files containing an one-by-line +package list. A template can be something like this: + + aaa_base + aaa_elflibs + apache + bash + bin + coreutils + findutils + +Slackware's tagfile format can be used too as a template. + +Installation +------------ + +The latest version of simplepkg is locate at http://slack.sarava.org/packages/noarch/. +Install it with the usual way: + + installpkg simplepkg-VERSION-noarch-BUILD.tgz + +If you have a working swaret on your system, add this line on you swaret.conf: + + REPOS_ROOT=SlackMidiataticaNoarch%http://slack.sarava.org/packages/noarch + +and then issue those commands: + + swaret --update + swaret --install simplepkg + +Configuration +------------- + +As an example, we'll create a jail based on the packages installed in your slackware +system. Edit the config file /etc/simplepkg/simplepkg.conf: + + # /etc/simplepkg/simplepkg.conf + JAIL_ROOT="/vservers" # where jails are placed + SIMPLARET="simplaret" # package grabber program (can be swaret if you have it installed) + SIMPLARET_CLEAN="1" # clean package cache before installation + SIMPLARET_DELETE_DOWN="1" # clean package cache after the installation + SIMPLARET_UPDATE="0" # issue an simplaret --update before install the jail + SIMPLARET_PURGE_WEEKS="N" # delete packages older than N weeks from the cache + PATCHES_DIR="/storage/package/patches" # where patches are placed + DEFAULT_ARCH="i386" + DEFAULT=VERSION="10.2" + STORAGE="/storage/packages" # where simplepkg store packages + PASSIVE_FTP="1" + +You should also put in /etc/simplepkg/repos.conf all package repositories you use, like this: + + ROOT-i386="http://slack.sarava.org/packages/slackware" + REPOS-i386="slack-sarava%http://slack.sarava.org/packages/slackware/slackware-10.2/" + ROOT-x86_64-10.2="http://darkstar.ist.utl.pt/pub/slamd64/" + REPOS-x86_64-10.2="slamd-sarava%http://slack.sarava.org/packages/slamd64/slamd64-10.2/" + +Instead of simplaret you can use swaret to fetch packages and them your swaret.conf must +be configured to use the same place as STORAGE to the package cache. In this case you cant +keep installations and jails with multiple arquitetures and for that reason the use of +simplaret is recommended. + +Creating jails and replicating installations +-------------------------------------------- + + templatepkg my-slackare + mkjail jail my-slackware + +The previous commands creates a template called my-slackware from based on your installed +softwares listed in /var/log/packages and then creates a completely new slackware +tree with all those packages in the folder /vservers/jail (depending on the value of JAIL_ROOT from +your simplepkg.conf). + +If you want that some config files get copied or some scripts executed after install this jail, +place in the folder /etc/simplepkg/my-slackware.d all your config files (preserving the file +system hierarchy, i.e, /etc/simplepkg/my-slackware/etc/apache/httpd.conf) and the scripts at +/etc/simplepkg/my-slackware.s/. The template vserver, which comes in the simplepkg package, has +an example script to use with mkjail. + +You can specify an alternative destination for your jail with a command like + + ROOT=/mnt mkjail hda2 my-slackware + +This does exactly what you think: installs slackware in /mnt/hda2 with exactly the same packages +you have on your system, replacing the need of the slackware installer! + +In case no template specified, mkjail uses the one called /etc/simplepkg/default.template. + +If you keep your jails in JAIL_ROOT with the same name as the template you used to create it, its +possible to use the command jail-update to copy all modifications made in the files which their +counterparts are placed at /etc/simplepkg/jail-name.d. Then you can copy all configuration files +you edited to the template folder and leave a crontab entry to everyday seek for changes and update +the template. When you issue the command + + jail-update + +all jails listed in /etc/simplepkg/jaillist are updated. This command also updates the package list +of the template. + +To add or remove packages from a template, you can just edit by hand the template file or use the +command templatepkg with the -a (append) flag, which adds just the new installed packages in the +template file. + +If you want to create a template from a jail, use + + templatepkg jail /vservers/jail + +Metapackages +------------ + +Another use for the templates is the creation of metapackegs: new users have lots of difficulties +to track dependencies when installing a software. Using a template containing the name of all +packages needed by some program allow users to easily install it through the command + + metapkg --install program-name + +This seems like swaret or slapt-get, with the only difference in the way metapkg deals with +dependence resolution. Slapt-get support the slack-required file, wich comes or not with the +package. Swaret has its own tool for dependence matching. + +Simplepkg doesn't wish to substitute those two dependence checking modes, but offer an alternate +way to distribute packages where dependences are resolved without an specific tool or a change +in the package itself. + +A metapackage, i.e, all installed packages from a template, can be removed with + + metapkg --remove program-name + +Upgrading jails +--------------- + +Both the main installation (your root system) and your jails are upgraded with the command +jail-upgrade: just adjust simplepkg.conf's PATCHES_DIR to where you store slackware patches +(that can be rsync'ed everyday) and do a + + jail-upgrade + +This will upgrade your main system and all jails living in JAIL_ROOT. To specify another +folder, use + + ROOT=/otherroot jail-upgrade + +If you want to upgrade just one specific jail, + + jail-upgrade jail-name + +To use a patches folder other than PATCHES_DIR, e.g when you have jails with different +slackware versions, use + + PATCHES=/alternative/patches/folder jail-upgrade jail-name + +Different archs and versions +---------------------------- + +Simplepkg was idealized to permit a template to create jails from any architecture and version +of a slackware-like system. Upgrading tasks also are unified. This feature just works if you +use simplaret and not swaret as the package retrieval tool. + +As another example, to create an slack 10.1 installation (assuming your /etc/simplepkg/repos.conf with +the right configuration), just type + + VERSION=10.1 mkjail my-jail server-template + +Different archs can be used too. If you have a x86_64 system and wants to install a slack 10.2 +in a partition, try something like + + ARCH=i386 VERSION=10.2 ROOT=/mnt mkjail hda2 my-slackware + +Note that the templates are arch and version independent, as they just contain package names, +configuration files and scripts. For this reason, the commands templatepkg, metapkg, lspkg and +jail-update can be used normaly. + +To upgrade jails with othes archs and versions, jail-upgrade checks this information through +/etc/slackware-version for each jail and applies the correspondent patches grabed from +simplaret (see the proper documentation). + +By this way, doesn't matter which versions and archs each of your jails has, jail-upgrade remains +the same since your patches are sorted by arch an version, as explained in simplaret documentation +found at http://slack.sarava.org/node/17. + +Auxiliar applications: rebuildpkg and createpkg +----------------------------------------------- + +Simplepkg comes with an additional helper tool that recover installed packages which the original +.tgz file was lost. The command rebuildpkg rebuilds a package from their entry in /var/log/packages. +As an example, + + rebuildpkg coreutils + +rebuilds the coreutils package using the files, scripts and metainformations stored in +/var/log/packages/ and /var/log/scripts/. + +If you want to build you own packages using the scripts available from http://slack.sarava.org/slackbuilds, +use the createpkg script: + + createpkg package-name + +Source +------ + +Source code for simplepkg and its package builder can be fetched via subversion: + + svn checkout svn://slack.sarava.org/simplepkg + diff --git a/branches/0.6/doc/README.pt_BR b/branches/0.6/doc/README.pt_BR new file mode 100644 index 0000000..80634d2 --- /dev/null +++ b/branches/0.6/doc/README.pt_BR @@ -0,0 +1,254 @@ +Simplepkg: gerenciamento de instalações e pacotes +------------------------------------------------- + +Autor: Silvio Rhatto +Licença: GPL + +O simplepkg é um sistema de gerenciamento de pacotes que roda sobre o pkgtool. Ele é composto +por vários scripts que desempenham funções de administração e desenvolvimento de sistemas +do tipo Slackware, procurando fechar um circuito de produção, envolvendo a construção, a +instalação de pacotes e até mesmo a instalação do sistema de forma automatizada. + +Do lado do desenvolvedor/a, ele ajuda na criação de SlackBuilds e construção de pacotes. +Do lado do administrador/a, ele possibilita a instalação automatizada de sistemas, instalação +de pacotes e a criação de "templates" de instalação -- que contém todos os arquivos de configuração, +informações de permissões e scripts de pós-instalação de uma dada máquina ou jaula. + +Ele trabalha com templates -- listas com pacotes instalados, scripts e arquivos de configuração +-- permitindo criar perfis de instalação que podem ser então usados para instalar o sistema numa +outra partição, criar um chroot específico ou até trabalhar com o conceito de metapacotes: uma +lista de pacotes que pode ser instalada e removida com apenas um comando. + +Documentação +------------ + +A documentação mais atualizada do simplepkg está em http://slack.sarava.org/simplepkg + +Descrição +--------- + +Todas as distribuições de GNU/Linux já tem algum sistema de empacotamento amadurecido. A questão +agora é a praticidade de instalar e controlar o que está instalado, tanto pacotes como arquivos +de configuração de uma máquina, além da facilidade na criação de pacotes. + +Imagine por exemplo se você precisa manter uma lista de pacotes de 200 máquinas slackware, sendo +que algumas são usadas como desktop, outras como servidores web, alguma sendo o servidor de email +e assim por diante. Imagine agora que você perca o disco de algumas dessas máquinas ou que precise +cotidianamente reinstalar ou atualizar um sistema. + +Usar o cd de instalação do slackware e configurar na mão toda a vez que der um pau faria com que +você ficasse louco/a e desperdiçasse muito tempo, além do que sempre ocorre de esquecermos algum +detalhe ou pacote durante a configuração do sistema. Manter um backup completo de cada máquina, +por outro lado, pode ser muito custoso se o número delas for muito grande. + +O simplepkg permite que você mantenha um template para cada grupo de máquinas e com apenas um +comando instalar o template numa partição. Além do template, você precisa configurar o simplepkg +para obter pacotes de um repositório local ou remoto. + +Gerenciar instalações e pacotes não é tudo o que o simplepkg faz. Ele pode ser usado até na +criação de jaula e vservers. Ou então ele ... + +Arquitetura +----------- + +O simplepkg é um conjunto de scripts escritos com a filosofia KISS em mente. Ele é um sistema muito +simples, composto pelos seguintes comandos: + + - mkjail: constrói uma jaula/instalação de slackware numa pasta + - metapkg: instala ou remove um metapacote + - templatepkg: criar ou adiciona pacotes a um template + - lspkg: lista pacotes instalados + - jail-upgrade: faz o upgrade nas jaulas + - rebuildpkg: reconstrói um pacote a partir de sua entrada no /var/log/packages + - simplaret: obtém pacotes de repositórios locais ou remotos + - createpkg: baixa, compila e empacota software de acordo com http://slack.sarava.org/slackbuilds + +A pasta de configuração e armazenamento de templates é a /etc/simplepkg. Templates são arquivos contendo +uma lista de pacotes, um pacote por linha e com a extensão .template. Como exemplo, um template poderia se +chamar minimo.template e conter a seguinte lista: + + aaa_base + aaa_elflibs + apache + bash + bin + coreutils + findutils + +Se você quiser também é possível usar um tagfile do slackware como template, sem nem precisar editá-lo. + +Instalando o simplepkg +---------------------- + +Para baixar o pacote do simplepkg, vá em http://slack.sarava.org/packages/noarch/. + + installpkg simplepkg-VERSAO-noarch-BUILD.tgz + +Configurando o simplepkg +------------------------ + +Como exemplo, vamos criar uma jaula baseada nos pacotes instalados no seu slackware. Edite o +arquivo /etc/simplepkg/simplepkg.conf: + + # /etc/simplepkg/simplepkg.conf + JAIL_ROOT="/vservers" # local onde as jaulas serão criadas + SIMPLARET="simplaret" # programa que baixa os pacotes (pode ser o swaret se voce o tiver) + STORAGE="/var/simplaret" # local onde o simplepkg armazena seus pacotes + SIMPLARET_CLEAN="1" # apaga o cache de pacotes antes da instalação da jaula + SIMPLARET_DELETE_DOWN="1" # apaga o cache de pacotes após a instalação + SIMPLARET_UPDATE="0" # atualiza as listas de pacotes antes de iniciar a instalação da jaula + SIMPLARET_PURGE_WEEKS="N" # apaga os pacotes do cache mais velhos que N semanas antes de instalar + PATCHES_DIR="/var/simplaret/patches" # local os patches são armazenados + DEFAULT_ARCH="i386" + DEFAULT=VERSION="10.2" + STORAGE="/storage/packages" # where simplepkg store packages + PASSIVE_FTP="1" + +Para definir quais repositórios de pacotes você usará, edite o arquivo /etc/simplepkg/repos.conf, +colocando algo como + + ROOT-i386="http://slack.sarava.org/packages/slackware" + REPOS-i386="slack-sarava%http://slack.sarava.org/packages/slackware/slackware-10.2/" + ROOT-x86_64-10.2="http://darkstar.ist.utl.pt/pub/slamd64/" + REPOS-x86_64-10.2="slamd-sarava%http://slack.sarava.org/packages/slamd64/slamd64-10.2/" + +Para informações detalhadas sobre o simplaret, consulte seu artigo específico em http://slack.sarava.org/node/16 + +Se você quer utilizar o swaret em lugar do simplaret, o swaret.conf deve estar bem configurado para que ele +seja capaz de baixar e instalar todos os pacotes dos templates. Parâmetros como EXCLUDE podem ser um empecilho, +e se você os remover da sua instalação tenha muito cuidado ao atualizar o seu sistema via swaret --upgrade. +A desvantagem de usar o swaret é que você não terá como administrar jaulas e instalações de múltiplas arquiteturas. + +Criando jaulas e replicando instalações +--------------------------------------- + + templatepkg meu-slackware + mkjail jaula meu-slackware + +Isso cria o template meu-slackware a partir da sua lista de pacotes em /var/log/packages e cria uma nova árvore +com esses pacotes na pasta /vservers/jaula (dependendo de qual o valor da variável JAIL_ROOT do simplepkg.conf, é claro). + +Se você quiser que alguns arquivos de configuração e executar scripts após a instalação dessa jaula, basta colocarmos na +pasta /etc/simplepkg/meu-slackware.d/ os arquivos de configuração (dentro da hierarquia de pastas do sistema, isto é, +/etc/simplepkg/meu-slackware.d/etc/apache/httpd.conf) e os script em /etc/simplepkg/meu-slackware.s/. O template vserver, +que já vem no mkjail contém um exemplo de script. + +Você pode especificar também destinos alternativos para sua jaula, através de um comando do tipo + + ROOT=/mnt mkjail hda2 meu-slackware + +O comando acima faz exatamente o que você está pensando: replica sua instalação slackware em /mnt/hda2, dispensando +totalmente o programa de instalação do slackware! + +Caso nenhum template for especificado, o mkjail utiliza o template /etc/simplepkg/default.template. + +Se você manter uma jaula em JAIL_ROOT com o mesmo nome que um template, é possível ainda usar o script jail-update +para copiar todas as alterações de arquivos da jaula na pasta de arquivos do seu template (/etc/simplepkg/nome-da-jaula.d). +Assim, basta que você copie todos os arquivos de configuração que você editou para essa pasta e deixar o jail-update numa +crontab para que você tenha sempre um template atualizado e baseado nas jaulas / instalações que você tem rodando e que +estiverem listadas no arquivo /etc/simplepkg/jailist: + + jail-update + +Para adicionar ou remover pacotes de um template, basta editar o arquivo de template. Uma outra forma de adicionar +arquivos é usando o templatepkg com a opção -a, que adiciona apenas novos pacotes ao template. Se você quiser que o +templatepkg crie um template a partir de uma jaula, simplesmente use + + templatepkg jaula /vservers/jaula + +Metapacotes +----------- + +Outro uso dos templates é a criação de pacotes: imagine por exemplo a dificuldade de um usuário/a novo de slackware +para instalar o cinelerra e todas as suas dependências. Criando um template contendo o nome de todos os pacotes +necessários para rodar esse software permite que um usuário instale-o simplesmente com o comando + + metapkg --install cinelerra + +O comando sugere uma semelhança com o uso direto do swaret ou do slapt-get, com a única diferença residindo no +modo como cada um desses programas lida com as dependências de um pacote. Os slapt-get suporta o arquivo +slack-required, que pode ou não estar presente no pacote. Já o swaret possui uma ferramenta própria para a +criação de uma lista de dependências. + +O simplepkg não pretende substituir esses dois modos de checagem e sim propor uma alternativa de distribuição +de pacotes em que as dependências são resolvidas sem precisar de um repositório de dependências ou uma modificação +no próprio pacote, que é o caso do slack-required, um arquivo que na maioria das vezes não está presente. + +A remoção de um aplicativo e todas as suas dependências podem ser feitas simplesmente com o comando + + metapkg --remove cinelerra + +Upgrade de jaulas +----------------- + +O upgrade de jaulas que estejam em JAIL_ROOT pode ser efetuado com o comando jail-upgrade. Simplesmente coloque +os patches em PATCHES_DIR e dê o comando + + jail-upgrade + +Se você quiser atualizar apenas uma das jaulas que estão em JAIL_ROOT, use + + jail-upgrade nome-da-jaula + +Para especificar uma pasta contendo patches diferente de PATCHES_DIR (útil quando você possui jaulas com +diferentes versões do slackware), simplesmente use + + PATCHES=/local/dos/patches jail-upgrade nome-da-jaula + +De modo análogo ao mkjail, é possível indicar ao jail-upgrade uma outra pasta onde a jaula está armazenada: + + ROOT=/otherroot jail-upgrade + +Arquiteturas e versões diferentes +--------------------------------- + +O simplepkg foi idealizado para permitir que um mesmo template possa ser usado para criar jaulas de +arquiteturas e versões diferentes de sistemas padrão slackware. A atualização desses sistemas também +é unificada. Essa possibilidade só é permitida se você usa o simplaret e não o swaret como ferramenta +de obtenção de pacotes. + +Por exemplo, para criar uma instalação de slackware 10.1 (assumindo que suas definições de repositórios +do /etc/simplepkg/repos.conf contenham locais com slack 10.1), basta usar o comando + + VERSION=10.1 mkjail minha-jaula template-servidor + +Arquiteturas diferentes também podem ser usadas. Se você está num sistema x86_64 e quer instalar um +slack 10.2 numa partição, experimente + + ARCH=i386 VERSION=10.2 ROOT=/mnt mkjail hda2 meu-slackware + +Note que os templates independem de arquitetura e versão, já que eles só contém nomes de pacotes, +arquivos de configuração e scripts. Por isso, o templatepkg, o metapkg, o lspkg e o jail-update +funcionam normalmente. + +Para atualizar suas jaulas, o jail-upgrade checa antes qual a versão e arquitetura de cada uma +de suas jaulas através do /etc/slackware-version correspondente e a partir disso aplica os patches +da arquitetura e versão da mesma, usando para isso o simplaret (veja a documentação própria). + +Desse modo, mesmo que você tenha jaulas de versões e arquiteturas diversas, usar o comando "jail-upgrade" +faz a atualização sem problemas, desde que seus patches estejam organizados por arquitetura e versão, +conforme é detalhado na documentação do simplaret, em http://slack.sarava.org/node/16. + +Aplicativos auxiliares: rebuildpkg e createpkg +---------------------------------------------- + +O simplepkg acompanha ainda um aplicativo auxiliar que ajuda a recuperar pacotes instalados cujo tgz original +foi perdido. O comando rebuildpkg reconstrói um pacote a partir de uma entrada no /var/log/packages. O comando + + rebuildpkg coreutils + +reconstrói um pacote do coreutils usando os arquivos e as metainformações listadas no arquivo +do /var/log/packages/ correspondente ao coreutils. + +Se você quiser construir seus próprios pacotes baseados nos slackbuilds disponíveis em +http://slack.sarava.org/slackbuilds, basta utilizar o createpkg: + + createpkg nome-do-pacote + +Fonte +----- + +Se você quiser obter diretamente o código-fonte do simplepkg, baixe-o do repositório: + + svn checkout svn://slack.sarava.org/simplepkg + diff --git a/branches/0.6/doc/README.simplaret b/branches/0.6/doc/README.simplaret new file mode 100644 index 0000000..ce7efbd --- /dev/null +++ b/branches/0.6/doc/README.simplaret @@ -0,0 +1,143 @@ +simplaret: simplepkg retrieval tool +----------------------------------- + +Simplaret is a simplepkg tool used to download packages from local and remote repositories. +With simplaret, one can grab packages for all archictectures and versions of slackware-like +distributions that follows the mirror guidelines, allowing an easy management all +jails and slackware installations in a machine, no matter wich arquiteture or version +each one has. + +It was inspired in swaret behavior but don't tries to get its complexity level, but +execute package download in a different way, where the local repository is organized +by archictecture and version. It can also search for packages. + +Documentation +------------- + +The always updated english documentation is hosted at http://slack.sarava.org/node/17 + +Downloading and installing +-------------------------- + +Simplaret comes with simplepkg, wich installation and configuration is detailed +at http://slack.sarava.org/node/15. Simplaret uses /etc/simplepkg/simplepkg.conf for +its definitions and /etc/simplepkg/repos.conf for repository information. + +Repository organization +----------------------- + +Simplaret local storage folder is defined through STORAGE parameter and is organized +in this manner: + + $STORAGE/arch/version/ + +Packages from contributed repositories (i.e, not from an official distro mirror) are +stored at + + $STORAGE/arch/version/repository-name/ + +This means, for example, that slack 10.2 packages are located in + + $STORAGE/i386/10.2/ + +And the slack.sarava.org's slamd64 packages can be stored in a place such as + + $STORAGE/x86_64/10.2/slack.sarava.org/ + +In the repository definition file (/etc/simplepkg/repos.conf), the entries must match +the following schema, something that remembers a swaret.conf: + + ROOT-i386="http://slack.sarava.org/slackware/" + ROOT-x86_64="http://ftp.heanet.ie/pub/slamd64/" + REPOS-i386-10.2="slack.sarava.org%http://slack.sarava.org/packages/slackware/slackware-10.2/" + REPOS-x86_64-10.2="slack.sarava.org%http://slack.sarava.org/packages/slamd64/slamd64-10.2/" + +Repositories defined as ROOT are those wich + + - Have packages from the official distro or + - Are organized by version according to the mirror guidelines + +Repositories defined as REPOS are those containing packages from a specific version or +non-oficial packages. + +When simplaret searches for a package, precedence is given first for ROOT definitions and then +for REPOS ones. REPOS definitions should also include a identification name, delimited from +the repository URL by the special sign %. + +Fetching the package list +------------------------- + +After configured, simplaret can fetch the package list with + + simplaret --update + +This updates the package list from arch defined in DEFAULT_ARCH and version from DEFAULT_VERSION. +To fetch package listings for x86_64 (slamd64) and version 10.2, use + + ARCH=x86_64 VERSION=10.2 simplaret --update + +Searching +--------- + +To search for a package, use the following commands as examples: + + simplaret --search coreutils + +for a Slack/390 package, + + ARCH=s390 simplaret --search x11 + +for slack 10.1 with contributed i686 packages, + + ARCH=i686 VERSION=10.1 simplaret --search icecast + +Downloading +----------- + +To download a package, + + simplaret --get icecast + +Simplaret downloads the first package found with the precedence explaned above. +Future versions should contain an option to explicit get a package from a +specific repository. + +Downloading patches +------------------- + +From the PATCHES_DIR parameter is possible to specify a folder where patches are +placed, sorted by arch and version. + +Patches for slack 10.2 are always located at + + $PATCHES_DIR/i386/10.2/ + +In reality, patches are downloaded with a "simplaret --get" and stored in the $STORAGE +subfolder for its arch and version and a symlink is created in $PATCHES_DIR/$ARCH/$VERSION. + +To grab all patches from an arch and version, use + + ARCH=architecture VERSION=version simplaret --get-patches + +Purging the cache +----------------- + +Simplaret cache from an arch and version can be purged with a + + simplaret --purge + +But why use that? +----------------- + +You may ask why someone wishes to use such tool. + +Simplaret was written with a *x86 environment in mind, where lots of jails with different archs +and versions are installed. Suppose a x86_64 with the following chroots installed: + + - slamd64 10.2 + - slackware 10.2 + - slackware 10.1 with additional i686 packages + - uSlack (i386 uClibc) + +Keep all this stuff update manually is really a headache. Simplaret just tries to make it trivial. + diff --git a/branches/0.6/doc/README.simplaret.pt_BR b/branches/0.6/doc/README.simplaret.pt_BR new file mode 100644 index 0000000..7b1cd58 --- /dev/null +++ b/branches/0.6/doc/README.simplaret.pt_BR @@ -0,0 +1,148 @@ +simplaret: ferramenta para obtenção de pacotes +---------------------------------------------- + +O simplaret é a ferramenta do simplepkg utilizada para obter pacotes de repositórios locais +ou remotos. Com ele, você pode não só baixar pacotes do seu sistema slackware como também pode +baixar de qualquer versão ou arquitetura cujo repositório siga os Mirror Guidelines do slackware, +permitindo que você gerencie facilmente todas as suas jaulas e instalações de slackware, +independentemente da arquitetura ou versão que elas utilizem. + +Ele foi inspirado no comportamento do swaret mas não pretende de modo algum chegar no nível de +complexidade deste, mas sim executar a obtenção de pacotes de um modo diferente. Sua finalidade +é apenas baixar pacotes para que os aplicativos do simplepkg possam utilizá-lo posteriormente. +O simplaret ainda pode ser usado sozinho para procurar e baixar pacotes. + +Documentação +------------ + +A documentação atualizada do simplaret se encontra em http://slack.sarava.org/node/16 + +Obtendo e instalando +-------------------- + +O simplaret acompanha o simplepkg e por isso sua instalação e configuração é dada no artigo do simplepkg. +Ele utiliza o mesmo arquivo de configuração do simplepkg, o /etc/simplepkg/simplepkg.conf e guarda as +definições de repositórios em /etc/simplepkg/repos.conf. + +Organização do repositório +-------------------------- + +O repositório de armazenamento local do simplaret é definido pelo parâmetro STORAGE e é organizado +da seguinte maneira: + + $STORAGE/arch/version/ + +Pacotes obtidos num repositório que não seja oficial da distribuição ficam em + + $STORAGE/arch/version/repository-name/ + +Isso quer dizer, por exemplo, que pacotes do slackware 10.2 ficariam em + + $STORAGE/i386/10.2/ + +e os pacotes obtidos a partir do repositório slamd64 do slack.sarava.org ficaria, por exemplo, em + + $STORAGE/x86_64/10.2/slack.sarava.org/ + +No arquivo de repositórios (/etc/simplepkg/repos.conf), as definições de repositório seguem o +seguinte esquema, semelhante ao formato de configuração do swaret: + + ROOT-i386="http://slack.sarava.org/slackware/" + ROOT-x86_64="http://ftp.heanet.ie/pub/slamd64/" + REPOS-i386-10.2="slack.sarava.org%http://slack.sarava.org/packages/slackware/slackware-10.2/" + REPOS-x86_64-10.2="slack.sarava.org%http://slack.sarava.org/packages/slamd64/slamd64-10.2/" + +Repositórios definidos como ROOT são aqueles que + + - Possuem pacotes da distribuição oficial ou + - Estão organizados por versão, de acordo com os mirror guidelines + +Já os repositórios definidos como REPOS são aqueles que contém pacotes para uma versão específica e/ou +que são não-oficiais. + +Quando o simplaret busca ou obtém um pacote, a precedência pelos repositórios é dada às definições de +ROOT e em seguinda às de REPOS. As definições REPOS ainda devem possuir, além da URL do repositório, um +nome para identificá-lo, sendo que esses dois campos são separados por um delimitador. + +Baixando as listas de pacotes +----------------------------- + +Após configurá-lo, é preciso atualizar a lista de pacotes: + + simplaret --update + +Isso atualiza a lista de pacotes da arquitetura definida em DEFAULT_ARCH e da versão DEFAULT_VERSION +apenas. Se você quiser forçar a atualização, por exemplo, para a arquitetura x86_64 (slamd64) +e versão 10.2, basta + + ARCH=x86_64 VERSION=10.2 simplaret --update + +Buscando pacotes +---------------- + +Para buscar um pacote, esses comandos servem de exemplo: + + simplaret --search coreutils + +pacote para o Slack/390, + + ARCH=s390 simplaret --search x11 + +e para slackware 10.1 com pacotes adicionais em i686, + + ARCH=i686 VERSION=10.1 simplaret --search icecast + +Baixando um pacote +------------------ + +Para baixar um pacote: + + simplaret --get icecast + +O simplaret baixa o primeiro pacote na ordem de precedência dos repositórios. +Versões futuras deverão conter uma opção que force a obtenção do pacote de um +repositório específico. + +Baixando patches +---------------- + +Através do parâmetro de configuração PATCHES_DIR é possível especificar uma pasta +onde os patches de cada distribuição serão armazenados, organizados também por arquitetura. + +Por exemplo, patches do slackware 10.2 ficarão sempre em + + $PATCHES_DIR/i386/10.2/ + +Os patches na verdade são baixados através de um "simplaret --get" e armazenados na subpasta +de $STORAGE correspondente e apenas um link simbólico é mantido em $PATCHES_DIR/$ARCH/$VERSION. + +Para baixar os patches, use uma chamada do tipo + + ARCH=arquitetura VERSION=versao simplaret --get-patches + +E os patches dessa arquitetura e versão serão baixados. + +Apagando pacotes +---------------- + +O repositório de pacotes de uma arquitetura e versão pode ser apagado com o comando + + simplaret --purge + +Mas pra quê serve isso? +----------------------- + +Você pode estar se perguntando: quem utilizaria uma ferramenta que baixa pacotes de várias arquiteturas? + +O simplaret foi escrito tendo em mente um ambiente *86 onde várias jaulas de diferentes arquiteturas estão +instaladas. Suponha por exemplo uma máquina x86_64 que possua as seguintes jaulas: + + - slamd64 11.0 + - slackware 11.0 + - slackware 11.0 com pacotes adicionais em i686 + - ucslack (uClibc para i386) + +O condenado/a em questão que roda todas essas jaulas, pelos mais diversos motivos, pode ter uma grande dor +de cabeça para manter os pacotes em ordem de forma manual. Com o simplaret e eventualmente com o simplepkg, +a tarefa se torna trivial. + diff --git a/branches/0.6/doc/TODO b/branches/0.6/doc/TODO new file mode 100644 index 0000000..9178f6e --- /dev/null +++ b/branches/0.6/doc/TODO @@ -0,0 +1,5 @@ +simplepkg todo list +------------------- + +TODO list at http://slack.sarava.org/wiki/Main/SimplePKG + diff --git a/branches/0.6/doc/simplepkg.aux b/branches/0.6/doc/simplepkg.aux new file mode 100644 index 0000000..ad47a5f --- /dev/null +++ b/branches/0.6/doc/simplepkg.aux @@ -0,0 +1,30 @@ +\relax +\catcode`"\active +\ifx\hyper@anchor\@undefined +\global \let \oldcontentsline\contentsline +\gdef \contentsline#1#2#3#4{\oldcontentsline{#1}{#2}{#3}} +\global \let \oldnewlabel\newlabel +\gdef \newlabel#1#2{\newlabelxx{#1}#2} +\gdef \newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}} +\AtEndDocument{\let \contentsline\oldcontentsline +\let \newlabel\oldnewlabel} +\else +\global \let \hyper@last\relax +\fi + +\select@language{brazilian} +\@writefile{toc}{\select@language{brazilian}} +\@writefile{lof}{\select@language{brazilian}} +\@writefile{lot}{\select@language{brazilian}} +\newlabel{start}{{}{1}{\relax }{}{}} +\@writefile{toc}{\contentsline {section}{\numberline {1}Descri\c c\~ao}{1}{section.1}} +\@writefile{toc}{\contentsline {section}{\numberline {2}Arquitetura}{2}{section.2}} +\@writefile{toc}{\contentsline {section}{\numberline {3}Instalando o simplepkg}{2}{section.3}} +\@writefile{toc}{\contentsline {section}{\numberline {4}Configurando o simplepkg}{3}{section.4}} +\@writefile{toc}{\contentsline {section}{\numberline {5}Criando jaulas e replicando instala\c c\~oes}{3}{section.5}} +\@writefile{toc}{\contentsline {section}{\numberline {6}Metapacotes}{4}{section.6}} +\@writefile{toc}{\contentsline {section}{\numberline {7}Upgrade de jaulas}{5}{section.7}} +\@writefile{toc}{\contentsline {section}{\numberline {8}Arquiteturas e vers\~oes diferentes}{5}{section.8}} +\@writefile{toc}{\contentsline {section}{\numberline {9}Aplicativo auxiliar: rebuildpkg}{6}{section.9}} +\@writefile{toc}{\contentsline {section}{\numberline {10}Fonte}{6}{section.10}} +\@writefile{toc}{\contentsline {section}{\numberline {11}P\'agina de desenvolvimento}{6}{section.11}} diff --git a/branches/0.6/doc/simplepkg.dvi b/branches/0.6/doc/simplepkg.dvi new file mode 100644 index 0000000..2779fbe Binary files /dev/null and b/branches/0.6/doc/simplepkg.dvi differ diff --git a/branches/0.6/doc/simplepkg.html b/branches/0.6/doc/simplepkg.html new file mode 100644 index 0000000..85b2b06 --- /dev/null +++ b/branches/0.6/doc/simplepkg.html @@ -0,0 +1,201 @@ +O simplepkg é um sistema de gerenciamento de pacotes que roda sobre o pkgtool e o swaret. Ele trabalha com templates -- listas com pacotes instalados, scripts e arquivos de configuração -- permitindo criar perfis de instalação que podem ser então usados para instalar o sistema numa outra partição, criar um chroot específico ou até trabalhar com o conceito de metapacotes: uma lista de pacotes que pode ser instalada e removida com apenas um comando. + +Descrição + +Todas as distribuições de GNU/Linux já tem algum sistema de empacotamento amadurecido. A questão agora é a praticidade de instalar e controlar o que está instalado, tanto pacotes como arquivos de configuração de uma máquina. + +Imagine por exemplo se você precisa manter uma lista de pacotes de 200 máquinas slackware, sendo que algumas são usadas como desktop, outras como servidores web, alguma sendo o servidor de email e assim por diante. Imagine agora que você perca o disco de algumas dessas máquinas ou que precise cotidianamente reinstalar ou atualizar um sistema. + +Usar o cd de instalação do slackware e configurar na mão toda a vez que der um pau faria com que você ficasse louco/a e desperdiçasse muito tempo, além do que sempre ocorre de esquecermos algum detalhe ou pacote durante a configuração do sistema. Manter um backup completo de cada máquina, por outro lado, pode ser muito custoso se o número delas for muito grande. + +O simplepkg permite que você mantenha um template para cada grupo de máquinas e com apenas um comando instalar o template numa partição. Além do template, você precisa do swaret configurado para os repositórios de pacote que possuem seus aplicativos. + +Gerenciar instalações e metapacotes não é tudo o que o simplepkg faz. Ele pode ser usado até na criação de vservers. O simplepkg inclusive é um amadurecimento de idéias delineadas nos seguintes artigos: + +- Rodando o OpenOffice.org em chroot no Slamd64 +- Linux Vservers e segurança por contexto +- Instalando o Slackware sem programa de instalação + +O simplepkg permite que o trampo proposto nos artigos acima seja simplificado a uma meia dúzia de comandos, desde que existam templates prontos. + +Arquitetura + +O simplepkg é um conjunto de scripts escritos com a filosofia KISS em mente. Ele é um sistema muito simples, composto pelos seguintes comandos: + +- mkjail: constrói uma jaula/instalação de slackware numa pasta +- metapkg: instala ou remove um metapacote +- templatepkg: criar ou adiciona pacotes a um template +- lspkg: lista pacotes instalados +- jail-upgrade: faz o upgrade nas jaulas +- rebuildpkg: reconstrói um pacote a partir de sua entrada no /var/log/packages + +A pasta de configuração e armazenamento de templates é a /etc/simplepkg. Templates são arquivos contendo uma lista de pacotes, um pacote por linha e com a extensão .template. Como exemplo, um template poderia se chamar minimo.template e conter a seguinte lista: + + +
+aaa_base
+aaa_elflibs
+apache
+bash
+bin
+coreutils
+findutils
+
+ +
 
 
 
 
 
 
  +Se você quiser também é possível usar um tagfile do slackware como template, sem nem precisar editá-lo. + +Instalando o simplepkg + +Para baixar o pacote do simplepkg, vá em http://slack.midiatatica.org/packages/noarch/. Depois de instalá-lo, não esqueça de configurar seu swaret: + +
+installpkg swaret-VERSAO-noarch-BUILD.tgz simplepkg-VERSAO-noarch-BUILD.tgz
+
+ +
  +Alternativamente, se você já está com o swaret instalado, adicione em seu swaret.conf a linha + +
+REPOS_ROOT=SlackMidiataticaNoarch%http://slack.midiatatica.org/packages/noarch
+
+ +
  +e então digite + +
+swaret --update
+swaret --install simplepkg
+
+ +
 
  +Configurando o simplepkg + +Como exemplo, vamos criar uma jaula baseada nos pacotes instalados no seu slackware. Edite o arquivo /etc/simplepkg/simplepkg.conf: + +
+# /etc/simplepkg/simplepkg.conf
+JAIL_ROOT="/vservers" # local onde as jaulas serão criadas
+SWARET_PACKS="/var/swaret" # local onde o swaret armazena seus pacotes
+SWARET_CLEAN="1" # apaga o cache de pacotes antes da instalação da jaula
+SWARET_DELETE_DOWN="1" # apaga o cache de pacotes após a instalação
+SWARET_UPDATE="0" # executa um swaret --update antes de iniciar a instalação da jaula
+SWARET_PURGE_WEEKS="N" # apaga os pacotes do cache mais velhos que N semanas antes de instalar
+PATCHES_DIR="/var/swaret/patches" # local os patches são armazenados
+
+ +
 
 
 
 
 
 
 
 
  +O swaret.conf deve estar bem configurado para que ele seja capaz de baixar e instalar todos os pacotes dos templates. Parâmetros como EXCLUDE podem ser um empecilho, e se você os remover da sua instalação tenha muito cuidado ao atualizar o seu sistema via swaret --upgrade. + +Criando jaulas e replicando instalações + +
+templatepkg meu-slackware
+mkjail jaula meu-slackware
+
+ +
 
  +Isso cria o template meu-slackware a partir da sua lista de pacotes em /var/log/packages e cria uma nova árvore com esses pacotes na pasta /vservers/jaula (dependendo de qual o valor da variável JAIL_ROOT do simplepkg.conf, é claro). + +Se você quiser que alguns arquivos de configuração e executar scripts após a instalação dessa jaula, basta colocarmos na pasta /etc/simplepkg/meu-slackware.d/ os arquivos de configuração (dentro da hierarquia de pastas do sistema, isto é, /etc/simplepkg/meu-slackware.d/etc/apache/httpd.conf) e os script em /etc/simplepkg/meu-slackware.s/. O template vserver, que já vem no mkjail contém um exemplo de script. + +Você pode especificar também destinos alternativos para sua jaula, através de um comando do tipo + +
+ROOT=/mnt mkjail hda2 meu-slackware
+
+ +
  +O comando acima faz exatamente o que você está pensando: replica sua instalação slackware em /mnt/hda2, dispensando totalmente o programa de instalação do slackware! + +Caso nenhum template for especificado, o mkjail utiliza o template /etc/simplepkg/default.template. + +Se você manter uma jaula em JAIL_ROOT com o mesmo nome que um template, é possível ainda usar o script jail-update para copiar todas as alterações de arquivos da jaula na pasta de arquivos do seu template (/etc/simplepkg/nome-da-jaula.d). Assim, basta que você copie todos os arquivos de configuração que você editou para essa pasta e deixar o jail-update numa crontab para que você tenha sempre um template atualizado e baseado nas jaulas / instalações que você tem rodando e que estiverem listadas no arquivo /etc/simplepkg/jailist: + +
+jail-update
+
+ +
  +O jail-update considera que o template main, caso exista, se refere à instalação principal da sua máquina, isto é, o sistema de você roda. Dessa forma a invocação do jail-update atualiza todos os templates cujas jaulas estão em JAIL_ROOT e ainda atualiza o template da instalação principal. + +Para adicionar ou remover pacotes de um template, basta editar o arquivo de template. Uma outra forma de adicionar arquivos é usando o templatepkg com a opção -a, que adiciona apenas novos pacotes ao template. Se você quiser que o templatepkg crie um template a partir de uma jaula, simplesmente use + +
+templatepkg jaula /vservers/jaula
+
+ +
  +Metapacotes + +Outro uso dos templates é a criação de pacotes: imagine por exemplo a dificuldade de um usuário/a novo de slackware para instalar o cinelerra e todas as suas dependências. Criando um template contendo o nome de todos os pacotes necessários para rodar esse software permite que um usuário instale-o simplesmente com o comando + +
+metapkg --install cinelerra
+
+ +
  +O comando sugere uma semelhança com o uso direto do swaret ou do slapt-get, com a única diferença residindo no modo como cada um desses programas lida com as dependências de um pacote. Os slapt-get suporta o arquivo slack-required, que pode ou não estar presente no pacote. Já o swaret possui uma ferramenta própria para a criação de uma lista de dependências. + +O simplepkg não pretende substituir esses dois modos de checagem e sim propor uma alternativa de distribuição de pacotes em que as dependências são resolvidas sem precisar de um repositório de dependências ou uma modificação no próprio pacote, que é o caso do slack-required, um arquivo que na maioria das vezes não está presente. + +A remoção de um aplicativo e todas as suas dependências podem ser feitas simplesmente com o comando + +
+metapkg --remove cinelerra
+
+ +
  +Upgrade de jaulas + +O upgrade de jaulas que estejam em JAIL_ROOT pode ser efetuado com o comando jail-upgrade. Simplesmente coloque os patches em PATCHES_DIR e dê o comando + +
+jail-upgrade
+
+ +
  +Se você quiser atualizar apenas uma das jaulas que estão em JAIL_ROOT, use + +
+jail-upgrade nome-da-jaula
+
+ +
  +Para especificar uma pasta contendo patches diferente de PATCHES_DIR (útil quando você possui jaulas com diferentes versões do slackware), simplesmente use + +
+PATCHES=/local/dos/patches jail-upgrade nome-da-jaula
+
+ +
  +De modo análogo ao mkjail, é possível indicar ao jail-upgrade uma outra pasta onde a jaula está armazenada: + +
+ROOT=/otherroot jail-upgrade
+
+ +
  +Aplicativo auxiliar: rebuildpkg + +O simplepkg acompanha ainda um aplicativo auxiliar que ajuda a recuperar pacotes instalados cujo tgz original foi perdido. O comando rebuildpkg reconstrói um pacote a partir de uma entrada no /var/log/packages. O comando + +
+rebuildpkg coreutils
+
+ +
  +reconstrói um pacote do coreutils usando os arquivos e as metainformações listadas no arquivo do /var/log/packages/ correspondente ao coreutils. + +Fonte + +Se você quiser obter diretamente o código-fonte do simplepkg, baixe-o do repositório: + +
+svn checkout svn://slack.midiatatica.org:40/simplepkg
+
+ +
  +Página de desenvolvimento + +A página de desenvolvimento do simplepkg fica aqui. diff --git a/branches/0.6/doc/simplepkg.log b/branches/0.6/doc/simplepkg.log new file mode 100644 index 0000000..c6a55ef --- /dev/null +++ b/branches/0.6/doc/simplepkg.log @@ -0,0 +1,286 @@ +This is TeX, Version 3.14159 (Web2C 7.4.5) (format=latex 2005.1.14) 10 FEB 2006 12:19 +**simplepkg.tex +(./simplepkg.tex +LaTeX2e <2001/06/01> +Babel and hyphenation patterns for american, french, german, ngerman, n +ohyphenation, loaded. +(/usr/share/texmf/tex/latex/base/article.cls +Document Class: article 2001/04/21 v1.4e Standard LaTeX document class +(/usr/share/texmf/tex/latex/base/size10.clo +File: size10.clo 2001/04/21 v1.4e Standard LaTeX file (size option) +) +\c@part=\count79 +\c@section=\count80 +\c@subsection=\count81 +\c@subsubsection=\count82 +\c@paragraph=\count83 +\c@subparagraph=\count84 +\c@figure=\count85 +\c@table=\count86 +\abovecaptionskip=\skip41 +\belowcaptionskip=\skip42 +\bibindent=\dimen102 +) +(/usr/share/texmf/tex/generic/babel/babel.sty +Package: babel 2001/03/01 v3.7h The Babel package + +(/usr/share/texmf/tex/generic/babel/portuges.ldf +Language: portuges 2001/02/16 v1.2o Portuguese support from the babel system + +(/usr/share/texmf/tex/generic/babel/babel.def +File: babel.def 2001/03/01 v3.7h Babel common definitions +\babel@savecnt=\count87 +\U@D=\dimen103 +) + +Package babel Warning: No hyphenation patterns were loaded for +(babel) the language `Portuguese' +(babel) I will use the patterns loaded for \language=0 instead. + +\l@portuges = a dialect from \language0 +\l@brazilian = a dialect from \language\l@portuges +Package babel Info: Making " an active character on input line 126. +)) (/usr/share/texmf/tex/latex/base/inputenc.sty +Package: inputenc 2001/07/10 v0.99a Input encoding file + +(/usr/share/texmf/tex/latex/base/latin1.def +File: latin1.def 2001/07/10 v0.99a Input encoding file +)) +(/usr/share/texmf/tex/latex/graphics/graphics.sty +Package: graphics 2001/07/07 v1.0n Standard LaTeX Graphics (DPC,SPQR) + +(/usr/share/texmf/tex/latex/graphics/trig.sty +Package: trig 1999/03/16 v1.09 sin cos tan (DPC) +) +(/usr/share/texmf/tex/latex/config/graphics.cfg +File: graphics.cfg 2001/08/31 v1.1 graphics configuration of teTeX/TeXLive +) +Package graphics Info: Driver file: dvips.def on input line 80. + +(/usr/share/texmf/tex/latex/graphics/dvips.def +File: dvips.def 1999/02/16 v3.0i Driver-dependant file (DPC,SPQR) +)) +(/usr/share/texmf/tex/latex/hyperref/hyperref.sty +Package: hyperref 2003/01/22 v6.73n Hypertext links for LaTeX + +(/usr/share/texmf/tex/latex/graphics/keyval.sty +Package: keyval 1999/03/16 v1.13 key=value parser (DPC) +\KV@toks@=\toks14 +) +\@linkdim=\dimen104 +\Hy@linkcounter=\count88 +\Hy@pagecounter=\count89 + +(/usr/share/texmf/tex/latex/hyperref/pd1enc.def +File: pd1enc.def 2003/01/22 v6.73n Hyperref: PDFDocEncoding definition (HO) +) +(/usr/share/texmf/tex/latex/config/hyperref.cfg +File: hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive and teTeX +) +Package hyperref Info: Hyper figures OFF on input line 1792. +Package hyperref Info: Link nesting OFF on input line 1797. +Package hyperref Info: Hyper index ON on input line 1800. +Package hyperref Info: Plain pages ON on input line 1805. +Package hyperref Info: Backreferencing OFF on input line 1812. + +Implicit mode ON; LaTeX internals redefined +Package hyperref Info: Bookmarks ON on input line 1916. +(/usr/share/texmf/tex/latex/html/url.sty +Package: url 1999/03/02 ver 1.4 Verb mode for urls, email addresses, and file + names +) +LaTeX Info: Redefining \url on input line 2055. +\Fld@menulength=\count90 +\Field@Width=\dimen105 +\Fld@charsize=\dimen106 +\Choice@toks=\toks15 +\Field@toks=\toks16 +Package hyperref Info: Hyper figures OFF on input line 2513. +Package hyperref Info: Link nesting OFF on input line 2518. +Package hyperref Info: Hyper index ON on input line 2521. +Package hyperref Info: backreferencing OFF on input line 2528. +Package hyperref Info: Link coloring OFF on input line 2533. +\c@Item=\count91 +\c@Hfootnote=\count92 +) +*hyperref using default driver hdvips* +(/usr/share/texmf/tex/latex/hyperref/hdvips.def +File: hdvips.def 2003/01/22 v6.73n Hyperref driver for dvips + +(/usr/share/texmf/tex/latex/hyperref/pdfmark.def +File: pdfmark.def 2003/01/22 v6.73n Hyperref definitions for pdfmark specials +\pdf@docset=\toks17 +\pdf@box=\box26 +\pdf@toks=\toks18 +\pdf@defaulttoks=\toks19 +\Fld@listcount=\count93 +\@outlinefile=\write3 +)) (./simplepkg.aux) +\openout1 = `simplepkg.aux'. + +LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 11. +LaTeX Font Info: ... okay on input line 11. +LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 11. +LaTeX Font Info: ... okay on input line 11. +LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 11. +LaTeX Font Info: ... okay on input line 11. +LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 11. +LaTeX Font Info: ... okay on input line 11. +LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 11. +LaTeX Font Info: ... okay on input line 11. +LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 11. +LaTeX Font Info: ... okay on input line 11. +LaTeX Font Info: Checking defaults for PD1/pdf/m/n on input line 11. +LaTeX Font Info: ... okay on input line 11. +Package hyperref Info: Link coloring OFF on input line 11. + +(/usr/share/texmf/tex/latex/hyperref/nameref.sty +Package: nameref 2001/01/27 v2.19 Cross-referencing by name of section +\c@section@level=\count94 +) +LaTeX Info: Redefining \ref on input line 11. +LaTeX Info: Redefining \pageref on input line 11. + (./simplepkg.out) +(./simplepkg.out) +\openout3 = `simplepkg.out'. + +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <12> on input line 13. +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <8> on input line 13. +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <6> on input line 13. +LaTeX Font Info: Try loading font information for OMS+cmr on input line 31. + (/usr/share/texmf/tex/latex/base/omscmr.fd +File: omscmr.fd 1999/05/25 v2.5h Standard LaTeX font definitions +) +LaTeX Font Info: Font shape `OMS/cmr/m/n' in size <10> not available +(Font) Font shape `OMS/cmsy/m/n' tried instead on input line 31. + [1 + +] +Overfull \hbox (15.53741pt too wide) in paragraph at lines 48--49 +[]\OT1/cmr/m/n/10 rebuildpkg: re-con-str^^Soi um pa-cote a par-tir de sua en-tr +ada no \OT1/cmr/m/it/10 /var/log/packages + [] + + +Overfull \hbox (40.63974pt too wide) in paragraph at lines 68--69 +\OT1/cmr/m/n/10 Para baixar o pa-cote do sim-plepkg, v^^Sa em http://slack.midi +atatica.org/packages/noarch/. + [] + + +Overfull \hbox (64.49643pt too wide) in paragraph at lines 78--78 +[]\OT1/cmtt/m/n/10 REPOS_ROOT=SlackMidiataticaNoarch%http://slack.midiatatica.o +rg/packages/noarch[] + [] + +[2] +Overfull \hbox (122.24593pt too wide) in paragraph at lines 101--101 +[]\OT1/cmtt/m/n/10 SIMPLARET="simplaret" # programa que baixa os pacotes (pode +ser o swaret se voce o tiver)[] + [] + + +Overfull \hbox (11.99689pt too wide) in paragraph at lines 101--101 +[]\OT1/cmtt/m/n/10 STORAGE="/var/simplaret" # local onde o swaret armazena seus + pacotes[] + [] + + +Overfull \hbox (48.74657pt too wide) in paragraph at lines 101--101 +[]\OT1/cmtt/m/n/10 SIMPLARET_CLEAN="1" # apaga o cache de pacotes antes da inst +ala^^Xc~ao da jaula[] + [] + + +Overfull \hbox (22.4968pt too wide) in paragraph at lines 101--101 +[]\OT1/cmtt/m/n/10 SIMPLARET_DELETE_DOWN="1" # apaga o cache de pacotes ap^^Sos + a instala^^Xc~ao[] + [] + + +Overfull \hbox (132.74583pt too wide) in paragraph at lines 101--101 +[]\OT1/cmtt/m/n/10 SIMPLARET_UPDATE="0" # atualiza as listas de pacotes antes d +e iniciar a instala^^Xc~ao da jaula[] + [] + + +Overfull \hbox (116.99597pt too wide) in paragraph at lines 101--101 +[]\OT1/cmtt/m/n/10 SIMPLARET_PURGE_WEEKS="N" # apaga os pacotes mais velhos que + N semanas antes de instalar[] + [] + + +Overfull \hbox (27.74675pt too wide) in paragraph at lines 101--101 +[]\OT1/cmtt/m/n/10 PATCHES_DIR="/var/simplaret/patches" # local os patches s~ao + armazenados[] + [] + + +Overfull \hbox (77.7997pt too wide) in paragraph at lines 103--104 +[]\OT1/cmr/m/n/10 Para definir quais reposit^^Sorios de pa-cotes voc^e usar^^Sa +, edite o ar-quivo \OT1/cmr/m/it/10 /etc/simplepkg/repos.conf\OT1/cmr/m/n/10 , + [] + + +Overfull \hbox (64.49643pt too wide) in paragraph at lines 110--110 +[]\OT1/cmtt/m/n/10 REPOS-i386="slack-midiatatica%http://slack.midiatatica.org/p +ackages/slackware"[] + [] + + +Overfull \hbox (90.7462pt too wide) in paragraph at lines 110--110 +[]\OT1/cmtt/m/n/10 REPOS-x86_64-10.2="slamd-midiatatica%http://slack.midiatatic +a.org/packages/slamd64"[] + [] + + +Overfull \hbox (16.50899pt too wide) in paragraph at lines 123--124 +\OT1/cmr/m/it/10 /var/log/packages \OT1/cmr/m/n/10 e cria uma nova ^^Sarvore co +m esses pa-cotes na pasta \OT1/cmr/m/it/10 /vservers/jaula + [] + + +Overfull \hbox (12.48833pt too wide) in paragraph at lines 125--126 +\OT1/cmr/m/n/10 in-stala^^Xc~ao dessa jaula, basta colo-car-mos na pasta \OT1/c +mr/m/it/10 /etc/simplepkg/meu-slackware.d/ + [] + + +Overfull \hbox (54.39502pt too wide) in paragraph at lines 125--126 +\OT1/cmr/m/it/10 /etc/simplepkg/meu-slackware.d/etc/apache/httpd.conf\OT1/cmr/m +/n/10 ) e os script em \OT1/cmr/m/it/10 /etc/simplepkg/meu- + [] + +[3] +Overfull \hbox (97.57161pt too wide) in paragraph at lines 135--136 +[]\OT1/cmr/m/n/10 Caso nen-hum tem-plate for es-peci-fi-cado, o \OT1/cmr/m/it/1 +0 mk-jail \OT1/cmr/m/n/10 uti-liza o tem-plate \OT1/cmr/m/it/10 /etc/simplepkg/ +default.template\OT1/cmr/m/n/10 . + [] + +[4] [5] +Overfull \hbox (13.77249pt too wide) in paragraph at lines 231--232 +\OT1/cmr/m/n/10 Se voc^e quiser obter di-re-ta-mente o c^^Sodigo-fonte do \OT1/ +cmr/m/it/10 sim-plepkg\OT1/cmr/m/n/10 , baixe-o do reposit^^Sorio: + [] + + +Overfull \hbox (17.25352pt too wide) in paragraph at lines 239--240 +\OT1/cmr/m/n/10 A p^^Sagina do \OT1/cmr/m/it/10 sim-plepkg \OT1/cmr/m/n/10 fica + em [][][][]. + [] + +[6] (./simplepkg.aux) ) +Here is how much of TeX's memory you used: + 2420 strings out of 95847 + 32073 string characters out of 1195948 + 90698 words of memory out of 1000001 + 5358 multiletter control sequences out of 10000+50000 + 8746 words of font info for 31 fonts, out of 500000 for 1000 + 14 hyphenation exceptions out of 1000 + 25i,6n,36p,605b,344s stack positions out of 1500i,500n,5000p,200000b,5000s + +Output written on simplepkg.dvi (6 pages, 25288 bytes). diff --git a/branches/0.6/doc/simplepkg.out b/branches/0.6/doc/simplepkg.out new file mode 100644 index 0000000..4839e4e --- /dev/null +++ b/branches/0.6/doc/simplepkg.out @@ -0,0 +1,11 @@ +\BOOKMARK [1][-]{section.1}{Descri\347\343o}{} +\BOOKMARK [1][-]{section.2}{Arquitetura}{} +\BOOKMARK [1][-]{section.3}{Instalando o simplepkg}{} +\BOOKMARK [1][-]{section.4}{Configurando o simplepkg}{} +\BOOKMARK [1][-]{section.5}{Criando jaulas e replicando instala\347\365es}{} +\BOOKMARK [1][-]{section.6}{Metapacotes}{} +\BOOKMARK [1][-]{section.7}{Upgrade de jaulas}{} +\BOOKMARK [1][-]{section.8}{Arquiteturas e vers\365es diferentes}{} +\BOOKMARK [1][-]{section.9}{Aplicativo auxiliar: rebuildpkg}{} +\BOOKMARK [1][-]{section.10}{Fonte}{} +\BOOKMARK [1][-]{section.11}{P\341gina de desenvolvimento}{} diff --git a/branches/0.6/doc/simplepkg.pdf b/branches/0.6/doc/simplepkg.pdf new file mode 100644 index 0000000..9895ebb Binary files /dev/null and b/branches/0.6/doc/simplepkg.pdf differ diff --git a/branches/0.6/doc/simplepkg.tex b/branches/0.6/doc/simplepkg.tex new file mode 100644 index 0000000..7c98e54 --- /dev/null +++ b/branches/0.6/doc/simplepkg.tex @@ -0,0 +1,241 @@ +\documentclass{article} +\usepackage[brazilian]{babel} +\usepackage[latin1]{inputenc} +\usepackage[dvips]{graphics} +\usepackage{hyperref} +\newcommand\link{\hyperlink} + +\title{Gerenciamento de instalações e metapacotes com o simplepkg} +\author{Silvio Rhatto} + +\begin{document}\label{start} +\maketitle + +\begin{abstract} +O \emph{simplepkg} é um sistema de gerenciamento de pacotes que roda sobre o \emph{pkgtool}. Ele trabalha com templates -- listas com pacotes instalados, scripts e arquivos de configuração -- permitindo criar perfis de instalação que podem ser então usados para instalar o sistema numa outra partição, criar um chroot específico ou até trabalhar com o conceito de \emph{metapacotes}: uma lista de pacotes que pode ser instalada e removida com apenas um comando. +\end{abstract} + +\section{Descrição} + +Todas as distribuições de GNU/Linux já tem algum sistema de empacotamento amadurecido. A questão agora é a praticidade de instalar e controlar o que está instalado, tanto pacotes como arquivos de configuração de uma máquina. + +Imagine por exemplo se você precisa manter uma lista de pacotes de 200 máquinas slackware, sendo que algumas são usadas como desktop, outras como servidores web, alguma sendo o servidor de email e assim por diante. Imagine agora que você perca o disco de algumas dessas máquinas ou que precise cotidianamente reinstalar ou atualizar um sistema. + +Usar o cd de instalação do slackware e configurar na mão toda a vez que der um pau faria com que você ficasse louco/a e desperdiçasse muito tempo, além do que sempre ocorre de esquecermos algum detalhe ou pacote durante a configuração do sistema. Manter um backup completo de cada máquina, por outro lado, pode ser muito custoso se o número delas for muito grande. + +O simplepkg permite que você mantenha um template para cada grupo de máquinas e com apenas um comando instalar o template numa partição. Além do template, você precisa do \emph{swaret} configurado para os repositórios de pacote que possuem seus aplicativos. + +Gerenciar instalações e metapacotes não é tudo o que o simplepkg faz. Ele pode ser usado até na criação de \emph{vservers}. O simplepkg inclusive é um amadurecimento de idéias delineadas nos seguintes artigos: + +\begin{itemize} + \item \link{/node/3}{Rodando o OpenOffice.org em chroot no Slamd64} + \item \link{/node/6}{Criando Vservers em Slackware} + \item \link{/node/7}{Instalando o Slackware sem programa de instalação} +\end{itemize} + +O \emph{simplepkg} permite que o trampo proposto nos artigos acima seja simplificado a uma meia dúzia de comandos, desde que existam templates prontos. + +\section{Arquitetura} + +O \emph{simplepkg} é um conjunto de scripts escritos com a filosofia KISS em mente. Ele é um sistema muito simples, composto pelos seguintes comandos: + +\begin{itemize} + \item mkjail: constrói uma jaula/instalação de slackware numa pasta + \item metapkg: instala ou remove um metapacote + \item templatepkg: criar ou adiciona pacotes a um template + \item lspkg: lista pacotes instalados + \item jail-upgrade: faz o upgrade nas jaulas + \item rebuildpkg: reconstrói um pacote a partir de sua entrada no \emph{/var/log/packages} + \item simplaret: obtém pacotes de repositórios locais ou remotos +\end{itemize} + +A pasta de configuração e armazenamento de templates é a \emph{/etc/simplepkg}. Templates são arquivos contendo uma lista de pacotes, um pacote por linha e com a extensão \emph{.template}. Como exemplo, um template poderia se chamar \emph{minimo.template} e conter a seguinte lista: + +\begin{verbatim} +aaa_base +aaa_elflibs +apache +bash +bin +coreutils +findutils +\end{verbatim} + +Se você quiser também é possível usar um \emph{tagfile} do slackware como template, sem nem precisar editá-lo. + +\section{Instalando o simplepkg} + +Para baixar o pacote do simplepkg, vá em http://slack.midiatatica.org/packages/noarch/. Depois de instalá-lo. + +\begin{verbatim} +installpkg simplepkg-VERSAO-noarch-BUILD.tgz +\end{verbatim} + +Alternativamente, se você usa o swaret, adicione em seu \emph{swaret.conf} a linha + +\begin{verbatim} +REPOS_ROOT=SlackMidiataticaNoarch%http://slack.midiatatica.org/packages/noarch +\end{verbatim} + +e então digite + +\begin{verbatim} +swaret --update +swaret --install simplepkg +\end{verbatim} + +\section{Configurando o simplepkg} + +Como exemplo, vamos criar uma jaula baseada nos pacotes instalados no seu slackware. Edite o arquivo \emph{/etc/simplepkg/simplepkg.conf}: + +\begin{verbatim} +# /etc/simplepkg/simplepkg.conf +JAIL_ROOT="/vservers" # local onde as jaulas serão criadas +SIMPLARET="simplaret" # programa que baixa os pacotes (pode ser o swaret se voce o tiver) +STORAGE="/var/simplaret" # local onde o swaret armazena seus pacotes +SIMPLARET_CLEAN="1" # apaga o cache de pacotes antes da instalação da jaula +SIMPLARET_DELETE_DOWN="1" # apaga o cache de pacotes após a instalação +SIMPLARET_UPDATE="0" # atualiza as listas de pacotes antes de iniciar a instalação da jaula +SIMPLARET_PURGE_WEEKS="N" # apaga os pacotes mais velhos que N semanas antes de instalar +PATCHES_DIR="/var/simplaret/patches" # local os patches são armazenados +\end{verbatim} + +Para definir quais repositórios de pacotes você usará, edite o arquivo \emph{/etc/simplepkg/repos.conf}, colocando algo como + +\begin{verbatim} +ROOT-i386="http://slack.midiatatica.org/packages/slackware" +REPOS-i386="slack-midiatatica%http://slack.midiatatica.org/packages/slackware" +ROOT-x86_64-10.2="http://darkstar.ist.utl.pt/pub/slamd64/" +REPOS-x86_64-10.2="slamd-midiatatica%http://slack.midiatatica.org/packages/slamd64" +\end{verbatim} + +Se você quer utilizar o swaret em lugar do simplaret, o swaret.conf deve estar bem configurado para que ele seja capaz de baixar e instalar todos os pacotes dos templates. Parâmetros como \emph{EXCLUDE} podem ser um empecilho, e se você os remover da sua instalação tenha muito cuidado ao atualizar o seu sistema via \emph{swaret --upgrade}. A desvantagem de usar o swaret é que você não terá como administrar jaulas e instalações de múltiplas arquiteturas. + +Para informações detalhadas sobre o simplaret, consulte seu \link{/node/16}{artigo específico}. + +\section{Criando jaulas e replicando instalações} + +\begin{verbatim} +templatepkg meu-slackware +mkjail jaula meu-slackware +\end{verbatim} + +Isso cria o template \emph{meu-slackware} a partir da sua lista de pacotes em \emph{/var/log/packages} e cria uma nova árvore com esses pacotes na pasta \emph{/vservers/jaula} (dependendo de qual o valor da variável \emph{JAIL\_ROOT} do simplepkg.conf, é claro). + +Se você quiser que alguns arquivos de configuração e executar scripts após a instalação dessa jaula, basta colocarmos na pasta \emph{/etc/simplepkg/meu-slackware.d/} os arquivos de configuração (dentro da hierarquia de pastas do sistema, isto é, \emph{/etc/simplepkg/meu-slackware.d/etc/apache/httpd.conf}) e os script em \emph{/etc/simplepkg/meu-slackware.s}. O template \emph{vserver}, que já vem no mkjail, contém um exemplo de script. + +Você pode especificar também destinos alternativos para sua jaula, através de um comando do tipo + +\begin{verbatim} +ROOT=/mnt mkjail hda2 meu-slackware +\end{verbatim} + +O comando acima faz exatamente o que você está pensando: replica sua instalação slackware em \emph{/mnt/hda2}, dispensando totalmente o programa de instalação do slackware! + +Caso nenhum template for especificado, o \emph{mkjail} utiliza o template \emph{/etc/simplepkg/default.template}. + +Se você manter uma jaula em \emph{JAIL\_ROOT} com o mesmo nome que um template, é possível ainda usar o script \emph{jail-update} para copiar todas as alterações de arquivos da jaula na pasta de arquivos do seu template (\emph{/etc/simplepkg/nome-da-jaula.d}). Assim, basta que você copie todos os arquivos de configuração que você editou para essa pasta e deixar o \emph{jail-update} numa crontab para que você tenha sempre um template atualizado e baseado nas jaulas / instalações que você tem rodando e que estiverem listadas no arquivo \emph{/etc/simplepkg/jailist}: + +\begin{verbatim} +jail-update +\end{verbatim} + +O \emph{jail-update} considera que o template \emph{main}, caso exista, se refere à instalação principal da sua máquina, isto é, o sistema de você roda. Dessa forma a invocação do \emph{jail-update} atualiza todos os templates cujas jaulas estão em \emph{JAIL\_ROOT} e ainda atualiza o template da instalação principal. + +Para adicionar ou remover pacotes de um template, basta editar o arquivo de template. Uma outra forma de adicionar arquivos é usando o \emph{templatepkg} com a opção \emph{-a}, que adiciona apenas novos pacotes ao template. Se você quiser que o \emph{templatepkg} crie um template a partir de uma jaula, simplesmente use + +\begin{verbatim} +templatepkg jaula /vservers/jaula +\end{verbatim} + +\section{Metapacotes} + +Outro uso dos templates é a criação de pacotes: imagine por exemplo a dificuldade de um usuário/a novo de slackware para instalar o cinelerra e todas as suas dependências. Criando um template contendo o nome de todos os pacotes necessários para rodar esse software permite que um usuário instale-o simplesmente com o comando + +\begin{verbatim} +metapkg --install cinelerra +\end{verbatim} + +O comando sugere uma semelhança com o uso direto do \emph{swaret} ou do \emph{slapt-get}, com a única diferença residindo no modo como cada um desses programas lida com as dependências de um pacote. Os \emph{slapt-get} suporta o arquivo \emph{slack-required}, que pode ou não estar presente no pacote. Já o \emph{swaret} possui uma ferramenta própria para a criação de uma lista de dependências. + +O \emph{simplepkg} não pretende substituir esses dois modos de checagem e sim propor uma alternativa de distribuição de pacotes em que as dependências são resolvidas sem precisar de um repositório de dependências ou uma modificação no próprio pacote, que é o caso do \emph{slack-required}, um arquivo que na maioria das vezes não está presente. + +A remoção de um aplicativo e todas as suas dependências podem ser feitas simplesmente com o comando + +\begin{verbatim} +metapkg --remove cinelerra +\end{verbatim} + +\section{Upgrade de jaulas} + +O upgrade de jaulas que estejam em \emph{JAIL\_ROOT} pode ser efetuado com o comando \emph{jail-upgrade}. Simplesmente coloque os patches em \emph{PATCHES\_DIR} e dê o comando + +\begin{verbatim} +jail-upgrade +\end{verbatim} + +Se você quiser atualizar apenas uma das jaulas que estão em \emph{JAIL\_ROOT}, use + +\begin{verbatim} +jail-upgrade nome-da-jaula +\end{verbatim} + +Para especificar uma pasta contendo patches diferente de \emph{PATCHES\_DIR} (útil quando você possui jaulas com diferentes versões do slackware), simplesmente use + +\begin{verbatim} +PATCHES=/local/dos/patches jail-upgrade nome-da-jaula +\end{verbatim} + +De modo análogo ao \emph{mkjail}, é possível indicar ao \emph{jail-upgrade} uma outra pasta onde a jaula está armazenada: + +\begin{verbatim} +ROOT=/otherroot jail-upgrade +\end{verbatim} + +\section{Arquiteturas e versões diferentes} + +O \emph{simplepkg} foi idealizado para permitir que um mesmo template possa ser usado para criar jaulas de arquiteturas e versões diferentes de sistemas padrão slackware. A atualização desses sistemas também é unificada. Essa possibilidade só é permitida se você usa o simplaret e não o swaret como ferramenta de obtenção de pacotes. + +Por exemplo, para criar uma instalação de slackware 10.1 (assumindo que suas definições de repositórios do \emph{/etc/simplepkg/repos.conf} contenham locais com slack 10.1), basta usar o comando + +\begin{verbatim} +VERSION=10.1 mkjail minha-jaula template-servidor +\end{verbatim} + +Arquiteturas diferentes também podem ser usadas. Se você está num sistema \emph{x86\_64} e quer instalar um slack 10.2 numa partição, experimente + +\begin{verbatim} +ARCH=i386 VERSION=10.2 ROOT=/mnt mkjail hda2 meu-slackware +\end{verbatim} + +Note que os templates independem de arquitetura e versão, já que eles só contém nomes de pacotes, +arquivos de configuração e scripts. Por isso, o \emph{templatepkg}, o \emph{metapkg}, o \emph{lspkg} e o \emph{jail-update} funcionam normalmente. + +Para atualizar suas jaulas, o \emph{jail-upgrade} checa antes qual a versão e arquitetura de cada uma +de suas jaulas através do \emph{/etc/slackware-version} correspondente e a partir disso aplica os patches da arquitetura e versão da mesma, usando para isso o simplaret (veja a \link{node/16}{documentação própria}). + +Desse modo, mesmo que você tenha jaulas de versões e arquiteturas diversas, usar o comando \emph{jail-upgrade} faz a atualização sem problemas, desde que seus patches estejam organizados por arquitetura e versão, conforme é detalhado na \link{/node/16}{documentação do simplaret}. + +\section{Aplicativo auxiliar: rebuildpkg} + +O simplepkg acompanha ainda um aplicativo auxiliar que ajuda a recuperar pacotes instalados cujo \emph{.tgz} original foi perdido. O comando \emph{rebuildpkg} reconstrói um pacote a partir de uma entrada no \emph{/var/log/packages}. O comando + +\begin{verbatim} +rebuildpkg coreutils +\end{verbatim} + +reconstrói um pacote do coreutils usando os arquivos e as metainformações listadas no arquivo do \emph{/var/log/packages/} correspondente ao coreutils. + +\section{Fonte} + +Se você quiser obter diretamente o código-fonte do \emph{simplepkg}, baixe-o do repositório: + +\begin{verbatim} +svn checkout svn://slack.midiatatica.org:40/simplepkg +\end{verbatim} + +\section{Página de desenvolvimento} + +A página do \emph{simplepkg} fica em \link{http://slack.midiatatica.org/wiki/Main/SimplePKG}{http://slack.midiatatica.org/wiki/Main/SimplePKG}. + +\end{document} diff --git a/branches/0.6/install/doinst.sh b/branches/0.6/install/doinst.sh new file mode 100644 index 0000000..a61648e --- /dev/null +++ b/branches/0.6/install/doinst.sh @@ -0,0 +1,3 @@ +( if [ ! -f "etc/simplepkg/simplepkg.conf" ]; then mv etc/simplepkg/simplepkg.conf.new etc/simplepkg/simplepkg.conf; fi ) +( if [ ! -f "etc/simplepkg/repos.conf" ]; then mv etc/simplepkg/repos.conf.new etc/simplepkg/repos.conf; fi ) +( if [ ! -f "etc/simplepkg/generic.mkslackbuild" ]; then mv etc/simplepkg/generic.mkSlackBuild.new etc/simplepkg/generic.mkSlackBuild; fi ) diff --git a/branches/0.6/install/slack-desc b/branches/0.6/install/slack-desc new file mode 100644 index 0000000..586d7b6 --- /dev/null +++ b/branches/0.6/install/slack-desc @@ -0,0 +1,19 @@ +# 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 ':'. + + |-----handy-ruler-------------------------------------------------------| +simplepkg: simplepkg (slackware management system) +simplepkg: +simplepkg: simplepkg is a very small set of scripts intended to help slackware +simplepkg: users and developers, like the createpkg packagement tool, simplaret +simplepkg: package retrieval, mkjail chroot installer and templatepkg template +simplepkg: management system. +simplepkg: +simplepkg: +simplepkg: +simplepkg: +simplepkg: diff --git a/branches/0.6/lib/common.sh b/branches/0.6/lib/common.sh new file mode 100644 index 0000000..5c53a09 --- /dev/null +++ b/branches/0.6/lib/common.sh @@ -0,0 +1,713 @@ +#!/bin/bash +# +# common.sh: common functions for simplepkg +# feedback: rhatto at riseup.net | gpl +# +# Uses some functions from pkgtools, which license is: +# +# Copyright 1999 Patrick Volkerding, Moorhead, Minnesota, USA +# Copyright 2001, 2002, 2003 Slackware Linux, Inc., Concord, California, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +BASE_CONF="/etc/simplepkg" +CONF="$BASE_CONF/simplepkg.conf" +JAIL_LIST="$BASE_CONF/jailist" +SIMPLARET="simplaret" + +# ----------------------------------------------- +# pkgtool functions +# ----------------------------------------------- + +function package_name { + + STRING=`basename $1 .tgz` + # Check for old style package name with one segment: + if [ "`echo $STRING | cut -f 1 -d -`" = "`echo $STRING | cut -f 2 -d -`" ]; then + echo $STRING + else # has more than one dash delimited segment + # Count number of segments: + INDEX=1 + while [ ! "`echo $STRING | cut -f $INDEX -d -`" = "" ]; do + INDEX=`expr $INDEX + 1` + done + INDEX=`expr $INDEX - 1` # don't include the null value + # If we don't have four segments, return the old-style (or out of spec) package name: + if [ "$INDEX" = "2" -o "$INDEX" = "3" ]; then + echo $STRING + else # we have four or more segments, so we'll consider this a new-style name: + NAME=`expr $INDEX - 3` + NAME="`echo $STRING | cut -f 1-$NAME -d -`" + echo $NAME + fi + fi + +} + +# ----------------------------------------------- +# package info functions +# ----------------------------------------------- + +function package_version { + + # get VERSION from a package name + local file pack version + file="`basename $1`" + pack="`package_name $1`" + version="`echo $file | sed -e "s/^$pack-//" | cut -d "-" -f 1`" + echo $version + +} + +function package_arch { + + # get ARCH from a package name + local file pack arch + file="`basename $1`" + pack="`package_name $1`" + arch="`echo $file | sed -e "s/^$pack-//" | cut -d "-" -f 2`" + echo $arch + +} + +function package_build { + + # get BUILD from a package name + local file pack build + file="`basename $1 .tgz`" + pack="`package_name $1`" + build="`echo $file | sed -e "s/^$pack-//" | cut -d "-" -f 3`" + echo $build + +} + +# ----------------------------------------------- +# package administrative functions +# ----------------------------------------------- + +function install_packages { + + local check installed unable_to_install root + + # check if is time to clean the local repository + if [ "$SIMPLARET_CLEAN" == "1" ]; then + ARCH=$ARCH VERSION=$VERSION $SIMPLARET --purge + elif [ ! -z "$SIMPLARET_PURGE_WEEKS" ] && [ "$SIMPLARET_PURGE_WEEKS" != "0" ]; then + ARCH=$ARCH VERSION=$VERSION $SIMPLARET --purge -w $SIMPLARET_PURGE_WEEKS + fi + + root="$JAIL_ROOT/$server" + + # now tries to install each package listed in the template + for pack in `cat $TEMPLATE | grep -v -e "^#" | cut -d : -f 1 | awk '{ print $1 }'`; do + + # try to install the package + ROOT=/$root ARCH=$ARCH VERSION=$VERSION $SIMPLARET --install $pack --skip-checks + + # check if the package was installed + pack="`echo $pack | sed -e 's/\+/\\\+/'`" + installed=`eval "ls /$root/var/log/packages/ | egrep -E '^$pack-[^-]+-[^-]+-[^-]+$'"` + check=$? + + if [ ! -z "$installed" ] && [ "$check" == "0" ]; then + # the package is installed + if [ ! -z "$SIMPLARET_DELETE_DURING" ] && [ "$SIMPLARET_DELETE_DURING" != "0" ]; then + SILENT=1 ARCH=$ARCH VERSION=$VERSION $SIMPLARET --purge + fi + else + unable_to_install="$unable_to_install\n\t$pack" + fi + + done + + # purge packages, if needed + if [ "$SIMPLARET_DELETE_DOWN" == "1" ]; then + ARCH=$ARCH VERSION=$VERSION $SIMPLARET --purge + fi + + if [ ! -z "$unable_to_install" ]; then + echo "mkjail was unable to install the following packages on $root:" + echo -e "$unable_to_install" + fi + +} + +function remove_packages { + + for pack in `cat $TEMPLATE | grep -v -e "^#" | cut -d : -f 1`; do + ROOT=/$JAIL_ROOT/$server removepkg $pack + done + +} + +# ----------------------------------------------- +# config file functions +# ----------------------------------------------- + +function eval_parameter { + + # usage: eval $1 parameter from $CONF + # return the evaluated parameter if available or $2 $3 ... $n + + if grep -qe "^$1=" $CONF; then + grep -e "^$1=" $CONF | cut -d = -f 2 | sed -e 's/"//g' -e "s/'//g" | sed -e 's/ *#.*$//' + else + shift + echo $* + fi + +} + +function eval_boolean_parameter { + + # get a boolean parameter from the configuration + + local value + + # get the value + value="`eval_parameter $1 $2`" + + # force case insensitiveness + value="`echo $value | tr '[:upper:]' '[:lower:]'`" + + # convert it to wheter 0 or 1 + if [ "$value" == "yes" ] || [ "$value" == "1" ]; then + echo 1 + else + echo 0 + fi + +} + +function eval_config { + + # simplepkg config file evaluation + # usage: eval_config [-u] + + if [ -f "$CONF" ]; then + + DEFAULT_ARCH="`eval_parameter DEFAULT_ARCH $(default_arch)`" + DEFAULT_VERSION="`eval_parameter DEFAULT_VERSION $(default_version)`" + + STORAGE="`eval_parameter STORAGE /var/simplaret/packages`" + JAIL_ROOT="`eval_parameter JAIL_ROOT /vservers`" + PATCHES_DIR="`eval_parameter PATCHES_DIR /var/simplaret/patches`" + ROOT_PRIORITY="`eval_parameter ROOT_PRIORITY patches slackware extra testing pasture`" + REPOS_PRIORITY="`eval_parameter REPOS_PRIORITY patches slackware extra testing pasture`" + SIMPLARET_PURGE_WEEKS="`eval_parameter SIMPLARET_PURGE_WEEKS 0`" + FTP_TOOL="`eval_parameter FTP_TOOL curl`" + HTTP_TOOL="`eval_parameter HTTP_TOOL curl`" + CONNECT_TIMEOUT="`eval_parameter CONNECT_TIMEOUT 0`" + TEMPLATE_FOLDER="`eval_parameter TEMPLATE_BASE /etc/simplepkg/templates`" + TEMPLATE_STORAGE_STYLE="`eval_parameter TEMPLATE_STORAGE_STYLE own-folder`" + + SIMPLARET_CLEAN="`eval_boolean_parameter SIMPLARET_CLEAN 1`" + SIMPLARET_DELETE_DOWN="`eval_boolean_parameter SIMPLARET_DELETE_DOWN 1`" + SIMPLARET_UPDATE="`eval_boolean_parameter SIMPLARET_UPDATE 0`" + SIMPLARET_DELETE_DURING="`eval_boolean_parameter SIMPLARET_DELETE_DURING 0`" + SIMPLARET_PURGE_PATCHES="`eval_boolean_parameter SIMPLARET_PURGE_PATCHES 0`" + SIMPLARET_DOWNLOAD_FROM_NEXT_REPO="`eval_boolean_parameter SIMPLARET_DOWNLOAD_FROM_NEXT_REPO 1`" + PASSIVE_FTP="`eval_boolean_parameter PASSIVE_FTP 0`" + WARNING="`eval_boolean_parameter WARNING 0`" + SIGNATURE_CHECKING="`eval_boolean_parameter SIGNATURE_CHECKING 0`" + DEPENDENCY_CHECKING="`eval_boolean_parameter DEPENDENCY_CHECKING 1`" + TEMPLATES_UNDER_SVN="`eval_boolean_parameter TEMPLATES_UNDER_SVN 0`" + ADD_TO_JAIL_LIST="`eval_boolean_parameter ADD_TO_JAIL_LIST 1`" + + # Enabling this option (i.e, setting to "1" or "yes"), simplaret will + # donwload even # already applied patches, a good option when you plan + # to keep local copies of all needed patches for your system + DOWNLOAD_EVEN_APPLIED_PATCHES="`eval_boolean_parameter DOWNLOAD_EVEN_APPLIED_PATCHES 0`" + + # Enabling this option, jail-upgrade will look at your + # standard repositories for new packages; if it find a package + # with different version of your current installed package and + # also this package isnt in the packages folder, then the new + # package is apllied; if in doubt, just say no or leave blank. + CONSIDER_ALL_PACKAGES_AS_PATCHES="`eval_boolean_parameter CONSIDER_ALL_PACKAGES_AS_PATCHES 0`" + + # Enabling this option (i.e, setting to "1" or "yes"), simplaret will + # store patches it finds on ROOT repositories on + # + # $PATCHES_DIR/$ARCH/$VERSION/root-$repository_name. + # + # By default this option is turned off because it breaks the standard + # way to store packages and can cause some confusion, but its an useful + # feature if you like to see all patches apart from common packages and/or + # stored in the same tree. + STORE_ROOT_PATCHES_ON_PATCHES_DIR="`eval_boolean_parameter STORE_ROOT_PATCHES_ON_PATCHES_DIR 0`" + + # now we place "patches" on the top of ROOT_PRIORITY + ROOT_PRIORITY="patches `echo $ROOT_PRIORITY | sed -e 's/patches//'`" + + else + echo $1 error: config file $CONFIG not found + exit 1 + fi + + if [ ! -d "$STORAGE" ]; then + mkdir -p $STORAGE + fi + + if [ ! -d "$PATCHES_DIR" ]; then + mkdir -p $PATCHES_DIR + fi + + if [ -z "$ARCH" ]; then + ARCH="$DEFAULT_ARCH" + fi + + if [ -z "$VERSION" ]; then + VERSION="$DEFAULT_VERSION" + fi + + if [ "$FTP_TOOL" != "wget" ] && [ "$FTP_TOOL" != "curl" ] && [ "$FTP_TOOL" != "ncftpget" ]; then + echo "$1 configuration error: invalid value $FTP_TOOL for config parameter FTP_TOOL" + echo "$1 assuming value \"curl\" for variable FTP_TOOL" + FTP_TOOL="curl" + fi + + if [ "$HTTP_TOOL" != "wget" ] && [ "$HTTP_TOOL" != "curl" ]; then + echo "$1 configuration error: invalid value $HTTP_TOOL for config parameter HTTP_TOOL" + echo "$1 assuming value \"curl\" for variable HTTP_TOOL" + HTTP_TOOL="curl" + fi + + if which $SIMPLARET &> /dev/null; then + if [ "$SIMPLARET_UPDATE" == "1" ]; then + if [ "$2" == "-u" ]; then + ARCH=$ARCH VERSION=$VERSION $SIMPLARET --update + fi + fi + else + echo "$SIMPLARET not found, please install it before run $0" + fi + + if [ "$TEMPLATE_STORAGE_STYLE" != "simplepkg-folder" ] && \ + [ "$TEMPLATE_STORAGE_STYLE" != "templates-folder" ] && \ + [ "$TEMPLATE_STORAGE_STYLE" != "own-folder" ]; then + TEMPLATE_STORAGE_STYLE="own-folder" + fi + + if [ ! -z "$ROOT" ]; then + JAIL_ROOT="$ROOT" + fi + +} + +# ----------------------------------------------- +# arch and version functions +# ----------------------------------------------- + +function default_version { + + # get version from /etc/slackware-version + if [ -f "$1/etc/slackware-version" ]; then + cat $1/etc/slackware-version | awk '{ print $2 }' | sed -e 's/.0$//' + else + echo "none" + fi + +} + +function default_arch { + + # get arch from /etc/slackware-version + + local arch + arch="`cat $1/etc/slackware-version | awk '{ print $3 }' | sed -e 's/(//' -e 's/)//'`" + + if [ -z "$arch" ]; then + echo i386 + else + echo $arch + fi + +} + +# ----------------------------------------------- +# template functions +# ----------------------------------------------- + +function search_default_template { + + if [ -e "$BASE_CONF/default.template" ]; then + TEMPLATE_BASE="$BASE_CONF/default" + echo $BASENAME using default template + elif [ -e "$TEMPLATE_FOLDER/default.template" ]; then + TEMPLATE_BASE="$TEMPLATE_FOLDER/default" + echo $BASENAME: using default template + elif [ -e "$TEMPLATE_FOLDER/default/default.template" ]; then + TEMPLATE_BASE="$TEMPLATE_FOLDER/default/default" + echo $BASENAME: using default template + elif [ -e "$BASE_CONF/defaults/templates/default/default.template" ]; then + TEMPLATE_BASE="$BASE_CONF/defaults/templates/default" + echo $BASENAME using default template + else + echo $BASENAME: error: default template not found + echo $BASENAME: please create a template using templatepkg + return 1 + fi + +} + +function search_template { + + # determine the template to be used + # usage: search-template [--new | --update] + + # + # templates can be stored either on + # + # - $BASE_CONF/template_name.template + # - $TEMPLATE_FOLDER/template_name.template + # - $TEMPLATE_FOLDER/template_name/template_name.template + # + # also, there's a folder for "oficial" simplepkg templates, + # $BASE_CONF/defaults/templates/ and you can override any template + # in the default folder by placing a template with the same name + # in the template storage folders + # + + if [ -f "$BASE_CONF/$1.template" ]; then + TEMPLATE_BASE="$BASE_CONF/$1" + elif [ -f "$TEMPLATE_FOLDER/$1.template" ]; then + TEMPLATE_BASE="$TEMPLATE_FOLDER/$1" + elif [ -f "$TEMPLATE_FOLDER/$1/$1.template" ]; then + TEMPLATE_BASE="$TEMPLATE_FOLDER/$1/$1" + elif [ -f "$BASE_CONF/defaults/templates/$1/$1.template" ] && \ + [ "$2" != "--update" ]; then + TEMPLATE_BASE="$BASE_CONF/defaults/templates/$1/$1" + else + if [ "$2" == "--new" ]; then + # we need to return the path for a new template + if [ "$TEMPLATE_STORAGE_STYLE" == "simplepkg-folder" ]; then + TEMPLATE_BASE="$BASE_CONF/$1" + elif [ "$TEMPLATE_STORAGE_STYLE" == "templates-folder" ]; then + TEMPLATE_BASE="$TEMPLATE_FOLDER/$1" + else + TEMPLATE_BASE="$TEMPLATE_FOLDER/$1/$1" + fi + elif [ "$2" == "--update" ]; then + return 1 + else + echo $BASENAME: template $1 not found + search_default_template + fi + fi + +} + +# ----------------------------------------------- +# unix permission functions +# ----------------------------------------------- + +function numeric_perm { + + # get the numeric permission of a file + # usage: numeric_perm + + # just a bit of forbidden secrets + + if [ -a "$1" ]; then + ls -lnd $1 | awk '{ print $1 }' | \ + sed -e 's/^.//' -e 's/r/4/g' -e 's/w/2/g' -e 's/x/1/g' \ + -e 's/-/0/g' -e 's/\(.\)\(.\)\(.\)/\1+\2+\3/g' | \ + fold -w5 | bc -l | xargs | sed -e 's/ //g' + fi + +} + +function get_owner { + + # get the numeric owner for a file + # usage: get_owner + + if [ -a "$1" ]; then + ls -lnd $1 | awk '{ print $3 }' + fi + +} + +function get_group { + + # get the numeric group for a file + # usage: get_group + + if [ -a "$1" ]; then + ls -lnd $1 | awk '{ print $4 }' + fi + +} + +# ----------------------------------------------- +# subversion functions +# ----------------------------------------------- + +function use_svn { + + # check if svn usage is enabled + + if [ "$TEMPLATES_UNDER_SVN" == "1" ] && \ + [ "$TEMPLATE_STORAGE_STYLE" == "own-folder" ]; then + return 0 + else + return 1 + fi + +} + +function svn_check { + + # check if a file is under svn + # usage: svn_check + + local cwd folder + + cwd="`pwd`" + folder="`dirname $1`" + + if [ -d "$folder/.svn" ]; then + + cd $folder + + if [ "`svn status $1 | awk '{ print $1 }'`" == "?" ]; then + return 1 + else + return 0 + fi + + cd $cwd + + else + + return 1 + + fi + +} + +# ----------------------------------------------- +# update jail functions +# ----------------------------------------------- + +function update_template_files { + + # update template files from svn + # usage: update_template_files + + if use_svn && [ -d "$TEMPLATE_BASE.d/.svn" ]; then + echo Checking out last template revision from svn... + cd `dirname $TEMPLATE_BASE` + svn update + fi + +} + +function copy_template_files { + + # copy template files into jail + # usage: copy_template_files + + if [ -d "$1" ]; then + if [ -d "$TEMPLATE_BASE.d" ]; then + echo "Copying template files to $1..." + if use_svn && [ -d "$TEMPLATE_BASE.d/.svn" ]; then + rsync -av --exclude=.svn $TEMPLATE_BASE.d/ $1/ + else + rsync -av $TEMPLATE_BASE.d/ $1/ + fi + fi + fi + +} + +function set_jail_perms { + + # set template file permissions under a jail + # usage: set_jail_perms + + if [ -s "$TEMPLATE_BASE.perms" ]; then + echo Setting jail $1 permissions... + cat $TEMPLATE_BASE.perms | while read entry; do + file="`echo $entry | cut -d ";" -f 1`" + if [ -e "$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 + +} + +# ----------------------------------------------- +# repository build functions +# ----------------------------------------------- + +function svn_add_meta { + + find *meta -exec svn add {} 2> /dev/null \; + find . -name *meta -exec svn add {} 2> /dev/null \; + +} + +function gen_filelist { + + # generate FILELIST.TXT + # usage: gen_filelist + + local cwd + + for file in `find | grep -e ".tgz$"`; do ls -l $file; done > FILELIST.TXT + echo "Created new FILELIST.TXT" + +} + +function gen_patches_filelist { + + # generate FILE_LIST + # usage: gen_patches_filelist + + if [ ! -z "$1" ] && [ -d "$1" ]; then + + cwd="`pwd`" + cd $1 + for file in `find | grep -e ".tgz$"`; do ls -l $file; done > FILE_LIST + cd $pwd + + if [ "$1" == "." ]; then + echo "Created new FILE_LIST" + else + echo "Created new $1/FILE_LIST" + fi + + fi + +} + +function gen_packages_txt { + + # generate PACKAGES.TXT + # usage: gen_packages_txt + + if [ ! -z "$1" ] && [ -d "$1" ]; then + + cwd="`pwd`" + cd $1 + + echo '' > PACKAGES.TXT + find . -type f -name '*.meta' -exec cat {} \; >> PACKAGES.TXT + cat PACKAGES.TXT | gzip -9 -c - > PACKAGES.TXT.gz + cd $pwd + + if [ "$1" == "." ]; then + echo "Created new PACKAGES.TXT and PACKAGES.TXT.gz" + else + echo "Created new $1/PACKAGES.TXT and $1/PACKAGES.TXT.gz" + fi + + fi + +} + +function gen_md5_checksums { + + # generate CHECKSUMS.md5 + # usage: gen_md5_checksums + + if [ ! -z "$1" ] && [ -d "$1" ]; then + + cwd="`pwd`" + cd $1 + + echo '' > CHECKSUMS.md5 + find . -type f -name '*.tgz' -exec md5sum {} \; >> CHECKSUMS.md5 + cat CHECKSUMS.md5 | gzip -9 -c - > CHECKSUMS.md5.gz + cd $pwd + + if [ "$1" == "." ]; then + echo "Created new CHECKSUMS.md5 and CHECKSUMS.md5.gz" + else + echo "Created new $1/CHECKSUMS.md5 and $1/CHECKSUMS.md5.gz" + fi + + fi + +} + +function gen_meta { + + # generate metafiles + # usage: 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 + +} + +# ----------------------------------------------- +# misc functions +# ----------------------------------------------- + +function slash { + + # remove additional slashes + echo $* | sed -e 's/\/\+/\//g' + +} + diff --git a/branches/0.6/simplepkg.SlackBuild b/branches/0.6/simplepkg.SlackBuild new file mode 100755 index 0000000..fdc8a7f --- /dev/null +++ b/branches/0.6/simplepkg.SlackBuild @@ -0,0 +1,73 @@ +#!/bin/bash +# +# SlackBuild script for simplepkg +# + +PACKAGE="simplepkg" +PACK_DIR="package-$PACKAGE" +BUILD=${BUILD:=1rha} +VERSION="0.5pre17" +ARCH="noarch" +LIBEXEC="/usr/libexec/$PACKAGE" +BINDIR="/usr/bin" +BINARY_LIST="simplaret repos lspkg mkbuild" +SBINDIR="/usr/sbin" +SBINARY_LIST="exec-slackbuild mkjail templatepkg jail-update jail-commit metapkg rebuildpkg createpkg exec-slackbuild" +LIB_LIST="common.sh" +DOC_DIR="/usr/doc" +DOC_LIST="COPYING TODO CHANGELOG README README.pt_BR README.simplaret README.simplaret.pt_BR" + +rm -rf $PACK_DIR +mkdir -p $PACK_DIR/install +cp install/slack-desc $PACK_DIR/install +cp install/doinst.sh $PACK_DIR/install + +mkdir -p $PACK_DIR/$SBINDIR +for binary in $SBINARY_LIST; do + if [ -f "src/$binary" ]; then + cp src/$binary $PACK_DIR/$SBINDIR + chmod +x $PACK_DIR/$SBINDIR/$binary + fi +done + +mkdir -p $PACK_DIR/$BINDIR +for binary in $BINARY_LIST; do + cp src/$binary $PACK_DIR/$BINDIR/ + chmod +x $PACK_DIR/$BINDIR/$binary +done + +mkdir -p $PACK_DIR/$LIBEXEC +for lib in $LIB_LIST; do + cp lib/$lib $PACK_DIR/$LIBEXEC/ +done + +rm -rf $PACK_DIR/$DOC_DIR +mkdir -p $PACK_DIR/$DOC_DIR/$PACKAGE-$VERSION +for file in $DOC_LIST; do + cp doc/$file $PACK_DIR/$DOC_DIR/$PACKAGE-$VERSION/ +done + +mkdir -p $PACK_DIR/etc/$PACKAGE/{defaults,templates} +rsync -av --exclude=.svn templates/* $PACK_DIR/etc/$PACKAGE/defaults/templates/ +chmod +x $PACK_DIR/etc/$PACKAGE/defaults/templates/vserver/vserver.s/*.sh +chmod +x $PACK_DIR/etc/$PACKAGE/defaults/templates/vserver-legacy/vserver-legacy.s/*.sh +cp conf/simplepkg.conf.new $PACK_DIR/etc/$PACKAGE +cp conf/repos.conf.new $PACK_DIR/etc/$PACKAGE +cp conf/generic.mkSlackBuild.new $PACK_DIR/etc/$PACKAGE +cp utils/exec-slackbuild $PACK_DIR/$SBINDIR/ + +if [ -f "$PACK_DIR/usr/sbin/jail-upgrade" ]; then + cd $PACK_DIR/usr/sbin && ln -s jail-upgrade vserver-upgrade + cd - +fi + +cd $PACK_DIR +chown -R root.root * + +makepkg -c y -l y ../simplepkg-$VERSION-$ARCH-$BUILD.tgz +cd .. + +if [ "$CLEANUP" != "no" ]; then + rm -rf $PACK_DIR +fi + diff --git a/branches/0.6/src/createpkg b/branches/0.6/src/createpkg new file mode 100644 index 0000000..03612a9 --- /dev/null +++ b/branches/0.6/src/createpkg @@ -0,0 +1,511 @@ +#!/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.0.5" + +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 eecho { + + # echoes a message + # usage: eecho + # message-type can be: commun, messag, error, normal + + echo -e "${1}${2}${normal}" + +} + +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 mensage + 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:=$TMP}; + # 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} + 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=$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_DIR" ] && build_repo + +} + +function sync_repo { + + # Synchronize repository + cd $SLACKBUILDS_DIR + 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 color_select { + + # Select color mode: gray, color or none (*) + # commun - Communication + # messag - Commum messages + # error - Error messages + # normal - turn off color + case "$1" in + 'gray') + commun="\033[37;1m" + messag="\033[37;1m" + error="\033[30;1m" + alert="\033[37m" + normal="\033[m" + ;; + 'color') + commun="\033[34;1m" # green + messag="\033[32;1m" # blue + error="\033[31;1m" # red + alert="\033[33;1m" # yellow + normal="\033[m" # normal + ;; + *) + commun="" + messag="" + error="" + alert="" + normal="" + ;; + 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 + eecho $error "error: file $COMMON not found, check your $BASENAME installation" + 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`" + +# 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" != "1" ]; 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 + +# Select repository directory +NEW_REPOS=$REPOS/$( echo ${SCRIPT_BASE#$SLACKBUILDS_DIR/} ) + +# Create repository directory +[ ! -e $NEW_REPOS ] && mkdir -p $NEW_REPOS 2>/dev/null + + +# Remove old-versions +rm $NEW_REPOS/$PACKAGE-*-*-*.tgz 2>/dev/null + +# Execute SlackBuild script with variables protection +( INTERACT=no REPOS=$NEW_REPOS sh ./$SCRIPT_NAME ) + +# Check if package was built +handle_error $? $PACKAGE + +PKG_TGZ="`ls -1 -c $NEW_REPOS/$PACKAGE-*-*-*.tgz | head -n 1`" + +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/branches/0.6/src/jail-commit b/branches/0.6/src/jail-commit new file mode 100755 index 0000000..f2695d7 --- /dev/null +++ b/branches/0.6/src/jail-commit @@ -0,0 +1,170 @@ +#!/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 new file mode 100755 index 0000000..c5a008f --- /dev/null +++ b/branches/0.6/src/jail-update @@ -0,0 +1,61 @@ +#!/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 new file mode 100755 index 0000000..01900f2 --- /dev/null +++ b/branches/0.6/src/lspkg @@ -0,0 +1,132 @@ +#!/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 new file mode 100755 index 0000000..cae7224 --- /dev/null +++ b/branches/0.6/src/mkbuild @@ -0,0 +1,1196 @@ +#!/bin/bash -x +# +# Script para gerar SlackBuild +# Por Rudson R. Alves +# +# Este script auxilia a criação de SlackBuilds, com o modelo +# do Luiz do Sarava Linux +# +# SlackBuilds são scripts utilizados no Slackware para gerar +# pacotes tgz. +# +# Turn off debug +set +x +# +# Version 0.9.18 +PROG_VERSION=0.9.18 + +#-------------------------------------------------------------------- +# Functions +#-------------------------------------------------------------------- +# Show ./configure --help +function config_help() +{ + view_file "Check ./configure --help" $CONFIG_HELP +} + +# Show file +# INPUT: $1 string textbox +# $2 file +function view_file() +{ + [ $# -ne 2 ] && return 1 + dialog --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title " $1 " --textbox $2 20 75 +} + +# Exit function +function mk_exit() +{ + clean_all + clear + exit $1 +} + +# Clear all temp files +function clean_all() +{ + [ -s $DEPENDENCY_LIST ] && cp $DEPENDENCY_LIST $BASEDIR/slack-required + + rm $AUX_TMP 2>/dev/null + rm $SLACKDESC_TMP 2>/dev/null + rm $SLACKBUILD.test 2>/dev/null + rm $DEPENDENCY_LIST 2>/dev/null + if [ ! -z $MK_PKGNAME ]; then + rm $BASEDIR/*_$MK_PKGNAME.mkbuild 2>/dev/null + rm -rf /tmp/$MK_PKGNAME 2>/dev/null + rm $CONFIG_HELP 2>/dev/null + fi +} + +# Print from file $2, the lines betwen <$1> and lines +function print_lines() +{ + [ $# -ne 2 ] && mk_exit 1 + eval "sed -n '/<$1>/,/<\/$1>/ { /<$1>/ b; /<\/$1>/ b; p; }' $2" +} + +# Print from file $2, the lines betwen <$1> and $2 lines +function print_lines_to() +{ + [ $# -ne 3 ] && mk_exit 1 + eval "sed -n '/<$1>/,/$2/ { /<$1>/ b; /$2/ b; p; }' $3" +} + +# Make slack-desc file +function mk_slackdesc() +{ + print_lines_to "slackdesc" "|-----" $SB_MODEL + echo -n $MK_PKGNAME | tr [a-z+\-] " " + echo -n "|-----handy-ruler" + let N=18+${#MK_PKGNAME} + for i in `seq $N $SLACKDESC_LEN`; do + echo -n "-" + done + echo -en "|\n" + + for i in `seq 1 11`; do + echo -en "$MK_PKGNAME: \n" + done + print_lines "slackdesc" $SB_MODEL | sed '1,/\]\]/ d' +} + +# Get label status from SlackBuild model +function get_status() +{ + [ $# -ne 2 ] && mk_exit 1 + eval "sed -n '/<$1>/ p' $2 | sed 's/.*> \([a-z]\+\)/\1/'" +} + +# Get status from edited SlackBuild +# input: $1 -> section name +# output: section status and section number +function mk_status() +{ + for i in `seq 0 $MAXSECTION`;do + if [ "${SECTION_NAME[i]}" = "$1" ]; then + echo "${SECTION_FLAG[i]} $i" + return 0 + fi + done + return 1 +} + +# Edit file $3, by change string [[$1]] to $2 +function edit_file() +{ + local STR_OLD + local STR_NEW + + [ $# -ne 3 ] && mk_exit 1 + 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 +} + +# Unpackage source +function unpkg_source() +{ + # FIXME: if MK_DECOMPRESSOR -ne bunzip2 or gunzip... + if [ $MK_DECOMPRESSOR = "bunzip2" -o $MK_DECOMPRESSOR = "gunzip" ]; then + dialog --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" \ + --cancel-label "Main Menu" --title "$MK_TITLE" --infobox "Uncompress source in /tmp/$MK_PKGNAME. Wait" 3 45 + [ $? -ne 0 ] && return 100 + mkdir /tmp/$MK_PKGNAME/ 2>/dev/null + tar xvf $MK_SOURCE -C /tmp/$MK_PKGNAME/ 1>/dev/null + [ $? -ne 0 ] && mk_exit 1 + MK_TMPSRC="/tmp/$MK_PKGNAME/`ls /tmp/$MK_PKGNAME/`" + + DOC_FILES=`find $MK_TMPSRC -type f -maxdepth 1 -name "[A-Z]*" | sed 's/.*\/\(.*\)$/\1/'` + else + dialog --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" \ + --title "$MK_TITLE" --msgbox "$MK_DECOMPRESSOR not configurated..." 5 45 + fi +} + +# Download source +function download_url() +{ + clear + mkdir -p $MK_SOURCEDIR/$MK_PKGNAME 2>/dev/null + wget --continue --limit-rate=$MK_LIMITRATE $MK_URL -P $MK_SOURCEDIR/$MK_PKGNAME/ + if [ $? -ne 0 ]; then + echo "URL error" + return 0 + fi + MK_SOURCE=$MK_SOURCEDIR/$MK_PKGNAME/$MK_SRCNAME +} + +# Select source file +function select_source() +{ + MK_SOURCE=$BASEDIR + while [ ! -f $MK_SOURCE ]; do + MK_SOURCE=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" \ + --cancel-label "Main Menu" --title " Select source file name (use spaces to select): " --fselect "$MK_SOURCE" 10 70` + [ $? -ne 0 ] && return 100 + if [ ! -f $MK_SOURCE ]; then + MK_SOURCE="$MK_SOURCE/" + fi + done + + MK_SRCNAME=`basename $MK_SOURCE` + MK_SOURCEDIR=`dirname $MK_SOURCE` +} + +#-------------------------------------------------------------------- +# Edit functions +#-------------------------------------------------------------------- +# Edit authot, Initials and editor +function edit_author() +{ + MK_AUTHOR=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --inputbox "Enter with author complite name:" 8 60 "$MK_AUTHOR"` + edit_file "AUTHOR NAME" "$MK_AUTHOR" ~/.mkslackbuild + + MK_AUTHOR_INITIALS=`echo $MK_AUTHOR | sed 's/ /\n/g' | sed 's/^\([A-Z]\).*/\1/' | sed ':i; $!N; s/\n//; ti' | tr [A-Z] [a-z]` + MK_AUTHOR_INITIALS=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --inputbox "Enter with author assignature:" 8 60 "$MK_AUTHOR_INITIALS"` + edit_file "AUTHOR INITIALS" "$MK_AUTHOR_INITIALS" ~/.mkslackbuild + + MK_EDITOR=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --inputbox "Enter with editor command:" 8 60 "pico"` + edit_file "EDITOR" "$MK_EDITOR" ~/.mkslackbuild + + MK_SOURCEDIR=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --inputbox "Enter with sources directory:" 8 60 "\`pwd\`"` + edit_file "SOURCE DIR" "$MK_SOURCEDIR" ~/.mkslackbuild + + if [ "$USER" != "root" ]; then + SLACKBUILDRC=`[ -e ~/.slackbuildrc ] && echo ~/.slackbuildrc || echo /etc/slackbuildrc` + MK_REPOS=`grep 'REPOS=' $SLACKBUILDRC | sed 's/REPOS=\(.*\)/\1/'` + else + SLACKBUILDRC=`su -c "[ -e ~/.slackbuildrc ] && echo ~/.slackbuildrc || echo /etc/slackbuildrc" 2>/dev/null` + MK_REPOS=`su -c "grep 'REPOS=' $SLACKBUILDRC | sed 's/REPOS=\(.*\)/\1/'" 2>/dev/null` + fi + + MK_REPOS=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --inputbox "Enter with binary repository directory:" 8 60 "$MK_REPOS"` + edit_file "REPOS DIR" "$MK_REPOS" ~/.mkslackbuild + + MK_SLACKBUILD_DIR=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --inputbox "Enter with binary repository directory:" 8 60 "$MK_SLACKBUILD_DIR"` + edit_file "SLACKBUILD DIR" "$MK_SLACKBUILD_DIR" ~/.mkslackbuild + + MK_ARCH=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --inputbox "Enter default architecture to SlackBuild:" 8 60 "i468"` + edit_file "DEFAULT ARCH" "$MK_ARCH" ~/.mkslackbuild + + MK_LIMITRATE=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --inputbox "Enter wget limit rate:" 8 60 "120k"` + edit_file "LIMIT RATE" "$MK_LIMITRATE" ~/.mkslackbuild +} + +# Edit source URL +function edit_url() +{ + MK_URL=${MK_URL:="http://downloads.sourceforge.net/"} + MK_URL=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --cancel-label "Main Menu" --title "$MK_TITLE" --inputbox "Enter with complite URL from source:" 8 60 "$MK_URL"` + [ $? -ne 0 ] && return 100 +} + +# Edit source name +function edit_source_name() +{ + # Carrega nome do arquivo + MK_SRCNAME=`basename $MK_URL` + MK_SRCNAME=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --cancel-label "Main Menu" --title "$MK_TITLE" --inputbox "Enter with source file name:" 8 60 "$MK_SRCNAME"` + [ $? -ne 0 ] && return 100 +} + +# Edit MK_PKGNAME, MK_VERSION and MK_EXTENSION +function edit_pkgname() +{ + # Remove nome, versão e extensão do nome da fonte + MK_SRC_NAME=`echo $MK_SRCNAME | sed -r 's/(.*)-(.*)\.(.*\..*)$/\1/'` + MK_PKGNAME=`echo $MK_SRC_NAME | tr [A-Z_] [a-z\-]` + MK_VERSION=`echo $MK_SRCNAME | sed -r 's/(.*)-(.*)\.(.*\..*)$/\2/'` + MK_EXTENSION=`echo $MK_SRCNAME | sed -r 's/(.*)-(.*)\.(.*\..*)$/\3/'` + + # Configura nome, versão e extensão do pacote + ANS=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" \ + --cancel-label "Main Menu" --title "$MK_TITLE" \ + --form "Check information below:" 14 52 7 \ + "Source name:" 1 1 "$MK_SRC_NAME" 1 15 30 60 \ + "Package name:" 3 1 "$MK_PKGNAME" 3 15 30 60 \ + "Version:" 5 1 "$MK_VERSION" 5 15 30 60 \ + "Extension:" 7 1 "$MK_EXTENSION" 7 15 30 60` + [ $? -ne 0 ] && return 100 + + MK_SRC_NAME=`echo $ANS | awk '{print $1}'` + MK_PKGNAME=`echo $ANS | awk '{print $2}'` + MK_VERSION=`echo $ANS | awk '{print $3}'` + MK_EXTENSION=`echo $ANS | awk '{print $4}'` +} + +# Edit MK_DECOMPRESSOR and MK_DECOMPRESSOR_TEST_FLAG +function edit_decompress_arg() +{ + # Remove nome, versão e extensão do nome da fonte + MK_DECOMPRESSOR="" + MK_DECOMPRESSOR_TEST_FLAG="" + + # Configura nome, versão e extensão do pacote + ANS3=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" \ + --cancel-label "Main Menu" --title "$MK_TITLE" \ + --form "Check information below:" 10 55 3 \ + "Uncompress program:" 1 1 "$MK_DECOMPRESSOR" 1 23 25 60 \ + "Uncompress test flag:" 3 1 "$MK_DECOMPRESSOR_TEST_FLAG" 3 23 25 100` + [ $? -ne 0 ] && return 100 + + MK_DECOMPRESSOR=`echo $ANS3 | awk '{print $1}'` + MK_DECOMPRESSOR_TEST_FLAG=`echo $ANS3 | awk '{print $2}'` +} + +# Edit configure options +function edit_configure() +{ + CONFIG_HELP=`mktemp -p /tmp/ config_$MK_PKGNAME.XXXXXX` + + $MK_TMPSRC/configure --help > $CONFIG_HELP + config_help + #[ "$( cat $CONFIG_HELP | egrep '/usr/local')" != "" ] && MK_PREFIX=/usr || MK_PREFIX=/opt/kde + MK_PREFIX="/usr" + MK_OPTIONS="" + local ANS0=1 + + while [ $ANS0 -eq 1 ]; do + local ANS1="7" + while [ $ANS1 -ne 0 ]; do + ANS1=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" \ + --cancel-label "Continue" --title "$MK_TITLE" \ + --menu "Select one option" 0 0 0 \ + 1 "View ./configure --help" \ + 2 "View documentations" \ + 3 "PREFIX=$MK_PREFIX" \ + 4 "OPTIONS=$MK_OPTIONS" \ + 0 "Continue"` + + case $ANS1 in + '1') + config_help + ;; + '2') + view_docs + ;; + '3') + MK_PREFIX=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --inputbox "Enter with prefix for install $MK_PKGNAME" 8 60 "$MK_PREFIX"` + ;; + '4') + MK_OPTIONS=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --inputbox "Enter with configure options for compile $MK_PKGNAME" 8 60 "$MK_OPTIONS"` + ;; + *) + ANS1=0 + ;; + esac + done + + # Configure + dialog --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title " Execute ./configure below? " --yesno "./configure --prefix=$MK_PREFIX $MK_OPTIONS" 6 70 + if [ $? -eq 0 ]; then + ( + cd $MK_TMPSRC + ./configure --prefix=$MK_PREFIX $MK_OPTIONS + ) + + echo -en "\nPress ENTER to continue" + read ANS0 + fi + + dialog --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title " Configure line is ok? " --yesno "./configure --prefix=$MK_PREFIX $MK_OPTIONS" 6 70 + + ANS0=$? + done +} + +# Show Documentations files +function view_docs() +{ + local MENU="" + local SELECT="" + local ANS2=0 + + for i in $DOC_FILES; do + MENU="$MENU \"$i\" \"\" " + done + + while [ $ANS2 -eq 0 ]; do + SELECT=`eval "dialog --stdout --backtitle \"Make SlackBuild $PROG_VERSION [$MK_PKGNAME]\" --cancel-label \"Continue\" --title \"$MK_TITLE\" --menu \"Select doc-file below:\" 20 45 13 $MENU"` + ANS2=$? + [ $ANS2 -eq 0 ] && view_file "File: $SELECT" $MK_TMPSRC/$SELECT + done +} + +# Edit documentations files +function edit_docfiles() +{ + [ -z $MK_TMPSRC ] && return 0 + + if [ -e $MK_TMPSRC ]; then + LIST=`( cd $MK_TMPSRC; find . -type f -maxdepth 1 | cut -c3- )` + DOCMENU="" + for i in $LIST; do + if [ "`echo NEWS TODO README AUTHORS INSTALL ChangeLog MAINTAINERS COPYING | grep $i`" != "" ]; then + DOCMENU="$DOCMENU $i \"\" on" + else + DOCMENU="$DOCMENU $i \"\" off" + fi + done + SELECTDOCS=`eval "dialog --stdout --separate-output --backtitle \"Make SlackBuild $PROG_VERSION [$MK_PKGNAME]\" --title \"$MK_TITLE\" --cancel-label \"Continue\" --checklist \"Select documentation files below:\" 20 45 13 $DOCMENU"` + fi + + MK_DOCFILES="`echo $SELECTDOCS | sed ':i; N; s/\n/ /; bi'`" +} + +# Edit compiler architecture +function edit_arch() +{ + MK_ARCH=`dialog --stdout --backtitle "Make SlackBuild documentation files below:" --cancel-label "Main Menu" --title "$MK_TITLE" --inputbox "Set an architecture to compiler:" 8 45 $MK_ARCH` + [ $? -ne 0 ] && return 100 +} + +#-------------------------------------------------------------------- +# Mount files +#-------------------------------------------------------------------- +# Change string $1 to $2 in all files in the current directory +function change_strings() +{ + [ $# -ne 2 ] && mk_exit 1 + #[ -z "$2" ] && return 0 + eval "grep -l \"\[\[$1\]\]\" *" | while read FILE; do + edit_file "$1" "$2" $FILE + done +} + +# Build initial sections +function start_build() +{ + change_strings "SLACKBUILD AUTHOR" "$MK_AUTHOR" + change_strings "SLACKBUILD AUTHOR INITIALS" $MK_AUTHOR_INITIALS + change_strings "SOURCE NAME" "$MK_SRC_NAME" + change_strings "PROGRAM NAME" "$MK_PKGNAME" + change_strings "PACKAGE NAME" "$MK_PKGNAME" + change_strings "DECOMPRESSOR" "$MK_DECOMPRESSOR" + change_strings "DECOMPRESSOR TEST FLAG" "$MK_DECOMPRESSOR_TEST_FLAG" + change_strings "PROGRAM URL" "${MK_URL//$MK_SRCNAME}" + change_strings "ARCH" "$MK_ARCH" + change_strings "VERSION" $MK_VERSION + change_strings "SOURCE EXTENSION" ${MK_EXTENSION#tar.} + change_strings "DOWNLOAD FOLDER URL" "`dirname $MK_URL`" + if [ -z $MK_OPTIONS ]; then + change_strings "OTHER CONFIGURE ARGS" "\"\"" + else + change_strings "OTHER CONFIGURE ARGS" "$MK_OPTIONS" + fi + change_strings "DOCUMENTATION FILES" "$MK_DOCFILES" + change_strings "PREFIX" "$MK_PREFIX" +} + +# Mount final SlackBuild +function mount_slackbuild() +{ + dialog --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --infobox "SlackBuild save in $SLACKBUILD" 5 45 + + rm $SLACKBUILD 2>/dev/null +# [ ! -e `dirname $SLACKBUILD` ] && mkdir `dirname $SLACKBUILD` + for i in `seq 0 $MAXSECTION`; do + if [ "${SECTION_FLAG[i]}" = "all" -o "${SECTION_FLAG[i]}" = "on" ]; then + cat ${SECTION_NAME[i]}_$MK_PKGNAME.mkbuild >> $SLACKBUILD + echo "" >> $SLACKBUILD + fi + done + chmod +x $SLACKBUILD +} + +# Mount SlackBuild to section $1 +function mount_slackbuild_to() +{ + if [ $# -eq 1 ]; then + END_SECTION=$1 + dialog --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --infobox "SlackBuild save in $SLACKBUILD.test" 5 45 + + rm $SLACKBUILD.test 2>/dev/null + let i=0 + while [ $i -le $END_SECTION ]; do + if [ "${SECTION_FLAG[i]}" = "all" -o "${SECTION_FLAG[i]}" = "on" ]; then + cat ${SECTION_NAME[i]}_$MK_PKGNAME.mkbuild >> $SLACKBUILD.test + echo "" >> $SLACKBUILD + fi + let i++ + done + echo "" >> $SLACKBUILD + fi +} + +# Make files section +function make_file_sections() +{ + THIS_MODEL=$1 + + # Create SlackBuilds-sections files + rm *_$MK_PKGNAME.mkbuild 2>/dev/null + + # Make files section + INDEX=0 + while read ITEM; do + SECTION_NAME[INDEX]="$ITEM" + + AUX=${SB_SECTION[$INDEX,0]}_${MK_PKGNAME} + SECTION_FILE=${SECTION_NAME[INDEX]}_${MK_PKGNAME}.mkbuild + rm $SECTION_FILE 2>/dev/null + + STRING=$ITEM + # Save section status flag + SECTION_FLAG[INDEX]=`get_status "$STRING" $THIS_MODEL` + + # Create sections files + print_lines "$STRING" $THIS_MODEL > $SECTION_FILE + let INDEX++ + done < <( cat $THIS_MODEL | grep '^<[a-z_0-9]\+>' | sed 's/<\(.*\)>.*$/\1/' ) + + let INDEX-- + MAXSECTION=$INDEX + md5sum *.mkbuild > md5sum +} + +function get_source_dialog() +{ + if [ ! -e $MK_SOURCE ]; then + dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" \ + --title "$MK_TITLE" --yesno " Download $MK_SRCNAME? " 5 50 + if [ $? -eq 0 ]; then + download_url + else + select_source + [ $? -eq 100 ] && return 100 + fi + fi +} + + +function test_source() +{ + local TEST=1 + local ANS=0 + + while [ $TEST -ne 0 ]; do + dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --infobox "Test source with $MK_DECOMPRESSOR $MK_DECOMPRESSOR_TEST_FLAG $MK_SOURCE" 5 50 + $MK_DECOMPRESSOR $MK_DECOMPRESSOR_TEST_FLAG $MK_SOURCE + TEST=$? + if [ $TEST -ne 0 ]; then + dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --yesno "Source uncompress error. Download source again?" 6 50 + if [ $? -eq 0 ]; then + rm $MK_SOURCE + get_source_dialog + [ $? -eq 100 ] return 100 + else + TEST=0 + fi + fi + done +} + +# Configure test source variables +function set_source_test() +{ + MK_SOURCE=$MK_SOURCEDIR/$MK_PKGNAME/$MK_SRCNAME + if [ "$MK_EXTENSION" = "tar.gz" -o "$MK_EXTENSION" = "gz" -o "$MK_EXTENSION" = "tgz" ]; then + MK_DECOMPRESSOR=gunzip + MK_DECOMPRESSOR_TEST_FLAG="-t" + elif [ "$MK_EXTENSION" = "tar.bz2" -o "$MK_EXTENSION" = "bz2" ]; then + MK_DECOMPRESSOR=bunzip2 + MK_DECOMPRESSOR_TEST_FLAG="-t" + else + edit_decompress_arg + [ $? -eq 100 ] && return 100 + fi +} + +# Enable MD5 or GPG signature check +function edit_signature() +{ + # GPG and MD5 test + local ANS=0 + + ANS=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" \ + --title "$MK_TITLE" --menu "Select code validate type:" 0 0 0 \ + "1" "gpg signature" \ + "2" "md5sum" \ + "0" "none"` + + case $ANS in + 1) + edit_gpg + ;; + 2) + edit_md5sum + ;; + esac +} + +# Enable GPG signature check +function edit_gpg() +{ + dialog --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" \ + --title "$MK_TITLE" --msgbox "Enter with gpg minimized signing key." 5 50 + $EDITOR $MK_GPGFILEKEY +} + +# Enable MD5SUM signature check +function edit_md5sum() +{ + echo "none" +} + +#-------------------------------------------------------------------- +# Main functions +#-------------------------------------------------------------------- +# Create new SlackBuild +function create_slackbuild() +{ + # Config package URL + edit_url + [ $? -eq 100 ] && return 100 + + # Source Name + edit_source_name + [ $? -eq 100 ] && return 100 + + # Package name, version and extension + edit_pkgname + [ $? -eq 100 ] && return 100 + + # Compile arch + edit_arch + [ $? -eq 100 ] && return 100 + + # Set source test variables + set_source_test + [ $? -eq 100 ] && return 100 + + # Get source file + MK_SOURCE=$MK_SOURCEDIR/$MK_PKGNAME/$MK_SRCNAME + get_source_dialog + [ $? -eq 100 ] && return 100 + + # Test source + test_source + [ $? -eq 100 ] && return 100 + + # Uncompress source + unpkg_source + [ $? -eq 100 ] && return 100 + + # GPG and MD5 test +# edit_signature + + # Configure compiler options if exist + if [ -e $MK_TMPSRC/configure ]; then + edit_configure + fi + + # Edit documentation list + edit_docfiles + + # Create files sections + make_file_sections $SB_MODEL + + # SlackBuild script name + SLACKBUILD=$BASEDIR/$MK_PKGNAME.SlackBuild + + # mkSlackBuild script name + # FIXME: make an MODELDIR??? + MKSLACKBUILD=$BASEDIR/$MK_PKGNAME.mkslackbuild + + mk_slackdesc > slackdesc_$MK_PKGNAME.mkbuild + + # Edit builds sections + start_build + + # Main-Menu + edit_menu +} + +# Open mkslackbuild dialog input +function open_mkslackbuild_dialog() +{ + MKSLACKBUILD=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" \ + --title " Select source file name: " \ + --fselect "$BASEDIR/" 10 70` + [ $? -ne 0 ] && return 100 + + open_mkslackbuild + [ $? -eq 100 ] || return 100 +} + +# Open mkslackbuild +function open_mkslackbuild() +{ + if [ -f $MKSLACKBUILD ]; then + # Start defaults variables + source $MKSLACKBUILD + + # SlackBuild scrit name + SLACKBUILD=$BASEDIR/$MK_PKGNAME.SlackBuild + + # Create files sections + make_file_sections $MKSLACKBUILD + + [ -e $BASEDIR/slack-required ] && ( cp $BASEDIR/slack-required $DEPENDENCY_LIST ) + + else + dialog --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" \ + --title "$MK_TITLE" --msgbox "$MKSLACKBUILD most be a mkslackbuild file" 6 45 + return 100 + fi + + # CHECK: + # Set source test vadiables + set_source_test + [ $? -eq 100 ] && return 100 + + # Get source file + get_source_dialog + [ $? -eq 100 ] && return 100 + + # Test source + test_source + + # Uncompress source + unpkg_source +} + +# Save mkSlackBuild +function save_mkslackbuild() +{ + dialog --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --infobox "mkSlackBuild save in $MKSLACKBUILD" 5 30 + + rm $MKSLACKBUILD 2>/dev/null + echo '#!/bin/bash' > $MKSLACKBUILD + echo -e "# mkSlackBuild version $MK_VERSION\n" >> $MKSLACKBUILD + echo "MK_SRC_NAME=\"$MK_SRC_NAME\"" >> $MKSLACKBUILD + echo "MK_SRCNAME=\"$MK_SRCNAME\"" >> $MKSLACKBUILD + echo "MK_PKGNAME=\"$MK_PKGNAME\"" >> $MKSLACKBUILD + echo "MK_URL=\"$MK_URL\"" >> $MKSLACKBUILD + echo "MK_AUTHOR=\"$MK_AUTHOR\"" >> $MKSLACKBUILD + echo "MK_AUTHOR_INITIALS=\"$MK_AUTHOR_INITIALS\"" >> $MKSLACKBUILD + echo "MK_VERSION=\"$MK_VERSION\"" >> $MKSLACKBUILD + echo "MK_EXTENSION=\"$MK_EXTENSION\"" >> $MKSLACKBUILD + echo "MK_DECOMPRESSOR=\"$MK_DECOMPRESSOR\"" >> $MKSLACKBUILD + echo "MK_DECOMPRESSOR_TEST_FLAG=\"$MK_DECOMPRESSOR_TEST_FLAG\"" >> $MKSLACKBUILD + echo "MK_DOCFILES=\"$MK_DOCFILES\"" >> $MKSLACKBUILD + echo "MK_OPTIONS=\"$MK_OPTIONS\"" >> $MKSLACKBUILD + echo "MK_PREFIX=\"$MK_PREFIX\"" >> $MKSLACKBUILD + echo "MK_MD5SUM_EXT=\"$MK_MD5SUM_EXT\"" >> $MKSLACKBUILD + echo -e "return 0\n\n" >> $MKSLACKBUILD + + for i in `seq 0 $MAXSECTION`; do + echo "<${SECTION_NAME[i]}> ${SECTION_FLAG[i]}" >> $MKSLACKBUILD + cat ${SECTION_NAME[i]}_$MK_PKGNAME.mkbuild >> $MKSLACKBUILD + echo "" >> $MKSLACKBUILD + echo "" >> $MKSLACKBUILD + done + + [ -s $DEPENDENCY_LIST ] && cp $DEPENDENCY_LIST $BASEDIR/slack-required +} + +# Edit Menu +function edit_menu() +{ + ANSE=0 + while [ $ANSE -ne 1 ]; do + # Create main-menu string + EDITMENU="" + for i in `seq 0 $MAXSECTION`; do + #echo "${SECTION_NAME[i]} ${SECTION_FLAG[i]} ${SECTION_FILE[i]}" + EDITMENU="$EDITMENU ${SECTION_NAME[i]} ${SECTION_FLAG[i]}" + done + + SELECT=`eval "dialog --stdout --backtitle \"Make SlackBuild $PROG_VERSION [$MK_PKGNAME]\" --ok-label \"Edit\" --cancel-label \"Main Menu\" --title \"$MK_TITLE\" --menu \"Select one section to edit\" 20 40 13 $EDITMENU"` + ANSE=$? + if [ $ANSE -ne 1 ]; then + STATUS=`mk_status $SELECT` + if [ $? -ne 0 ]; then + echo "Section name error..." + mk_exit 1 + fi + FLAG=`echo $STATUS | awk '{print $1}'` + INDEX=`echo $STATUS | awk '{print $2}'` + if [ "$FLAG" = "on" ]; then + SECTION_FLAG[$INDEX]=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --radiolist "Change $SELECT status?" 0 0 0 "on" "enable section" "on" "off" "desable section" "off"` + elif [ "$FLAG" = "off" ]; then + SECTION_FLAG[$INDEX]=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --radiolist "Change $SELECT status?" 0 0 0 "on" "enable section" "off" "off" "desable section" "on"` + fi + if [ $? -eq 0 ]; then + if [ "${SECTION_FLAG[$INDEX]}" = "on" -o "${SECTION_FLAG[$INDEX]}" = "all" ]; then + if [ "$SELECT" = "md5sum_download_and_check" ]; then + md5sum_edit ${SELECT}_${MK_PKGNAME}.mkbuild +# elif [ "$SELECT" = "gpg_signature_check" ]; then +# gpg_edit + else + $MK_EDITOR ${SELECT}_${MK_PKGNAME}.mkbuild + fi + fi + else + SECTION_FLAG[$INDEX]=$FLAG + fi + fi + done +} + +# Edit md5sum +function md5sum_edit() +{ + local SELECT=0 + local FILE=$1 + + if ( grep '\[\[MD5SUM EXTENSION\]\]' $FILE &>/dev/null ); then + SELECT=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --radiolist "Select one option" 0 0 0 "1" "$MK_SRC_NAME-$MK_VERSION.[[MD5SUM EXT]]" on "2" "$MK_SRCNAME.[[MD5SUM EXT]]" off "3" "MK5SUM CODE" off` + + case $SELECT in + 1) + MK_MD5SUM_EXT="md5sum" + MK_MD5SUM_EXT=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --inputbox "Enter with md5sum extension:" 8 50 $MK_MD5SUM_EXT` + edit_file "MD5SUM EXTENSION" "$MK_MD5SUM_EXT" $FILE + ;; + 2) + MK_MD5SUM_EXT="md5" + MK_MD5SUM_EXT=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --inputbox "Enter with md5sum extension:" 8 50 $MK_MD5SUM_EXT` + eval "sed 's/^MD5SUM_FILE.*$/MD5SUM_FILE=\$SRC.$MK_MD5SUM_EXT/' $FILE > $AUX_TMP" + cp $AUX_TMP $FILE + ;; + 3) + MK_MD5SUM_CODE=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --inputbox "Enter with md5sum extension:" 8 50 $MK_MD5SUM_CODE` + sed '1! d' $FILE > $AUX_TMP + sed -n '2, /^fi/ p' $FILE | while read LINE; do echo "#$LINE" >> $AUX_TMP; done + sed -n '/^fi/, $ { /^fi/ b; p; }' $FILE >> $AUX_TMP + eval "sed 's/^MD5SUM_SRC.*/MD5SUM_SRC=\"$MK_MD5SUM_CODE\"/' $AUX_TMP > $FILE" + ;; + esac + fi + + $MK_EDITOR $FILE +} + +# Test Menu +function test_menu() +{ + local ANST=0 + local SECTION=0 + local EDITMENU="" + + # Create main-menu string + for i in `seq 0 $MAXSECTION`; do + if [ "${SECTION_FLAG[i]}" = "all" -o "${SECTION_FLAG[i]}" = "on" ]; then + EDITMENU="$EDITMENU $i ${SECTION_NAME[i]}" + fi + done + + EDITMENU="all \"SlackBuild\" $EDITMENU" + + while [ "$ANST" != "1" ]; do + SECTION=`eval "dialog --stdout --backtitle \"Make SlackBuild $PROG_VERSION [$MK_PKGNAME]\" --cancel-label \"Exit\" --title \"$MK_TITLE\" --menu \"Select section to test end\" 20 40 13 $EDITMENU"` + ANST=$? + + if [ $ANST -ne 1 ]; then + [ "$SECTION" = "all" ] && SECTION=$MAXSECTION + mount_slackbuild_to $SECTION + + # FIXME: -> sintaxe check + clear + echo "---------------------------------------------------------" + echo " --= SINTAX CHECK =--" + sh -n $SLACKBUILD.test + if [ $? -eq 0 ]; then + echo " --= 0K =--" + DEBUG=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" \ + --cancel-label "no debug" --title "$MK_TITLE" \ + --menu "Select debug level" 10 35 3 \ + "-x" "Simple debug" \ + "-xv" "More information" \ + "none" "No debug"` + + [ $? -ne 0 -o "$DEBUG" = "none" ] && DEBUG="" + + clear + echo "---------------------------------------------------------" + echo " --= START BUILDING =--" + if [ "$USER" != "root" ]; then + su -c "( sh $DEBUG $SLACKBUILD.test )" + else + ( sh $DEBUG $SLACKBUILD.test ) + fi + echo "---------------------------------------------------------" + echo " --= END =--" + + echo -n "Enter 1 to end test: " + read ANST + else + echo "Script error..." + read ANST + fi + fi + done +} + +# Dependency Menu +function menu_dependency() +{ + local ANSD=11 + while [ $ANSD -ne 0 ]; do + ANSD=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" \ + --cancel-label "Main Menu" --title "$MK_TITLE" --menu "Main Menu:" 0 0 0 \ + "1" "Edit dependency list" \ + "2" "Test dependency list"` + + [ $? -ne 0 ] && ANSD=0 + + case $ANSD in + 1) + edit_dependency + ;; + 2) + test_dependency + ;; + esac + done +} + +# Dependency list edit +function edit_dependency() +{ + if [ ! -s $DEPENDENCY_LIST ]; then + echo -e "# Dependency list to $MK_PKGNAME\n# \n# dependency [condition] [version]]\n" > $DEPENDENCY_LIST + fi + + $MK_EDITOR $DEPENDENCY_LIST +} + +# Check dependency and comment not found dependencies +function test_dependency() +{ + local DEP_LIST="" + + if [ -s $DEPENDENCY_LIST ]; then + for i in `grep '^[^#]' $DEPENDENCY_LIST | awk '{print $1}' | sort | uniq`; do + if [ `ls /var/log/packages/$i-[0-9]* 2>/dev/null` ]; then + DEP_LIST="$DEP_LIST $i \"intalled\" off" + else + DEP_LIST="$DEP_LIST $i \"unintalled\" on" + fi + done + + DEP_SELECT=`eval "dialog --stdout --separate-output --backtitle \"Make SlackBuild $PROG_VERSION [$MK_PKGNAME]\" --title \"$MK_TITLE\" --checklist \"Select packages to remove from dependency list:\" 0 0 0 $DEP_LIST"` + # 20 45 13 + + for i in $DEP_SELECT; do + eval "sed 's/$i$/#$i/' $DEPENDENCY_LIST > $AUX_TMP " + eval "sed 's/$i /#$i /' $AUX_TMP > $DEPENDENCY_LIST" + eval "sed 's/$i\t/#$i\t/' $DEPENDENCY_LIST > $AUX_TMP" + cp $AUX_TMP $DEPENDENCY_LIST + done + fi +} + +# Add/commit one SlackBuild +function commit_SlackBuild() +{ + # Mount SlackBuild + mount_slackbuild + MK_TITLE="Commit SlackBuild" + + # Find SlackBuild + SB_PATH=`find $MK_SLACKBUILD_DIR -iname $MK_PKGNAME` + + # Change to SlackBuild directory + cd $MK_SLACKBUILD_DIR + + # Check for new SlackBuild + if [ -z $SB_PATH ]; then + # New SlackBuild + AUX="" + while [ -z $AUX ]; do + dialog --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --infobox "lynx -dump http://gentoo-portage.com/Search?search=$MK_PKGNAME. Wait..." 0 0 + AUX=`lynx -dump http://gentoo-portage.com/Search?search=$MK_PKGNAME | sed -n '/Results:/,+1 { /Results:/ b ; p }' | head --lines=1 | tr -d " "` + # Default directory + if [ -z $AUX ]; then + dialog --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --yesno "Net search error. Try again?" 0 0 + if [ $? -ne 0 ]; then + AUX="/others/unclass" + SB_PATH=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --inputbox "Enter dir-name to SlackBuild from $MK_PKGNAME:" 8 60 "$AUX"` + fi + else + SB_PATH="`dirname $AUX | tr - /`/`basename $AUX`" + fi + done + # Make directory and add SlackBuild to svn + svn mkdir $SB_PATH + cp $BASEDIR/$MK_PKGNAME.SlackBuild $SB_PATH/ + svn add $SB_PATH/$MK_PKGNAME.SlackBuild + if [ -e $BASEDIR/slack-required ]; then + cp $BASEDIR/slack-required $SB_PATH/ + svn add $SB_PATH/slack-required + fi + else + echo "cp $BASEDIR/$MK_PKGNAME.SlackBuild $SB_PATH/" + if [ -e $BASEDIR/slack-required ]; then + cp $BASEDIR/slack-required $SB_PATH/ + fi + fi + + # Commit SlackBuild + MK_MSG=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --inputbox "Enter message do commit command:" 8 60` + svn commit -m "$MK_PKGNAME: $MK_MSG" + + cd $BASEDIR + + echo -e "\nPress ENTER to continue." + read ANS1 +} + +# Compile SlackBuild and install +function compile_install() +{ + local ANS="" + # Mount SlackBuild + mount_slackbuild + + # Clean temporary file + echo " " > $AUX_TMP + + if [ "$USER" = "root" ]; then + # Root user + # Compile pid + PID=`exec-slackbuild $SLACKBUILD $AUX_TMP` + + # Tail messages + tail -s .1 --pid=$PID -f $AUX_TMP + + # Package name + PACKAGE=`tail -10 $AUX_TMP | grep "^Moving $MK_PKGNAME-[0-9].*\.\.\.$" | awk '{ print $2 }' | grep "$MK_PKGNAME-.*\.tgz$"` + + # Install package + if [ ! -z $PACKAGE ]; then + installpkg $MK_REPOS/$PACKAGE + else + echo -e "\nBuild error!" + fi + else + # Commum users + # Compile pid + PID=`su -c "exec-slackbuild $SLACKBUILD $AUX_TMP"` + + # Tail messages + tail -s .1 --pid=$PID -f $AUX_TMP + + # Package name + PACKAGE=`tail -10 $AUX_TMP | grep "^Moving $MK_PKGNAME-[0-9].*\.\.\.$" | awk '{ print $2 }' | grep "$MK_PKGNAME-.*\.tgz$"` + + # Install package + if [ ! -z $PACKAGE ]; then + su -c "installpkg $MK_REPOS/$PACKAGE" + else + echo -e "\nBuild error!" + fi + fi + + echo -e "\nPress ENTER to continue." + read ANS +} + +# +#-------------------------------------------------------------------- +# Start Program +#-------------------------------------------------------------------- +# +# Start variables +LANG=en_US +BASEDIR=`pwd` +AUX_TMP=`mktemp -p /tmp/ aux_tmp.XXXXXX` +SLACKDESC_TMP=`mktemp -p /tmp/ slackdesc_tmp.XXXXXX` +SLACKDESC_LEN=77 +DEPENDENCY_LIST=`mktemp -p /tmp/ slack-required.XXXXXX` +if [ -z $SB_MODEL ]; then + if [ -e ~/.generic.mkSlackBuild ]; then + SB_MODEL=~/.generic.mkSlackBuild + elif [ -e /etc/simplepkg/generic.mkSlackBuild ]; then + SB_MODEL=/etc/simplepkg/generic.mkSlackBuild + else + echo "SlackBuild model (generic.mkSlackBuild) not found" + mk_exit 0 + fi +fi +[ $# -ne 0 ] && MKSLACKBUILD=${1//.*}.mkslackbuild + +# Clear dialog +dialog --clear + +# Load/create personal definitions +if [ ! -e ~/.mkslackbuild ]; then + ( cat << EOF > ~/.mkslackbuild +#!/bin/bash +# mkslackbuild definitions +# +MK_AUTHOR="[[AUTHOR NAME]]" +MK_AUTHOR_INITIALS="[[AUTHOR INITIALS]]" +MK_EDITOR=[[EDITOR]] +MK_REPOS=[[REPOS DIR]] +MK_LIMITRATE=[[LIMIT RATE]] +MK_SOURCEDIR=[[SOURCE DIR]] +MK_ARCH=[[DEFAULT ARCH]] +MK_SLACKBUILD_DIR=[[SLACKBUILD DIR]] +#SB_MODEL="my_model" +EOF +) +fi +source ~/.mkslackbuild +MK_SOURCEDIR=${MK_SOURCEDIR:=$BASEDIR} +MK_ARCH=${MK_ARCH:="i486"} + +# Config Author +if [ "$MK_AUTHOR" = "[[AUTHOR NAME]]" ]; then + MK_TITLE=" Personal Config " + edit_author + MK_TITLE="" +fi + +if [ ! -z $MKSLACKBUILD ]; then + MK_TITLE=" Open mkSlackBuild " + open_mkslackbuild +fi + +MK_TITLE="" + +ANS0=11 +while [ $ANS0 -ne 0 ]; do + if [ -z $MK_PKGNAME ]; then + ANS0=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" \ + --cancel-label "Exit" --menu "Main Menu:" 0 0 0 \ + "1" "Create New SlackBuild" \ + "2" "Open mkSlackBuild" \ + "0" "Exit"` + + if [ $? -ne 0 ]; then + ANS0=0 + fi + + case $ANS0 in + 1) + MK_TITLE=" Create SlackBuild " + create_slackbuild + [ $? -eq 100 ] && MK_PKGNAME="" + ;; + 2) + MK_TITLE=" Open mkSlackBuild " + open_mkslackbuild_dialog + [ $? -eq 100 ] && MK_PKGNAME="" + ;; + *) + echo "Exit..." + ANS0=0 + ;; + esac + MK_TITLE="" + else + ANS0=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" \ + --cancel-label "Exit" --menu "Main Menu:" 0 0 0 \ + "1" "Edit SlackBuild sections" \ + "2" "Edit dependency list" \ + "3" "Test SlackBuild script" \ + "4" "View Doc-Files" \ + "5" "Save SlackBuild and mkslackbuild" \ + "6" "Compile/install package" \ + "7" "Remove package" \ + "8" "Commit SlackBuild to Sarava"` + + if [ $? -ne 0 ]; then + ANS0=0 + fi + case $ANS0 in + 1) # Edit Sections + MK_TITLE=" Edit Menu " + edit_menu + ;; + 2) # Dependency Menu + MK_TITLE=" Dependency Menu " + menu_dependency + ;; + 3) # Test Script + MK_TITLE=" Test Menu " + test_menu + ;; + 4) # View Doc-Files + MK_TITLE=" View Docs " + view_docs + ;; + 5) # Save SlackBuild + save_mkslackbuild + mount_slackbuild + ;; + 6) # Compile/install package + compile_install + ;; + 7) # Remove package + if [ "$USER" = "root" ]; then + removepkg $MK_PKGNAME + else + su -c "( removepkg $MK_PKGNAME )" + fi + echo -e "\nPress ENTER to continue." + read ANS1 + ;; + 8) # Commit SlackBuild to Sarava + commit_SlackBuild + ;; + 0) # Exit + ANS0=0 + ;; + esac + MK_TITLE="" + fi +done + +# Check changes +if [ ! -z $MK_PKGNAME ]; then + md5sum -c md5sum + if [ $? -ne 0 ]; then + MKSLACKBUILD=$BASEDIR/$MK_PKGNAME.mkslackbuild + save_mkslackbuild + mount_slackbuild + fi +fi + +mk_exit 0 +# _________________________________END_______________________________ diff --git a/branches/0.6/src/mkjail b/branches/0.6/src/mkjail new file mode 100755 index 0000000..f6c935c --- /dev/null +++ b/branches/0.6/src/mkjail @@ -0,0 +1,113 @@ +#!/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 new file mode 100755 index 0000000..6d3d10c --- /dev/null +++ b/branches/0.6/src/rebuildpkg @@ -0,0 +1,87 @@ +#!/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 new file mode 100755 index 0000000..e4a17ee --- /dev/null +++ b/branches/0.6/src/repos @@ -0,0 +1,87 @@ +#!/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 new file mode 100755 index 0000000..00b0c25 --- /dev/null +++ b/branches/0.6/src/simplaret @@ -0,0 +1,1045 @@ +#!/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