From bc402596d91bf4a743f9892840e10f360652ba8a Mon Sep 17 00:00:00 2001 From: rhatto Date: Fri, 13 Jul 2007 16:28:05 +0000 Subject: tagged trunk/ rev. 400 as simplepkg 0.5 git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@401 04377dda-e619-0410-9926-eae83683ac58 --- tags/0.5/README | 2 + tags/0.5/conf/generic.mkSlackBuild.new | 250 +++++ tags/0.5/conf/repos.conf.new | 41 + tags/0.5/conf/simplepkg.conf.new | 152 +++ tags/0.5/doc/CHANGELOG | 404 +++++++ tags/0.5/doc/COPYING | 340 ++++++ tags/0.5/doc/README | 428 ++++++++ tags/0.5/doc/README.pt_BR | 444 ++++++++ tags/0.5/doc/README.simplaret | 319 ++++++ tags/0.5/doc/README.simplaret.pt_BR | 445 ++++++++ tags/0.5/doc/TODO | 5 + tags/0.5/doc/mkbuild.tex | 627 +++++++++++ tags/0.5/doc/simplepkg.pdf | Bin 0 -> 96342 bytes tags/0.5/doc/simplepkg.tex | 395 +++++++ tags/0.5/install/doinst.sh | 3 + tags/0.5/install/slack-desc | 19 + tags/0.5/lib/common.sh | 712 ++++++++++++ tags/0.5/simplepkg.SlackBuild | 73 ++ tags/0.5/src/createpkg | 501 +++++++++ tags/0.5/src/jail-commit | 175 +++ tags/0.5/src/jail-update | 61 ++ tags/0.5/src/lspkg | 132 +++ tags/0.5/src/mkbuild | 680 ++++++++++++ tags/0.5/src/mkjail | 113 ++ tags/0.5/src/rebuildpkg | 87 ++ tags/0.5/src/repos | 87 ++ tags/0.5/src/simplaret | 1131 ++++++++++++++++++++ tags/0.5/src/templatepkg | 980 +++++++++++++++++ .../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 + tags/0.5/templates/openoffice/openoffice.perms | 0 .../openoffice/openoffice.s/post-install.sh | 22 + tags/0.5/templates/openoffice/openoffice.template | 60 ++ tags/0.5/templates/slackware/slackware.perms | 0 tags/0.5/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 tags/0.5/templates/vserver/vserver.d/etc/hosts | 21 + .../vserver/vserver.d/etc/logrotate.d/apache | 11 + tags/0.5/templates/vserver/vserver.d/etc/profile | 87 ++ tags/0.5/templates/vserver/vserver.d/etc/rc.d/rc | 11 + tags/0.5/templates/vserver/vserver.d/etc/rc.d/rc.0 | 110 ++ tags/0.5/templates/vserver/vserver.d/etc/rc.d/rc.4 | 256 +++++ tags/0.5/templates/vserver/vserver.d/etc/rc.d/rc.6 | 110 ++ tags/0.5/templates/vserver/vserver.d/etc/rc.d/rc.K | 88 ++ tags/0.5/templates/vserver/vserver.d/etc/rc.d/rc.M | 256 +++++ tags/0.5/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 + tags/0.5/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 + tags/0.5/templates/vserver/vserver.perms | 37 + tags/0.5/templates/vserver/vserver.s/GPG-KEY | 88 ++ .../0.5/templates/vserver/vserver.s/devices.tar.gz | Bin 0 -> 320 bytes tags/0.5/templates/vserver/vserver.s/vserver.sh | 55 + tags/0.5/templates/vserver/vserver.template | 250 +++++ tags/0.5/utils/add-gpl | 33 + tags/0.5/utils/add-slack-required | 63 ++ tags/0.5/utils/convert-template-scheme | 35 + tags/0.5/utils/merge-template | 37 + tags/0.5/utils/metapkg | 72 ++ tags/0.5/utils/searchpkg | 36 + 110 files changed, 19084 insertions(+) create mode 100644 tags/0.5/README create mode 100644 tags/0.5/conf/generic.mkSlackBuild.new create mode 100644 tags/0.5/conf/repos.conf.new create mode 100644 tags/0.5/conf/simplepkg.conf.new create mode 100644 tags/0.5/doc/CHANGELOG create mode 100644 tags/0.5/doc/COPYING create mode 100644 tags/0.5/doc/README create mode 100644 tags/0.5/doc/README.pt_BR create mode 100644 tags/0.5/doc/README.simplaret create mode 100644 tags/0.5/doc/README.simplaret.pt_BR create mode 100644 tags/0.5/doc/TODO create mode 100644 tags/0.5/doc/mkbuild.tex create mode 100644 tags/0.5/doc/simplepkg.pdf create mode 100644 tags/0.5/doc/simplepkg.tex create mode 100644 tags/0.5/install/doinst.sh create mode 100644 tags/0.5/install/slack-desc create mode 100644 tags/0.5/lib/common.sh create mode 100755 tags/0.5/simplepkg.SlackBuild create mode 100644 tags/0.5/src/createpkg create mode 100755 tags/0.5/src/jail-commit create mode 100755 tags/0.5/src/jail-update create mode 100755 tags/0.5/src/lspkg create mode 100755 tags/0.5/src/mkbuild create mode 100755 tags/0.5/src/mkjail create mode 100755 tags/0.5/src/rebuildpkg create mode 100755 tags/0.5/src/repos create mode 100755 tags/0.5/src/simplaret create mode 100755 tags/0.5/src/templatepkg create mode 100755 tags/0.5/templates/openoffice/openoffice.d/etc/profile.d/lang.csh create mode 100755 tags/0.5/templates/openoffice/openoffice.d/etc/profile.d/lang.sh create mode 120000 tags/0.5/templates/openoffice/openoffice.d/opt/OpenOffice.org create mode 100644 tags/0.5/templates/openoffice/openoffice.perms create mode 100755 tags/0.5/templates/openoffice/openoffice.s/post-install.sh create mode 100644 tags/0.5/templates/openoffice/openoffice.template create mode 100644 tags/0.5/templates/slackware/slackware.perms create mode 100644 tags/0.5/templates/slackware/slackware.template create mode 100644 tags/0.5/templates/vserver-legacy/vserver-legacy.d/etc/apache/httpd.conf create mode 100644 tags/0.5/templates/vserver-legacy/vserver-legacy.d/etc/apache/php.ini create mode 100644 tags/0.5/templates/vserver-legacy/vserver-legacy.d/etc/apache/vhosts create mode 100644 tags/0.5/templates/vserver-legacy/vserver-legacy.d/etc/hosts create mode 100644 tags/0.5/templates/vserver-legacy/vserver-legacy.d/etc/logrotate.d/apache create mode 100644 tags/0.5/templates/vserver-legacy/vserver-legacy.d/etc/profile create mode 100755 tags/0.5/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.0 create mode 100644 tags/0.5/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.4 create mode 100755 tags/0.5/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.6 create mode 100755 tags/0.5/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.K create mode 100755 tags/0.5/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.M create mode 100755 tags/0.5/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.S create mode 100644 tags/0.5/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.httpd create mode 100755 tags/0.5/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.inet2 create mode 100644 tags/0.5/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.inetd create mode 100644 tags/0.5/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.ip_forward create mode 100755 tags/0.5/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.local create mode 100644 tags/0.5/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.mysqld create mode 100644 tags/0.5/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.postfix create mode 100644 tags/0.5/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.sendmail create mode 100755 tags/0.5/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.serial create mode 100755 tags/0.5/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.sshd create mode 100755 tags/0.5/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.syslog create mode 100755 tags/0.5/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.sysvinit create mode 100644 tags/0.5/templates/vserver-legacy/vserver-legacy.d/etc/rssh.conf create mode 100644 tags/0.5/templates/vserver-legacy/vserver-legacy.d/etc/ssh/sshd_config create mode 100644 tags/0.5/templates/vserver-legacy/vserver-legacy.d/var/www/htdocs/missing.html create mode 100644 tags/0.5/templates/vserver-legacy/vserver-legacy.d/var/www/missing.html create mode 100644 tags/0.5/templates/vserver-legacy/vserver-legacy.perms create mode 100644 tags/0.5/templates/vserver-legacy/vserver-legacy.s/GPG-KEY create mode 100644 tags/0.5/templates/vserver-legacy/vserver-legacy.s/devices.tar.gz create mode 100644 tags/0.5/templates/vserver-legacy/vserver-legacy.s/skel.conf create mode 100644 tags/0.5/templates/vserver-legacy/vserver-legacy.s/vserver-legacy.sh create mode 100644 tags/0.5/templates/vserver-legacy/vserver-legacy.template create mode 100644 tags/0.5/templates/vserver/vserver.d/etc/apache/httpd.conf create mode 100644 tags/0.5/templates/vserver/vserver.d/etc/apache/php.ini create mode 100644 tags/0.5/templates/vserver/vserver.d/etc/apache/vhosts create mode 100644 tags/0.5/templates/vserver/vserver.d/etc/hosts create mode 100644 tags/0.5/templates/vserver/vserver.d/etc/logrotate.d/apache create mode 100644 tags/0.5/templates/vserver/vserver.d/etc/profile create mode 100755 tags/0.5/templates/vserver/vserver.d/etc/rc.d/rc create mode 100755 tags/0.5/templates/vserver/vserver.d/etc/rc.d/rc.0 create mode 100644 tags/0.5/templates/vserver/vserver.d/etc/rc.d/rc.4 create mode 100755 tags/0.5/templates/vserver/vserver.d/etc/rc.d/rc.6 create mode 100755 tags/0.5/templates/vserver/vserver.d/etc/rc.d/rc.K create mode 100755 tags/0.5/templates/vserver/vserver.d/etc/rc.d/rc.M create mode 100755 tags/0.5/templates/vserver/vserver.d/etc/rc.d/rc.S create mode 100644 tags/0.5/templates/vserver/vserver.d/etc/rc.d/rc.httpd create mode 100755 tags/0.5/templates/vserver/vserver.d/etc/rc.d/rc.inet2 create mode 100644 tags/0.5/templates/vserver/vserver.d/etc/rc.d/rc.inetd create mode 100644 tags/0.5/templates/vserver/vserver.d/etc/rc.d/rc.ip_forward create mode 100755 tags/0.5/templates/vserver/vserver.d/etc/rc.d/rc.local create mode 100644 tags/0.5/templates/vserver/vserver.d/etc/rc.d/rc.mysqld create mode 100644 tags/0.5/templates/vserver/vserver.d/etc/rc.d/rc.postfix create mode 100644 tags/0.5/templates/vserver/vserver.d/etc/rc.d/rc.sendmail create mode 100755 tags/0.5/templates/vserver/vserver.d/etc/rc.d/rc.serial create mode 100755 tags/0.5/templates/vserver/vserver.d/etc/rc.d/rc.sshd create mode 100755 tags/0.5/templates/vserver/vserver.d/etc/rc.d/rc.syslog create mode 100755 tags/0.5/templates/vserver/vserver.d/etc/rc.d/rc.sysvinit create mode 100644 tags/0.5/templates/vserver/vserver.d/etc/rssh.conf create mode 100644 tags/0.5/templates/vserver/vserver.d/etc/ssh/sshd_config create mode 100644 tags/0.5/templates/vserver/vserver.d/var/www/htdocs/missing.html create mode 100644 tags/0.5/templates/vserver/vserver.d/var/www/missing.html create mode 100644 tags/0.5/templates/vserver/vserver.perms create mode 100644 tags/0.5/templates/vserver/vserver.s/GPG-KEY create mode 100644 tags/0.5/templates/vserver/vserver.s/devices.tar.gz create mode 100644 tags/0.5/templates/vserver/vserver.s/vserver.sh create mode 100644 tags/0.5/templates/vserver/vserver.template create mode 100755 tags/0.5/utils/add-gpl create mode 100755 tags/0.5/utils/add-slack-required create mode 100755 tags/0.5/utils/convert-template-scheme create mode 100755 tags/0.5/utils/merge-template create mode 100755 tags/0.5/utils/metapkg create mode 100755 tags/0.5/utils/searchpkg diff --git a/tags/0.5/README b/tags/0.5/README new file mode 100644 index 0000000..d4d1463 --- /dev/null +++ b/tags/0.5/README @@ -0,0 +1,2 @@ +See doc/README for more information. +Portuguese documentation at doc/README.pt_BR. diff --git a/tags/0.5/conf/generic.mkSlackBuild.new b/tags/0.5/conf/generic.mkSlackBuild.new new file mode 100644 index 0000000..6b5473e --- /dev/null +++ b/tags/0.5/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/tags/0.5/conf/repos.conf.new b/tags/0.5/conf/repos.conf.new new file mode 100644 index 0000000..1d77419 --- /dev/null +++ b/tags/0.5/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/tags/0.5/conf/simplepkg.conf.new b/tags/0.5/conf/simplepkg.conf.new new file mode 100644 index 0000000..50ea4ad --- /dev/null +++ b/tags/0.5/conf/simplepkg.conf.new @@ -0,0 +1,152 @@ +# +# /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="1" + +# 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="curl" + +# Ftp retrieval tool; +# available parameters are "wget", "curl" or "ncftpget" +FTP_TOOL="curl" + +# 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" + +#--------------------------------------------------------------------- +# MKBUILD AND CREATEPKG SECTION +#--------------------------------------------------------------------- +# Set SlackBuilds default directory from scripts +SLACKBUILDS_DIR="/var/slackbuilds" + +# Set binaries default repository directory +#MAKEPKG_REPOS="/var/createpkg" + +# Set sources default directory +#SOURCE_DIR="/var/sources" + +# Set color style +# possible values are: color,gray, none +#COLOR_MODE="none" + +# Remove old packages from repository tree by createpkg +# 0 enable +# 1 desable +#REMOVE_OLD_PACKAGE=1 + +# Move package to SlackBuilds-like tree +# 0 enable +# 1 desable +#MOVE_BIN_PACKAGE=1 + +#--------------------------------------------------------------------- diff --git a/tags/0.5/doc/CHANGELOG b/tags/0.5/doc/CHANGELOG new file mode 100644 index 0000000..1a98742 --- /dev/null +++ b/tags/0.5/doc/CHANGELOG @@ -0,0 +1,404 @@ +simplepkg changelog +=================== + +0.5pre23 +======== + + - updated documentation + +0.5pre22 +======== + + - simplaret: + - small fix + - common.sh: + - fixes on metafiles generation + +0.5pre21 +======== + + - templatepkg: + - now --delete can also remove the file from a jail + +0.5pre20 +======== + + - small changes + - jail-commit: + - template files security + +0.5pre19 +======== + + - simplaret: + - bugfixes + - options --get and --install now can work + with full file name. + +0.5pre15-18 +=========== + + - bugfixes + +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/tags/0.5/doc/COPYING b/tags/0.5/doc/COPYING new file mode 100644 index 0000000..d60c31a --- /dev/null +++ b/tags/0.5/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/tags/0.5/doc/README b/tags/0.5/doc/README new file mode 100644 index 0000000..47143ca --- /dev/null +++ b/tags/0.5/doc/README @@ -0,0 +1,428 @@ +Simplepkg: installation manager and packaging system +---------------------------------------------------- + +Author: Silvio Rhatto +Licence: GPL + +Simplepkg is a non-intrusive management system running on top of pkgtool made of a +set of scripts which helps the sysadmin and developing cycles of an slackware system. +It can be used to create packages and repositories as long as the operational system +installation and config file change tracking. + +Documentation +------------- + + English documentation: README | http://slack.sarava.org/simplepkg-en + Portuguese documentation: REAMDE.pt_BR | http://slack.sarava.org/simplepkg + +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. + +Package and installation management is not everything simplepkg can do. It can also be used +to create vservers, create packages and store system configuration files in a subversion +repository. + +Simplepkg works with any (official or not) slackware port that follows the minimum system +guidelines. + +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 + - templatepkg: create or update a package list of an installation template + - lspkg: show installed packages and its contents + - jail-commit: update all configuration files of a template + - jail-update: jail-commit counterpart + - rebuildpkg: rebuild a package based on its /var/log/packages entry + - simplaret: package retrieval tool + - createpkg: donwload, compile and package creationg script + - repos: creates and manages binary repositories + - mkbuild: app to build slackware build scripts + +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 + +Simplepkg usage +--------------- + +The three main simplepkg uses are: + + - Package managemen + - Jail/installation creation and management + - Package creation + +Package management is made with simplaret app, whose behaviour is detailed in its own document. +The following sections will only show how simplepkg can be used to manage jails and template +and create packages. + +Creating templates +------------------ + +Initially, simplepkg was built to help slackware install automation. To do that, it uses installation +templates -- lists of installed packages, post-installation scripts and config files -- allowing the +creation of installation profiles that can be used for system replication in other partition or even +custom chroot building. + +Template creation is done with "templatepkg" script. To create a template called "my-slackware" containig +the installed package list of your slackware installation, just type + + templatepkg -c my-slackware + +The -c (or --create) flag tells templatepkg to create the /etc/simplepkg/templates/my-slackware folder +with the following components: + + - /etc/simplepkg/templates/my-slackware/my-slackware.d: template config files + - /etc/simplepkg/templates/my-slackware/my-slackware.s: post-installation scripts + - /etc/simplepkg/templates/my-slackware/my-slackware.perms: metadata for config files + - /etc/simplepkg/templates/my-slackware/my-slackware.template: installaed package list + +This four components are enough to store all slackware installation characteristics: the package list +controls with applications are installed, the config file folder can contain all desired configurations +for any installed application and the post-installation scripts take care of all procedures that should +be executed exactly after the system installation. The my-slackware.perms file contains metadata for the +saved config files, i.e, permission and ownership. + +If you want to build a template from a installation placed in another folder or partition thats not your +current root dir, just type something like + + templatepkg -c my-slackware /mnt/slackware + +where /mnt/slackware is the place where this alternative system is installed. After created, the template +will contain just the installed package list or that folder. As the folder /var/log/packages of your +installation doesn't keep information about the package installation order, its recommended that you +manually edit the template's package list. To do that, just type + + templatepkg -e my-slackware + +To add configuration files inside the template, type something like + + templatepkg -a my-slackware /etc/hosts + +This should add /etc/hosts file to "my-slackware" template. Beyond just automatically copy the file +when you install a new system using this template, simplepkg can also take care of every change that +/etc/hosts can suffer on your system, such as file content or permission and ownership change. If you're +also storing your templates in a subversion repository, you'll be able to track all changes it ever had. + +WARNING: avoid the storage in a template of config files that contains important security information +such as passwords or secret keys. The prefered place to put such stuff is a secured backup. + +Creating jails and replicating installations +-------------------------------------------- + +As long as your template was created and populated with the package list, configuration files and +post-installation scripts (what will be treated in another section), your can replicate your slackware +installation as simpler than typing the following command: + + mkjail jail my-slackware + +This creates a fresh slackware tree at /vservers/jail with all packages listed in the template "my-slackware" +and all saved config files. The package installation is made by simplaret app, that should be properly configured. +The standard simplaret configuration should work for most situations. + +If you want to install your jail in a place other than /vservers (this standard location can be changed through +simpleokg config file), say /mnt/hda2, just use something like that: + + ROOT=/mnt mkjail hda2 my-slackware + +The above command 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 stored /etc/simplepkg/default, if exists. Simplepkg already +came if some pre-built templates at /etc/simplepkg/defaults/templates. + +Post-installation scripts +------------------------- + +Optionally, its possible to keep post-installation scripts inside a template. Such scripts are executed by mkjail +exactly after a jail is installed and the template config files copied. To create or edit a post-installation +script, just type + + templatepkg -b my-slackware script-name.sh + +This adds the script-name.sh at "my-slackware" template. Mkjail passes two command line arguments to a post-install +script: the upward folder and the jail's name ("/mnt" and "hda2" from our previous example). Then, an example script +is something like that: + + #!/bin/bash + chroot $1/$2/ sbin/ldconfig + +Listing template contents +------------------------- + +To list available templates or the template content, use commands such as + + templatepkg -l + templatepkg -l my-slackware + +Removing files from a template +------------------------------ + +As you did to add files, you can easily remove then from a template, using a comand such as + + templatepkg -d my-slackware /etc/hosts + +This removes the file /etc/hosts from "my-slackware" template. + +Removing a template +------------------- + +To remove a template, just type + + templatepkg -r my-slackware + +Updating a template +------------------- + +Now that we just talked about creating templates and jails, its time to cover another application, this time +used to keep a template always updated. Jail-commit is a script that copies all config file changes (content, +permissions and ownership) from a installation to a simplepkg template. + +For instance, if one wants to copy all changes from /mnt/hda2 jail into "my-slackware" template, he or she +just needs to type the following command: + + jail-commit /mnt/hda2 my-slackware + +Not just the package list from "my-slackware" template is updated according the installed packages from +/mnt/hda2/var/log/packages: all config files from "my-slackware" template are compared it the ones from +the jail and in case of any difference they're copied from the jail back to the template. Permissions +and file ownership commit into the template works at the same way. + +Jail-commit allows that a template to being kept always updated and mirroring the actual configuration +of an installed system. But if you want just to commit into the template just the installed package +list, simply type + + templatepkg -u my-template + +To make life even easier, there's also a feature of keeping a list of all installed slackware system in +the box in the file /etc/simplepkg/jailist. This file, despite its use by simplaret (what is described +in its own text), allow jail-commit to run with no arguments. + +Suppose you have three slackware installations: the root system and two more: + + - /mnt/slackware-1 using "slackware-1" template + - /mnt/slackware-2 using "slackware-2" template + +If your /etc/simplepkg/jailist has the following lines: + + /mnt/slackware-1 + /mnt/slackware-2 + +then the command + + jail-commit + +will update both "slackware-1" and "slackware-2" templates according, respectivelly, the contents of +/mnt/slackware-1 and /mnt/slackware-2. If you also have a template called "main", then jail-commit +will sync the contents of your root system with that template. + +You can even add the following line at root's crontab + + 20 4 * * * jail-commit + +so all your templates get updated everyday. If your system is configured to send emails, then crontab's +jail-commit output you give a summary of yesterday changes your system suffered, both config file changes +and package additions and removals. + +Restoring changes in a jail +--------------------------- + +The opposite operation of jail-commit also is possible: suppose you edited some config files in your system but +suddenly wants to go back and copy all config files from a template to your jail. To do that, just use the command + + jail-update /mnt/hda2 my-slackware + +Storing templates inside a Subversion repository +------------------------------------------------ + +In order to increase once more the control and flexibility of template contents, simplepkg can also handle templates +inside a subversion repository. To do that, edit first the config gile /etc/simplepkg/simplepkg.conf and set the +parameter TEMPLATES_UNDER_SVN to "yes". + +Then, create a fresh subversion repository to keep your templates with a command like that: + + svnadmin create /var/svn/simplepkg --fs-type fsfs + +Then, you just need to import your templates with + + templatepkg -e file:///var/svn/simplepkg + +From now jail-commit will commit automatically any template changes to the svn repository. If, in the other hand, +you wish to grab the changes from the svn repository to your local copy, use + + templatepkg -s + +In case you want to import a template folder from an existing repository, use + + templatepkg -i file:///var/svn/simplepkg + +where file:///var/svn/simplepkg is the repository path. + +Upgrading jails +--------------- + +Jail and installed system upgrading is done through simplaret and also supports /etc/simplepkg/jailist file. +For more info on how it works, take a look at simplaret own documentation. + +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. + +Creating a package from a template +---------------------------------- + +If, for any reason, you wish to build a package from an existing template, try the command + + templatepkg -p template-name + +Although that should work smoothly, its not the recommended behaviour, as simplepkg was designed +to deal easily with templates and repositories. + +Building packages +----------------- + +Until now, we just showed simplepkg applications used to manage installations and packages. +But simplepkg can also create packages using createpkg script: it downloads, builds and +packages software that has an available script from a SlackBuild in a repository, working +like a slackware ports system. + +Createpkg works with any SlackBuild repository but works better and is well integrated if +they are compliant with the standards from + + http://slack.sarava.org/wiki/Main/SlackBuilds + +Specifically, createpkg was built to use slackbuilds from http://slack.sarava.org/slackbuilds +through a subversion repository. + +To fetch all scripts from slack.sarava.org, type + + createpkg --sync + +Then, you can list all available script using + + createpkg --list + +To search for a script, use something like + + createpkg --search latex2html + +This searches for a SlackBuild for the program "latex2html". If you want to build that package, +just type + + createpkg latex2html + +The resulting package should be available at /tmp or at the folder specified by the environment +variable $REPOS. To create and install the package, type + + createpkg --install latex2html + +If the package has dependencies listed in a slack-required file that aren't installed in the +system, then createpkg will try to process then before the desired package's SlackBuild: if +the dependencies aren't available in the SlackBuild tree, then createpkg will call simplaret +and try to install the package from a binary repository. If you want to avoid createpkg's +dependency checking, just use it with the flag --no-deps. + +For more information about createpkg, type + + createpkg --help + +or take a look at http://slack.sarava.org/wiki/Main/SlackBuilds. + +Auxiliar applications +--------------------- + +Simplepkg comes also with the following tools: + + - lspkg: show installed packages and its contents + - rebuildpkg: rebuild a package based on its /var/log/packages entry + - repos: creates and manages binary repositories + - mkbuild: app to build slackware build scripts + +The command lspkg is used to show installed packages. Also, 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/. + +For their time, scripts repos and mkbuild are used, respectivelly, to create and manage binary repositories +and to create SlackBuild scripts. + +Configuration parameters +------------------------ + +Simplepkg's config file is /etc/simplepkg/simplepkg.conf and it keeps parameters used by all scripts. +In this section, we won't cover any parameter that's just used by simplaret, whose settings are covered +in its own documentation. + + - JAIL_ROOT: Where jails are placed by mkjail. Default: "/vservers". + + - ADD_TO_JAIL_LIST: Wheter mkjial should add new jails to /etc/simplepkg/jailist. Default is "1" (enabled). + + - TEMPLATES_UNDER_SVN: Set to yes if your templates will be placed in a subversion repository. Default + is "no" (disabled). + + - TEMPLATE_FOLDER: Where your templates will be located. Default is "/etc/simplepkg/templates" and + dont change it except you know what you're doing. + + - TEMPLATE_STORAGE_STYLE: This variable controls in which folder / subfolder your templates will + be stored. Default value is "own-folder" and you'll just need to change that if you're storing + your templates using an old simplepkg format and wants to keep compatibilty. + +Its important to note that all boolean parameters in the config file can be set either to "1" or "yes" +to enable and "0" or "no" to disable. + +Additional information +---------------------- + +Simplepkg was written by Silvio Rhatto (rhatto at riseup.net) and is released under GPL license. The code +can be obtained from the subversion repository: + + svn checkout svn://slack.sarava.org/simplepkg + +Simplepkg's wiki is http://slack.sarava.org/wiki/Main/SimplePKG and its mailing list address is +http://listas.sarava.org/wws/info/slack. + diff --git a/tags/0.5/doc/README.pt_BR b/tags/0.5/doc/README.pt_BR new file mode 100644 index 0000000..138125e --- /dev/null +++ b/tags/0.5/doc/README.pt_BR @@ -0,0 +1,444 @@ +Simplepkg: gerenciamento de instalações e pacotes +------------------------------------------------- + +Autor: Silvio Rhatto +Licença: GPL + +O simplepkg é um sistema de gerenciamento de sistemas slackware 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. + +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, podendo manter toda a configuração das máquinas num repositório +Subversion. + +O simplepkg funciona não apenas com o Slackware mas com qualquer port (oficial ou não) que +siga minimamente os padrões oficiais. + +Arquitetura +----------- + +O simplepkg é um conjunto de scripts escritos com a filosofia KISS (Keep It Simple, Stupid) em mente. +Ele é um sistema muito simples, composto pelos seguintes comandos: + + - mkjail: constrói uma jaula/instalação de slackware numa pasta + - templatepkg: criar ou adiciona pacotes a um template + - lspkg: lista pacotes instalados + - jail-update: inverso do jail-commit + - jail-commit: atualiza o template + - 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 scripts presentes num repositório + - repos: cria e mantém repositórios + - mkbuild: cria scripts de construção de pacotes + +Instalando o simplepkg +---------------------- + +Para baixar o pacote do simplepkg, vá em http://slack.sarava.org/packages/noarch/. Depois, basta usar +o comando + + installpkg simplepkg-VERSAO-noarch-BUILD.tgz + +Usando o simplepkg +------------------ + +As três principais aplicações desse conjunto são: + + - Gerenciamento de pacotes + - Criação e manutenção de jaulas + - Criação de pacotes + +O gerencamento de pacotes é feito através do simplaret, e por ser algo bem específico está detalhado +no artigo correspondente. As seções a seguir mostrarão como o simplepkg pode ser utilizado para criar +e manter jaulas, assim como também criar pacotes. + +Criando templates de instalação +------------------------------- + +Originalmente, o simplepkg foi desenvolvido para ajudar na automatização de instalações de sistemas +slackware. Para isso, 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 ou criar um chroot. + +A construção de um template é feita através do programa templatepkg. Para criar um template de nome +"meu-slackware" contendo a lista de pacotes atualmente instalados no seu sistema, digite + + templatepkg -c meu-slackware + +A opção -c (ou --create) criará a pasta /etc/simplepkg/templates/meu-slackware, que conterá os +seguintes componentes: + + - /etc/simplepkg/templates/meu-slackware/meu-slackware.d: cópia de arquivos de configuração + - /etc/simplepkg/templates/meu-slackware/meu-slackware.s: scripts de pós-instalação + - /etc/simplepkg/templates/meu-slackware/meu-slackware.perms: informações sobre arquivos + - /etc/simplepkg/templates/meu-slackware/meu-slackware.template: lista de pacotes + +Esses quatro componentes são suficientes para armazenar todas as características de uma instalação +de slackware: a lista de pacotes controla o software instalado (a partir do conteúdo da pasta +/var/log/packages), a cópia dos arquivos de configuração controla as personalizações feitas para o uso +dos aplicativos e os scripts de pós-instalação cuidam de qualquer rotina que precisa ser realizada +exatamente após a instalação do sistema. Já o arquivo de informações sobre arquivos contém as permissões, +o dono/a e grupo de cada arquivo de configuração presente no template. + +Se você quiser criar um template a partir de uma instalação de slackware presente numa outra partição +do sistema que não seja a raíz, basta usar um comando do tipo + + templatepkg -c meu-slackware /mnt/slackware + +onde /mnt/slackware é o local onde o sistema alternativo está instalado. Após criado, o template possuirá +apenas a lista de pacotes contendo o nome dos aplicativos instalados no seu sistema. Como a pasta +/var/log/packages não preserva a ordem de instalação dos pacotes, então talvez você queira editar manualmente +a lista de pacotes de um template. Para isso, use o comando + + templatepkg -e meu-slackware + +Para adicionar um arquivo de configuração no seu novo template, basta dar um comando como + + templatepkg -a meu-slackware /etc/hosts + +Isso adicionará o arquivo /etc/hosts no template "meu-slackware". Além de salvar o arquivo e copiá-lo +automaticamente quando você instalar seu sistema, o simplepkg ainda pode tomar conta de qualquer alteração +que o /etc/hosts sofrer no sistema, seja mudança no conteúdo do arquivo, dono ou permissão. Se você ainda +estiver armazenando seus templates num repositório svn (o que veremos a seguir), o simplepkg pode ainda +manter um histórico completo das alterações do arquivo. + +ATENÇÂO: evite ao máximo deixar arquivos contendo senhas ou chaves privadas num template. O lugar mais +adequado para deixar esse tipo de coisa é num backup seguro. + +Criando jaulas e replicando instalações +--------------------------------------- + +Uma vez que um template foi criado com uma lista de pacotes e opcionalmente com arquivos de configuração +e scripts de pós-instalação (que serão detalhados a seguir), você pode replicar sua instalação de slackware +utilizando o comando + + mkjail jaula meu-slackware + +Isso cria uma nova árvore do slackware em /vservers/jaula contendo todos os pacotes e arquivos de configuração +do template "meu-slackware". A instalação dos pacotes será feita pelo aplicativo simplaret, que deve estar +configurado corretamente e cuja configuração padrão deve funcionar para a maioria dos casos. + +Se você quiser instalar essa jaula em outro local que não seja a pasta /vservers (esse local padrão pode ser +mudado pelo arquivo de configuração do simplepkg), basta usar 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. O simplepkg já vem +com alguns templates padrões, presentes em /etc/simplepkg/defaults/templates. + +Scripts de pós-instalação +------------------------- + +Opcionalmente, é possível manter scripts de pós-instalação num template. Tais script são executados exatamente +após a instalação de uma jaula e cópia de arquivos de configuração pelo mkjail. Para criar ou editar um script +de pós-instalação, use um comando como + + templatepkg -b meu-slackware nome-do-script.sh + +Isso adicionará o script nome-do-script.sh no template "meu-slackware". O mkjail passa dois argumentos para +cada script de pós-instalação: a pasta superior e o nome da jaula ("/mnt" e "hda2" no nosso exemplo anterior). +Assim, um exemplo de script seria algo como + + #!/bin/bash + chroot $1/$2/ sbin/ldconfig + +Listando o conteúdo de um template +---------------------------------- + +Para listar os templates disponíveis ou o conteúdo de um template, use comandos como + + templatepkg -l + templatepkg -l meu-slackware + +Removendo arquivos de um template +--------------------------------- + +Analogamente à forma como se adicona arquivos num template, removê-los pode ser feito com o seguinte comando: + + templatepkg -d meu-slackware /etc/hosts + +Isso remove o arquivo /etc/hosts do template "meu-slackware". + +Apagando um template +-------------------- + +Para apagar um template, basta utilizar um comando como + + templatepkg -r meu-slackware + +Atualizando um template +----------------------- + +Agora que já abordamos as opções do templatepkg, é hora de visitarmos um outro aplicativo, desta vez utilizado +para manter um template atualizado. O jail-commit é um script que copia as alterações dos arquivos (conteúdo, +propriedade e permissões) de um template a partir do conteúdo de uma jaula ou instalação. + +Por exemplo, caso se queira copiar as alterações da jaula /mnt/hda2 no template "meu-slackware", basta usar o +comando + + jail-commit /mnt/hda2 meu-slackware + +Além da lista de pacotes do template "meu-slackware" ser atualizada de acordo com a lista de pacotes presente +em /mnt/hda2/var/log/packages, todos os arquivos de configuração presentes no template "meu-slackware" serão +comparados com os correspondentes da pasta /mnt/hda2 e as diferenças são copiadas para o template. Da mesma +forma, as permissões e informação de dono/grupo dos arquivos também é atualizada no template. + +O comando jail-commit possibilita que um template sempre esteja atualizado e refletindo a configuração atual +de uma instalação de slackware. Se você quiser atualizar apenas a lista de pacotes de um template, porém, use + + templatepkg -u meu-template + +Para facilitar ainda mais o controle das alterações do sistema, existe ainda uma facilidade do arquivo +/etc/simplepkg/jailist. Esse arquivo serve, além de outros propósitos descritos na documentação do simplaret, +para que o jail-commit saiba de antemão quais são as instalações de sistema do tipo Slackware presentes numa +máquina, além da instalação principal na raíz do sistema. + +Suponha que uma máquina possua duas instalações de slackware, além da principal (raíz): + + - /mnt/slackware-1 usando o template "slackware-1" + - /mnt/slackware-2 usando o template "slackware-2" + +Se o arquivo /etc/simplepkg/jailist contiver as seguintes linhas, + + /mnt/slackware-1 + /mnt/slackware-2 + +então o comando + + jail-commit + +atualizará o template "slackware-1" de acordo com o conteúdo da jaula /mnt/slackware-1 e o template "slackware-2" +com o conteúdo da jaula /mnt/slackware-2. Se, além desses dois templates, existir um outro de nome "main", então +o jail-commit sem argumentos também copiará as atualizações da instalação raíz, deixando-as no template "main". + +Você pode inclusive colocar uma entrada no crontab do tipo + + 20 4 * * * jail-commit + +para que seus templates sejam atualizados diariamente. Se você ainda possui o envio de emails configurado na sua +máquina, então a saída do jail-commit será enviada pelo cron diariamente para seu email, contendo diffs das alterações +de arquivos de configuração a lista de pacotes adicionados ou removidos no sistema. + +Restaurando arquivos de configuração numa jaula +----------------------------------------------- + +A operação contrária ao que o jail-commit faz também é possível: suponha que você mexeu na configuração do sistema +mas se arrependeu das alterações e deseja voltar a configuração para o modo como ela se encontra no seu template, +basta usar o comando + + jail-update /mnt/hda2 meu-slackware + +Armazenando as configurações no repositório Subversion +------------------------------------------------------ + +Para aumentar ainda mais a flexibilidade e o controle do conteúdo dos templates, é possível armazená-los num +repositório Subversion. Para isso, edite o arquivo /etc/simplepkg/simplepkg.conf e deixe o parâmetro de configuração +TEMPLATES_UNDER_SVN com o valor "yes". + +Depois, crie um repositório subversion para armazenar seus templates, usando algo como + + svnadmin create /var/svn/simplepkg --fs-type fsfs + +Com o repositório criado, basta importar seus templates com o comando + + templatepkg -e file:///var/svn/simplepkg + +A partir daí, o comando jail-commit enviará automaticamente todas as alterações dos templates para o repositório +subversion. Se, por outro lado, você quiser baixar as alterações dos templates que estão no repositório remoto +para sua cópia local, use o comando + + templatepkg -s + +Caso você queira importar uma pasta de templates de um repositório já existente, use + + templatepkg -i file:///var/svn/simplepkg + +onde file:///var/svn/simplepkg é o camninho do repositório. + +Atualização de jaulas +--------------------- + +A atualização de jaulas e sistemas instalados é feita através do simplaret e também utiliza o arquivo +/etc/simplepkg/jailist. Para mais informações a respeito, consulte a documentação do simplaret para mais detalhes. + +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. + +Criando um pacote de um template +-------------------------------- + +Se, por algum motivo, você quiser construir um pacote com o conteúdo de um template, experimente +o comando + + templatepkg -p nome-do-template + +No entanto, o simplepkg foi criado para que esse tipo de comportamento seja evitado, já que é mais +simples manter templates de configuração do que pacotes contendo a configuração de uma instalação. + +Construindo pacotes +------------------- + +Até aqui, apenas mostramos os aplicativos do simplepkg usados para a manutenção de instalações +de slackware. No entanto, uma das outras finalidades desta suíte é a construção de pacotes, o +que é feita pelo programa createpkg, Como dito anteriormente, o createpkg: baixa, compila e +empacota software de acordo com scripts presentes num repositório de scripts, funcionando com +um gerenciador de "ports" para slackware. + +O createpkg pode funcionar com qualquer tipo de script de construção de pacotes (SlackBuilds) +mas funcionará melhor se os mesmos seguirem o padrão descrito na página + + http://slack.sarava.org/wiki/Main/SlackBuilds + +Especificamente, o createpkg foi desenvolvido para utilizar os slackbuild disponíveis em +http://slack.sarava.org/slackbuilds. O createpkg trabalha com repositórios do tipo subversion. + +Para obter os scripts do repositório do slack.sarava.org, digite + + createpkg --sync + +Em seguida, você pode listas todos os scripts disponíveis: + + createpkg --list + +Para buscar por um pacote, use + + createpkg --search latex2html + +No caso, a busca é feita pelo SlackBuild do aplicativo "latex2html". Suponha agora que você queira +construir o pacote desse aplicativo: + + createpkg latex2html + +O pacote resultante estará na pasta /tmp ou no valor especificado pela variável de ambiente $REPOS. +Para criar e também instalar o pacote, basta + + createpkg --install latex2html + +Se o pacote possuir dependências listadas num arquivo slack-required e que não estiverem instaladas +no sistema, o createpkg tentará processá-las uma a uma antes de tentar construir o pacote desejado: +se as dependências não forem encontradas no repositório de scripts, então o createpkg tentará +baixá-las de um repositório binário através do simplaret. Se você não quiser que a resolução de +dependências seja seguida, use a opção --no-deps. + +Para mais detalhes de funcionamento, experimente o comando + + createpkg --help + +ou então acesse a página http://slack.sarava.org/wiki/Main/SlackBuilds. + +Aplicativos auxiliares +---------------------- + +O simplepkg acompanha ainda alguns aplicativos auxiliares: + + - lspkg: lista pacotes instalados + - rebuildpkg: reconstrói um pacote a partir de sua entrada no /var/log/packages + - repos: cria e mantém repositórios + - mkbuild: cria scripts de construção de pacotes + +O comando lspkg é um utilitário simples para a visualização de pacotes instalados no sistema. Já o +rebuildpkg 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. + +Por fim, os scripts repos e mkbuild são os que se encontram na etapa de maior desenvolvimento: repos +cria um repositório de pacotes a partir de uma pasta contendo pacotes do tipo pkgtool e o mkbuild +é um aplicativo para auxiliar a criação de scripts de construção de pacotes que podem ser utilizados +sozinhos ou pelo o createpkg. + +Parâmetros de configuração +-------------------------- + +O arquivo de configuração do simplepkg é o /etc/simplepkg/simplepkg.conf. Ele contém parâmetros de +configuração de todos os scripts, porém neste texto não trataremos das opções específicas ao simplaret, +as quais tem uma seção específica no artigo correspondente. + + - JAIL_ROOT: pasta padrão onde as jaulas são criadas pelo mkjail. Valor padrão: "/vservers". + + - ADD_TO_JAIL_LIST: controla se uma jaula criada pelo mkjail deve ser adicionada automaticamente + no arquivo /etc/simplepkg/jailist. O valor padrão é "1" (habilitado). + + - TEMPLATES_UNDER_SVN: indica se os templates estão armazenados num repositório subversion. + O valor padrão é "no" (não). + + - TEMPLATE_FOLDER: indica qual é a pasta de templates. O valor padrão é "/etc/simplepkg/templates" + e não é recomendável alterá-lo. + + - TEMPLATE_STORAGE_STYLE: controla a forma de armazenamento de templates. O valor padrão é + "own-folder" e essa opção apenas deve ser modificada se você armazena seus templates num + formato antigo do simplepkg e deseja manter compatibilidade. + +Vale lembrar que todas as opções booleanas (isto é, que podem ser apenas habilitadas ou desabilitadas) +do simplepkg.conf tem os seguintes valores permitidos: "1" e "yes" para habilitado e "0" ou "no" para +desabilitado. + +Mais informações +---------------- + +O simplepkg foi escrito por Silvio Rhatto (rhatto at riseup.net) sob licença GPL e seu código fonte é +disponibilizado através do repositório subversion: + + svn checkout svn://slack.sarava.org/simplepkg + +O wiki de desenvolvimento: http://slack.sarava.org/wiki/Main/SimplePKG e o endereço da lista de discussão +utilizada para discussões sobre simplepkg ou mesmo distribuições e pacotes do tipo Slackware é +http://listas.sarava.org/wws/info/slack. + diff --git a/tags/0.5/doc/README.simplaret b/tags/0.5/doc/README.simplaret new file mode 100644 index 0000000..397d913 --- /dev/null +++ b/tags/0.5/doc/README.simplaret @@ -0,0 +1,319 @@ +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. It runs on top of pkgtool +and is totally non-instrusive and can search, add, remove and upgrade packages. + +Documentation +------------- + +The always updated english documentation is hosted at http://slack.sarava.org/simplaret-en + +Downloading and installing +-------------------------- + +Simplaret comes with simplepkg, wich installation and configuration is detailed at +http://slack.sarava.org/simplepkg. Simplaret uses /etc/simplepkg/simplepkg.conf for its definitions +and /etc/simplepkg/repos.conf for repository information. The default configuration should work +for almost everyone. + +Using simplaret +--------------- + +Simplaret stores its data in system wide folders. Then, some funcionality will just be available +if its run with root user capabilities. The first thing you need to do with simplaret is to fetch +repository metadata, using + + simplaret --update + +or simply + + simplaret update + +as simplepkg supports both command line behaviour (--update or just update). After that, you can +search for packages using commands like + + simplaret search ekiga + +The result should be something like + + REPOS repository sarava, arch: i386, version: 11.0: ekiga-2.0.5-i586-1rd.tgz + +As we'll see afterwards, "REPOS" means the repository type, "sarava" is the repository name, +"arch" is the package architecture (i386 in this case) and "version" is the repository version +(11.0 in this case). + +To install this package, just type + + simplaret install ekiga + +By default, if simplaret finds in the repository a slack-required file for this package (i.e, the +file ekiga.slack-required in the same folder of the binary package) then it will try to install +all unmet dependencies. This default behaviour can be disabled through config file parameters. + +If you just want to download the package, type + + simplaret get ekiga + +In the case of simplaret finds more than one package with the same name, it will get in the order +that the "search" option shows them. The search precedence can also be defined by config file +parameters. For instance, the command + + simplaret search kernel-generic + +can return something like + + ROOT repository sarava, arch: i386, version: 11.0: kernel-generic-2.6.17.13-i486-1.tgz + ROOT repository sarava, arch: i386, version: 11.0: kernel-generic-2.6.18-i486-1.tgz + +So the command + + simplaret install kernel-generic + +will attempt to install the package "kernel-generic-2.6.17.13-i486-1.tgz" and not the file +"kernel-generic-2.6.18-i486-1.tgz". If you want to force simplaret to get and specific package, +use its complete file name: + + simplaret install kernel-generic-2.6.18-i486-1.tgz + +If a package is already installed in the system, the --install option will try to upgrade it +if the version or build number between the installed package and the one in the repository +are different. So the command + + simplaret install simplepkg + +updates simplepkg in the case there's a new version. To remove a package, type + + simplaret remove nome-do-pacote + +That's just an alias for the standard removepkg command. + +Simplaret stores downloaded packages in a system folder that defaults to /var/simplaret. +As you get more and more packages, simplaret will consume more space ir your disk. To +erase your local repository folder, use the command + + simplaret purge + +This will erase just the packages from the current arch and version. Details about how to +erase the repository for different arch and version are in another session. + +You can also force simplaret to erase just old packages. The following command erases just +packages older than six weeks or more: + + simplaret purge -w 3 + +Downloading patches and upgrading the system +-------------------------------------------- + +Simplaret hasn't just about package installing and removal, it has two more important +features: patches retrieval and application. Assuming that the patches repository of +your slackware flavour is correctly configured (what should work with almost everyone +with the default configuration), you can fetch the available patches using the command + + simplaret get-patches + +If you don't just donwload but also apply those patches, use + + simplaret upgrade + +Working with more than one architecture and version +--------------------------------------------------- + +Until now we just looked what is the requirement for all package management system: package +retrieval, installation, search, upgrade and dependency resolution. What makes simplaret +different from another tools is the ability to deal with different architectures and versions +and slackware installations. + +The features descibed in this section will just make sense after you read the next section, when +we'll talk about multiple slackware installations and jails in the same computer. + +Suppose you're running Slackware (arch i386) bit wants to update the package list from Slamd64 +version 11.0 (arch x86_64). To do that, just type + + ARCH=x86_64 VERSION=11.0 simplaret update + +This command grabs the Slamd64 package list without confliting in any way with the standard and +already downloaded i386 Slackware package list. This doesn't happens because simplaret stores +metadata from different archs and versions at different folders. + +Its optional to pass ARCH and VERSION environment variables to simplaret. If one or none of them +was specified, simplaret uses the standar system value, obtained from the file /etc/slackware-version, +or uses config parameters to do that. + +As an example, to search for a package in the arch powerpc (Slackintosh) version 11.0, just type + + ARCH=powerpc VERSION=11.0 simplaret search package-name + +All command previously mentioned can work that way, except those that install or remove packages as +its dangerous to mix packages from different archs and versions in the same system. + +Working with multiple installations +----------------------------------- + +The previously section mentions a feature that just makes sense in systems where there's more than +one slackware-like installation using different archs and versions. + +Say you have a x86_64 machine with three installed systems: + + - Slamd64 11.0 at the root folder + - Slackware 11.0 at /mnt/slackware-1 + - Slackware 10.2 at /mnt/slackware-2 + +In the case of package install or patch retrieval and application, simplaret supports the environment +variable ROOT to specify which folder simplaret should look for a system. + +Then, to install a package at /mnt/slackware-1, just type + + ARCH=i386 VERSION=11.0 simplaret update + ROOT=/mnt/slackware-1 simplaret install package-name + +The first command just updates the package list and the second makes simplepkg install the package with +using /mnt/slackware-1 arch and version. If you want to do the same at /mnt/slackware-2, use the analogous +command + + ARCH=i386 VERSION=10.2 simplaret update + ROOT=/mnt/slackware-2 simplaret install package-name + +There's also a feature to make patch retrieval and application with just one command, using the file +/etc/simplepkg/jailist. This file is used by simplepkg's mkjail script to store with jails you have +on your system but is also used by simplaret to upgrade all jails with just one command. + +Considering that your box has the three previously mentioned slackware installation. Then, to add +/mnt/slackware-1 and /mnt/slackware-2 in the automatic upgrade list, add the following lines in your +/etc/simplepkg/jailist (without spaces): + + /mnt/slackware-1 + /mnt/slackware-2 + +The root system doesn't need to be added in this file. Then, you can get the patches for all your three +systems with the command + + simplaret get-patches + +To get the patches and/or apply them in all jails (including the root system), use + + simplaret upgrade + +This feature makes easier to keep all your installations always upgraded. + +The repos.conf file +------------------- + +Now that we just talked about all simplaret features, its time to take a tour at its configuration +files. The first one we'll say about is the repository definition file, /etc/simplepkg/repos.conf. + +If you don't mind to make an advanced simplaret usage, then probably you can just leave this section +as the default config should work for almost all standard situations and you'll just need to edit +repos.conf to change repository priorities. + +The repos.conf file contains one repository definition per line using the following syntax: + + TYPE[-ARCH][-VERSION]="name%URL" + +The content in brackets are optional depending on the repository type as we'll see later in this +section. The repository types supported by simplaret are: + + - PATCHES: used for repositories containing patches and which file metadata is the file + FILE_LIST instead the standard FILELIST.TXT; example: + + PATCHES-i386-11.0="sarava%http://slack.sarava.org/packages/slackware/slackware-11.0/patches/" + + This defines a patches repository for arch i386 (official Slackware), version 11.0 and named + as "sarava". + + Its optional to have a PATCHES definition in order to get patches: the ROOT repository definition + just take care of that and you'll just need to use a PATCHES definition if you want to give + precedence to some patches repository over all other definition types. + + - ROOT: this type specifies the default slackware-like repository, where the content is sorted + by version. An official slackware repository then is defined as + + ROOT-i386="tds%http://slackware.mirrors.tds.net/pub/slackware/" + + ROOT repositories needs just the arch definition, a name and an URL. In the previous case, + we have a ROOT repository called "tds". It doesn't need any version information as its already + considers tha the content is sorted in folders like + + http://slackware.mirrors.tds.net/pub/slackware/slackware-10.2/ and + http://slackware.mirrors.tds.net/pub/slackware/slackware-11.0/ + + - REPOS: this repository type ir arch and version oriented, like + + REPOS-i386-11.0="sarava%http://slack.sarava.org/packages/slackware/slackware-11.0/" + + In the above case, a repository called "sarava" is defined using arch i386 and version 11.0 + with URL http://slack.sarava.org/packages/slackware/slackware-11.0/. This repository type is + recommended when using non-official repositories. + + - NOARCH: the last type is used to define repositories where packages are arch and version + independent, like + + NOARCH="sarava%http://slack.sarava.org/packages/noarch" + +In any repository type, the supperted URL schemes are http://, ftp:// or file:// (for local +repositories). + +As simplaret supports more than one repository definition for each type, arch or version, each +definition has its own name. Definitions can have the same name just if they're dont use the +same repository type and/or arch and version. + +There's also a priority rule between the repository types wich defines a precedence order. +Repositories are searched according the following order: + + - PATCHES has the highest priority: if a package from a given arch and version is not found + in the first (if existent) PATCHES definition, then the next one is searched until all + PATCHES definitions are searched. + + - Then, the package is searched in all ROOT defintions in the order they appear at repos.conf. + + - The next searched repository type is REPOS in the specified arch an version, in the order + they appear at repos.conf. + + - At last, NOARCH type is searched in the order they're defined. + +In the case you're issuing an upgrade or just geting patches, simplaret by default will just +search in PATCHES and ROOT definitions. + +At REPOS and ROOT is also possible to specify its internal search order according its subfolders. + +Configuration file simplepkg.conf +--------------------------------- + +Simplaret also stores its configurations inside simplepkg's configuration file +/etc/simplepkg/simplepkg.conf. This file is well commented and you should find there a description +of all supported options. + +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 11.0 + - slackware 10.0 + - slackware 11.0 with additional i686 packages + - uSlack (i386 uClibc) + +Keep all this stuff update manually is really a headache. Simplaret just tries to make it trivial. + +Additional information +---------------------- + +Simplaret was written by Silvio Rhatto (rhatto at riseup.net) and is released under GPL license. The code +can be obtained from the subversion repository: + + svn checkout svn://slack.sarava.org/simplepkg + +Simplepkg's wiki is http://slack.sarava.org/wiki/Main/SimplePKG and its mailing list address is +http://listas.sarava.org/wws/info/slack. + diff --git a/tags/0.5/doc/README.simplaret.pt_BR b/tags/0.5/doc/README.simplaret.pt_BR new file mode 100644 index 0000000..672eb8e --- /dev/null +++ b/tags/0.5/doc/README.simplaret.pt_BR @@ -0,0 +1,445 @@ +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, +como por exemplo Slamd64 e Slackintosh, permitindo que você gerencie facilmente todas as suas +jaulas e instalações de Slackware, independentemente da arquitetura ou versão que elas utilizem. + +Além da obtenção, o simplaret ainda pode fazer a instalação, a remoção ou a atualização dos +pacotes de um sistema e também das demais jaulas existentes numa máquina. + +O simplaret é totalmente não-intrusivo no sistema e roda sobre o pkgtool. + +Documentação +------------ + +A documentação atualizada do simplaret se encontra em http://slack.sarava.org/simplaret. + +Obtendo e instalando +-------------------- + +O simplaret acompanha o simplepkg e por isso sua instalação é feita baixando o pacote do simplepkg +em http://slack.sarava.org/packages/noarch/ e em seguida instalando-o com o comando + + installpkg simplepkg-VERSAO-noarch-BUILD.tgz + +A partir daí você já pode utilizar o simplaret para baixar pacotes dos repositórios padrão ou +então alterar a lista de repositórios do arquivo /etc/simplepkg/repos.conf ou a configuração +do aplicativo pelo arquivo /etc/simplepkg/simplepkg.conf. + +Usando o simplaret +------------------ + +Em geral, como o simplaret armazena as informações em pastas do sistema, algumas funcionalidades +só estarão disponíveis quando o mesmo é rodado pelo superusuário do sistema. + +Antes de explorar todas as funcionalidades do simplaret, é necessário atualizar a lista de +pacotes para sua arquitetura e versão, o que pode ser feito com o comando + + simplaret --update + +ou simplesmente + + simplaret update + +já que o simplaret suporta que suas opções básicas de linha de comando sejam passas precedidas +por dois hífens ou não (--update ou update). + +Depois de atualizar a lista de pacotes, experimente buscar por um pacote com um comando do tipo + + simplaret search ekiga + +O resultado pode ser algo do tipo + + REPOS repository sarava, arch: i386, version: 11.0: ekiga-2.0.5-i586-1rd.tgz + +Como veremos adiante, "REPOS" significa o tipo de repositório, "sarava" é o nome do +repositório, "arch" mostra a arquitetura do pacote e do repositório (i386, no caso) +e "version" a versão do repositório (11.0, no caso). + +Para instalar esse pacote, basta o comando + + simplaret install ekiga + +Por padrão, se o simplaret encontrar no repositório um arquivo slack-required referente +ao pacote en questão (ou seja, um arquivo ekiga.slack-required na mesma pasta que o pacote +do ekiga, neste caso), então o simplaret tentará instalar todos os requisitos contidos nesse +slack-required, caso já não estejam instalados no sistema. Essa resolução de dependências +automática pode, no entanto, ser desabilitada através de um parâmetro de configuração, como +veremos a seguir. + +Se você apenas quiser baixar o pacote, digite apenas + + simplaret get ekiga + +No caso do simplaret encontrar mais de um pacote com o mesmo nome, ele baixará na ordem que +a opção "search" listá-los, sendo que essa precedência é definida de acordo com a ordem em +que os repositórios estão listados no arquivo de configuração. Por exemplo, o comando + + simplaret search kernel-generic + +pode retornar algo como + + ROOT repository sarava, arch: i386, version: 11.0: kernel-generic-2.6.17.13-i486-1.tgz + ROOT repository sarava, arch: i386, version: 11.0: kernel-generic-2.6.18-i486-1.tgz + +Assim, o comando + + simplaret install kernel-generic + +instalará o pacote "kernel-generic-2.6.17.13-i486-1.tgz" ao invés do pacote +"kernel-generic-2.6.18-i486-1.tgz". Caso você queira forçar a instalação do +segundo pacote, basta especificá-lo com o nome completo: + + simplaret install kernel-generic-2.6.18-i486-1.tgz + +Se um pacote já estiver instalado no sistema, a opção install fará o upgrade do mesmo, caso +a versão ou o build number do pacote presente no repositório for diferente da instalada no +sistema. Assim, o comando + + simplaret install simplepkg + +atualiza o simplepkg caso haja uma nova versão disponível nalgum repositório. + +Para remover um pacote, digite + + simplaret remove nome-do-pacote + +o que na verdade é apenas uma chamada indireta ao removepkg. + +O simplaret armazena pacotes baixados de repositórios numa pasta local do sistema, que +por padrão é /var/simplaret. Conforme você vai baixando e instalando pacotes, essa pasta +tende a crescer e ocupar muito espaço. Para apagar os pacotes, basta usar o comando + + simplaret purge + +Isso apagará apenas os pacotes da arquitetura e versão usadas atualmente. Detalhes de +como apagar os pacotes de todas a arquiteturas e versões serão dados numa seção seguinte. + +Você também pode forçar o simplaret a apagar apenas pacotes antigos. O comando a seguir +apaga apenas os pacotes baixados a três semanas ou mais (ou seja, os pacotes baixados a +menos de três semanas continuam armazenados): + + simplaret purge -w 3 + +Baixando patches e atualizando o sistema +---------------------------------------- + +O simplaret possui, além do básico do gerenciamento de pacotes, duas funcionalidades +adicionais: a obtenção e a aplicação de patches (pacotes contendo atualizações e +correções de segurança). + +Assumindo que os repositórios contendo patches para sua distribuição do tipo Slackware +estejam corretamente configurados, o que ocorre com a configuração padrão que acompanha +o simplepkg e que veremos a seguir como alterá-la, você pode baixar os patches disponíveis +para o seu sistema com o comando + + simplaret get-patches + +Se você quiser não só baixar mas também atualizar seu sistema, isto é, fazer um upgrade com +os patches disponíveis, use + + simplaret upgrade + +Trabalhando com múltiplas arquiteturas e versões +------------------------------------------------ + +Até aqui vimos apenas o que é a obrigação de qualquer sistema de gerenciamento de pacotes possuir: +obtenção de pacotes, instalação, busca e atualização do sistema. O que diferencia o simplaret das +outras ferramentas, além do esquema de resolução de dependências, é sua capacidade de lidar +simultaneamente com múltiplas arquiteturas, versões e até instalações de sistemas do tipo Slackware. + +O uso dos seguintes comandos só fará sentido à luz da próxima seção, onde trataremos a respeito de +múltiplas instalações e jaulas num mesmo computador, porém é um pré-requisito para entendê-la. + +Supondo que você esteja rodando Slackware (arquitetura i386) mas que queira atualizar a lista de +pacotes do sistema Slamd64 versão 11.0 (arquitetura x86_64), basta usar o comando + + ARCH=x86_64 VERSION=11.0 simplaret update + +Esse comando baixará a lista de pacotes para o Slamd64 sem conflitar de nenhuma forma com a lista +e os pacotes já baixados para o Slackware. Isso acontece porque o simplaret armazena as informações +e os pacotes de cada repositório em pastas próprias, organizadas de acordo com a arquitetura e versão. + +Passar as variaveis ARCH e VERSION para o simplaret é opcional. Se qualquer uma delas não foi especificada, +o simplaret utilizará o valor padrão do seu sistema, usualmente obtido do arquivo /etc/slackware-version +ou então especificada através do arquivo de configuração do simplepkg. + +Por exemplo, para pesquisar por um pacote da arquitetura powerpc (distribuição Slackintosh) na versão 11.0, +basta o comando + + ARCH=powerpc VERSION=11.0 simplaret search nome-do-pacote + +Todos os comandos apresentados anteriormente funcionarão dessa maneira, à exceção daqueles que instalam ou +fazer a atualização de pacotes, já que em geral é destrutivo misturar pacotes de arquiteturas e versões +diferentes num mesmo sistema. + +Trabalhando com múltiplas instalações +------------------------------------- + +A funcionalidade apresentada na seção anterior só faz sentido quando existirem sistemas, jaulas e/ou +vservers instalados num mesmo computador. + +Suponha que você possua uma máquina x86_64 com três sistemas instalados: + + - Slamd64 11.0 na raíz + - Slackware 11.0 em /mnt/slackware-1 + - Slackware 10.2 em /mnt/slackware-2 + +No caso da instalação de pacotes, da obtenção e aplicação de atualizações, o simplaret suporta a +variável de ambiente ROOT para especificar qual é a pasta na qual o simplaret deve buscar o sistema. + +Para instalar um pacote no Slackware contido em /mnt/slackware-1, basta usar os comandos + + ARCH=i386 VERSION=11.0 simplaret update + ROOT=/mnt/slackware-1 simplaret install nome-do-pacote + +O primeiro comando apenas atualiza a lista de pacotes e o segundo faz com que o simplaret baixe +o pacote da arquitetura e versão do sistema presente em /mnt/slackware-1 bem como efetue sua instalação. + +Para o caso da instalação em /mnt/slackware-2, o uso é análogo: + + ARCH=i386 VERSION=10.2 simplaret update + ROOT=/mnt/slackware-2 simplaret install nome-do-pacote + +Existe ainda uma facilidade para que a obtenção e aplicação de atualizações seja feita de forma única, +através do arquivo /etc/simplepkg/jailist. Esse arquivo serve, além de outros propósitos descritos na +documentação do simplepkg, para que o simplaret saiba de antemão quais são as instalações de sistema +do tipo Slackware presentes numa máquina, além da instalação principal na raíz do sistema. + +Considerando que a máquina possua as três instalações citadas no início deste tópico, a atualização +automática das mesmas pode ser feita quando o arquivo /etc/simplepkg/jailist contiver as seguintes +linhas (sem espaços no início de cada uma): + + /mnt/slackware-1 + /mnt/slackware-2 + +O sistema principal, contido na raíz do sistema, não precisa estar listado nesse arquivo. Se todas +as suas instalações de sistema do tipo Slackware estiverem constando corretamente no /etc/simplepkg/jailist, +o seguinte comando baixará as atualizações disponíveis para todas elas, incluindo o sistema contido na raíz: + + simplaret get-patches + +Analogamente, o seguinte comando baixará e/ou aplicará todas as atualizações disponíveis em todas as +instalações, incluindo o sistema contido na raíz: + + simplaret upgrade + +Desse modo, o gerenciamento de pacotes numa máquina que contenha mais de uma instalação do tipo Slackware +fica unificada e consequentemente simplificada. + +O arquivo repos.conf +-------------------- + +Agora que o comportamento do simplaret foi delineado, é importante descrever o arquivo de definição de +repositórios, o /etc/simplepkg/repos.conf. Se você não pretende fazer um uso avançado do simplaret, +provavelmente pode deixar de ler esta e a próxima seção, já que para o uso corriqueiro do simplaret +você provavelmente não precisará alterar seu repos.conf, a não ser que queira mudar o espelho de download +dos seus pacotes ou montar um esquema avançado para a escolha e priorização de repositórios. + +O arquivo /etc/simplepkg/repos.conf contém uma definição de repositório por linha e a sintaxe de cada +uma delas é: + + TIPO[-ARQUITETURA][-VERSAO]="nome%URL" + +O conteúdo demarcado por colchetes é opcional dependendo do tipo de repositório, como veremos a seguir. +Os tipos de repositório aceitos pelo simplaret são: + + - PATCHES: definição para repositórios que contenham patches (pacotes de atualização) e cuja lista + de arquivos é FILE_LIST e não FILELIST.TXT; exemplo: + + PATCHES-i386-11.0="sarava%http://slack.sarava.org/packages/slackware/slackware-11.0/patches/" + + No caso da definição acima, temos um repositório de patches para a arquitetura i386 (distribuição + Slackware), versão 11.0 e o nome dado ao repositório é "sarava". + + Possuir uma definição do tipo PATCHES é opcional para ter acesso às atualizações: a definição + de repositório ROOT, que veremos em seguida, já lida com patches: o tipo de repositório PATCHES + serve apenas se você quiser utilizar algum repositório não-oficial como fonte de patches + prioritária, já que repositório PATCHES são pesquisados pelo simplaret antes de qualquer outro. + + Em resumo, se você não tiver um bom motivo para usar esse tipo de repositório, evite-o. + + - ROOT: são tipos de repositórios cujo conteúdo está dividido por versão. O exemplo tradicional + deste caso é o próprio repositório oficial das distribuições: + + ROOT-i386="tds%http://slackware.mirrors.tds.net/pub/slackware/" + + Repositórios ROOT necessitam apenas de uma definição de arquitetura, um nome e uma URL. No caso + acima, temos a definição de repositório ROOT de nome "tds", ou seja, não há definição de versão, + já que o simplaret considerará que a versão desejada está numa subpasta dessa URL. Ou seja, + definições ROOT implicam que as pastas contendo pacotes de cada versão estejam bem separadas, + ou seja, pastas como http://slackware.mirrors.tds.net/pub/slackware/slackware-10.2/ e + http://slackware.mirrors.tds.net/pub/slackware/slackware-11.0/. + + - REPOS: este tipo de repositório é orientado a arquitetura e versão, como por exemplo + + REPOS-i386-11.0="sarava%http://slack.sarava.org/packages/slackware/slackware-11.0/" + + No caso acima, um repositório de nome "sarava" é definido para a arquitetura i386 e versão + 11.0 com a URL http://slack.sarava.org/packages/slackware/slackware-11.0/. Esse tipo de definição + é recomendado para repositórios não-oficiais. + + - NOARCH: o último tipo de definição é usado para repositórios cujos pacotes são independentes + de arquitetura e versão da distribuição. Como exemplo temos um repositório do Projeto Slack: + + NOARCH="sarava%http://slack.sarava.org/packages/noarch" + +Em qualquer tipo de repositório, a URL pode ser do tipo http://, ftp:// ou file:// (para repositórios +locais). + +Como podem haver mais de uma definição de repositório para cada tipo, versão e/ou arquitetura, +as mesmas são diferenciadas de acordo com o nome. Definições de repositório podem ter nomes idênticos, +desde que se refiram a tipo de repositório e/ou arquitetura e versão diferentes. + +Existe ainda uma prioridade dentre tipos de repositório e ordens de precedência. Numa pesquisa, +repositórios são pesquisados de acordo com a seguinte ordem: + + - PATCHES tem prioridade mais alta: caso um pacote de uma dada arquitetura e versão não seja + encontrado no primeiro repositório PATCHES do repos.conf, o próximo repositório definido na + ordem em que ele aparece no arquivo é pesquisado, e assim por diante. + + - Em seguida, pacotes são procurados nas definições ROOT da arquitetura em questão, na ordem + em que aparecem no repos.conf. + + - Depois, são os pacotes de repositórios REPOS daquela arquitetura e versão são pesquisados, + na ordem em que aparecem no repos.conf. + + - Por fim, repositórios NOARCH são pesquisados, na ordem em que são definidos. + +Em resumo, o simplaret tem uma ordem de precedência e execução de repositórios e para busca e obtenção +de pacotes: pacotes são exibidos de acordo com a ordem e precedência descritas acima. No caso da ontenção +de pacotes, o primeiro repositório que possuí-lo será utilizado, isto é, caso o pacote não for solicitado +explicitamente com seu nome de arquivo completo mas sim apenas com seu nome. + +No caso da obtenção de patches, por padrão apenas repositórios do tipo PATCHES e ROOT são pesquisados, +a não ser que isso seja configurado como contrário. + +Em repositórios do tipo REPOS e ROOT ainda é possível, através de parâmetros de configuração, explicitar +a ordem de pastas que são pesquisadas dentro dos repositórios, algo que veremos a seguir e facilita no +caso do usuário estar interessado em dar prioridade para aplicativos em fase de testes (usualmente +armazenados na pasta testing/) ou pacotes antigos (pasture). + +Parâmetros de configuração do simplepkg.conf +-------------------------------------------- + +Nesta seção os parâmetros do arquivo de configuração /etc/simplepkg/simplepkg.conf relevantes ao +simplaret estão descritos. Para uma lista completa de todos os parâmetros disponíveis, consulte o +simplepkg.conf contido no pacote do simplepkg. Aqui estão descritos apenas os principais, que são: + + - STORAGE: local de armazenameto dos pacotes baixados e das informações de repositório. + O valor padrão é /var/simplaret/packages. + + - PATCHES_DIR: local de armazenamento de pacotes que são patches (atualizações), isto é, o + local de armazenamento de pacotes de repositórios do tipo PATCHES (e eventualmente de + patches encontrados em repositórios do tipo ROOT, como veremos a seguir). O valor padrão + é /var/simplaret/patches. + + - SIMPLARET_DOWNLOAD_FROM_NEXT_REPO: indica se o simplaret deve tentar baixar um pacote do + próximo repositório (caso exista) quando o download do repositório atual tiver falhado. + Valores possíveis são "1" ou "yes" para habilitar a opção (que é o comportamento padrão) + ou "0" ou "no" para desabilitá-la. + + - SIMPLARET_PURGE_PATCHES: indica se o conteúdo da pasta de patches também deve ser apagado + quando o comando "simplaret --purge" é chamado. Use "yes" ou "1" para habilitar e "no" ou + "0" para desabilitar. O valor padrão é "1". + + - SIMPLARET_PURGE_WEEKS: controla o número de semanas a partir do qual o simplaret irá apagar + pacotes quando chamado com o comando "simplaret --purge", o que é equivalente a usar o + comando "simplaret --purge -w N". O valor padrão é "3". Para desabilitar essa opção, atribua + o valor "0". + + - PASSIVE_FTP: Indica se o simplaret deve fazer as transferências de FTP no modo passivo. + O valor padrão é "1" (habilitado). + + - HTTP_TOOL: especifica qual a ferramenta para obtenção de arquivos via protocolo HTTP. + As opções disponíveis são "curl" e "wget", sendo que a opção padrão é "curl". + + - FTP_TOOL: especifica qual a ferramenta para obtenção de arquivos via protocolo FTP. + As opções disponíveis são "curl", "wget" e "ncftpget", sendo que a opção padrão é "curl". + + - CONNECT_TIMEOUT: tempo máximo de espera para uma conexão de rede, dado em segundos. + O valor padrão é "20". + + - ROOT_PRIORITY: especifica a ordem de prioridades das pastas de repositórios do tipo + ROOT numa pesquisa. O valor padrão é "patches slackware extra testing pasture", + indicando que a pasta de patches tem precedência sobre todas as outras no repositório, + sendo seguida pela pasta slackware e depois pelas extra, testing e pasture. Como + podem existir nomes de pacotes idênticos nessas pastas, o estabelecimento de uma + ordem se faz necessária. + + - REPOS_PRIORITY: da mesma forma como repositorios ROOT necessitam de uma prioridade + de pesquisa em pastas, este parâmetro de configuração especifica a prioridade de + pastas em repositórios do tipo REPOS. O valor padrão é + "patches slackware extra testing pasture". + + - SIGNATURE_CHECKING: indica se o simplaret deve checar pela assinatura dos pacotes + baixados, caso ela esteja disponível. Você deve ter a chave pública do distribuidor + dos pacotes no seu chaveiro. O valor padrão é "0" (desabilitado). + + - DEPENDENCY_CHECKING: indica se o simplaret deve trabalhar com a resuloção de dependências + caso ele encontre, no repositório, um arquivo slack-required correspondente ao pacote que + está sendo instalado. O valor padrão é "1" (habilitado). + + - DOWNLOAD_EVEN_APPLIED_PATCHES: indica de o simplaret deve baixar todos os patches + disponíveis a uma dada instalação de sistema do tipo Slackware, mesmo que os mesmo + já se encontrem aplicados. Esta opção é útil se você quiser manter uma cópia local + das atualizações existentes para seu sistema. O valor padrão é "0" (desabilitado). + + - CONSIDER_ALL_PACKAGES_AS_PATCHES: especifica se o simplaret deve, durante a obtenção + de pacotes de atualização, procurar por atualizações também nos tipos de repositórios + REPOS e NOARCH. Com essa opção, o simplaret faz uma pesquisa pelo pacote e, se sua versão + ou buildnumber da primeira ocorrência não bater com as do pacote atualmente instalado, + ele baixa e o aplica, mesmo que seja um pacote de repositórios do tipo REPOS ou NOARCH. + O valor padrão é "0" (desabilitado). O uso dessa opção não é muito recomendado por poder + causar confusão e deixar o simplaret mais lento, mas pode ser útil caso você esteja + usando um repositório não-oficial que sempre atualiza seus pacotes. + + - STORE_ROOT_PATCHES_ON_PATCHES_DIR: controla se o simplaret deve armazenar os patches baixados + de repositórios do tipo ROOT na mesma pasta de armazenamento de patches provenientes de + repositórios do tipo PATCHES. É uma opção útil apenas se você quiser manter todos os patches + de repositórios ROOT e PATCHES num mesmo local. O valor padrão é "0" (desabilitado). + +Vale lembrar que todas as opções booleanas (isto é, que podem ser apenas habilitadas ou desabilitadas) +do simplepkg.conf tem os seguintes valores permitidos: "1" e "yes" para habilitado e "0" ou "no" para +desabilitado. + +Mas para quê serve isso? +------------------------ + +Você pode estar se perguntando: para que mais um gerenciador de pacotes para o Slackware e 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. + +Além disso, as inúmeras novas tecnologias de virtualização poderão necessitar de um sistema de gerenciamento +de pacotes que trabalha simultaneamente com múltiplas arquiteturas e versões. + +Mesmo que você possua apenas um único sistema do tipo Slackware em seu computador ou trabalhe apenas com uma +única arquitetura e/ou versão, o simplaret possui todas as funcionalidades necessárias para facilitar seu +dia-a-dia de gerenciamento de pacotes. + +Mais informações +---------------- + +O simplaret foi escrito por Silvio Rhatto (rhatto at riseup.net) e é disponibilizado dentro do pacote do +simplepkg e sob a licença GPL. Para obter o código fonte, digite + + svn checkout svn://slack.sarava.org/simplepkg + +O wiki de desenvolvimento: http://slack.sarava.org/wiki/Main/SimplePKG e o endereço da lista de discussão +utilizada para discussões sobre simplaret, simplepkg ou mesmo distribuições e pacotes do tipo Slackware é +http://listas.sarava.org/wws/info/slack. + diff --git a/tags/0.5/doc/TODO b/tags/0.5/doc/TODO new file mode 100644 index 0000000..9178f6e --- /dev/null +++ b/tags/0.5/doc/TODO @@ -0,0 +1,5 @@ +simplepkg todo list +------------------- + +TODO list at http://slack.sarava.org/wiki/Main/SimplePKG + diff --git a/tags/0.5/doc/mkbuild.tex b/tags/0.5/doc/mkbuild.tex new file mode 100644 index 0000000..9e620ae --- /dev/null +++ b/tags/0.5/doc/mkbuild.tex @@ -0,0 +1,627 @@ +\documentclass[12pt,a4paper,oneside]{article} +%\usepackage[T1]{fontenc} +\usepackage[latin1]{inputenc} +\usepackage[dvips]{graphicx} +%\usepackage{subfigure} +\usepackage{mdwlist} +\usepackage{a4} +%\topmargin -.5in +%\addtolength{\hoffset}{-1.0cm} +%\addtolength{\textwidth}{3.0cm} +%\textwidth = 400pt +%\textheight = 680pt + +\makeatletter + +%\usepackage[pdftex]{color,graphicx} +%\DeclareGraphicsExtensions{.jpg,.pdf,.mps,.png} + +\usepackage[brazil]{babel} +\usepackage[dvips]{graphicx} +%\usepackage{textdraw} + +\input texdraw +%\newenvironment{textdraw}{\leavevmode\btexdraw}{\etexdraw} + +\newcommand{\rcap}[1]{Capítulo \ref{#1}} +\newcommand{\rfig}[1]{Figura \ref{#1}} +\newcommand{\rtab}[1]{Tabela \ref{#1}} +\newcommand{\rsec}[1]{Seção \ref{#1}} + +\makeatother + +\begin{document} + + +\title{Construindo SlackBuilds com mkbuild} + +\author{Rudson Alves} + +\date{\today} + +\maketitle + +%\pagenumbering{roman} + +\tableofcontents{} +%\listoffigures +%\listoftables + +%\abstract{...} + + +\section{Introdução} + +O \textit{mkbuild} é um programa em \textit{script shell} destinado a construção de \textit{Slackbuilds}, \textit{scripts} utilizados para a construção de pacotes no \textit{Slackware}. + +\section{O modelo generic.mkSlackBuild} + +O \textit{mkbuild} utiliza o modelo padrão \textit{generic.mkSlackBuild}, armazenado em + +\begin{verbatim} +/etc/simplepkg/defaults/mkbuild/ +\end{verbatim} + +Este modelo é uma versão setorizada do \textit{generic.SlackBuild}, levemente modificada. O \textit{generic.SlackBuild} é um modelo genérico de \textit{Slackbuilds} disponibilizado na árvore de \textit{Slackbuilds} do \textit{Slack.Sarava}, para servir como modelo para a construção dos \textit{scripts}. Outros modelos setorizados podem ser utilizados pelo \textit{mkbuild}, a única limitação é quanto ao nome da seção \textit{slackdesc}, que não poderá ser alterada. + + +\subsection{Os Campos} + +O modelo \verb!generic.mkSlackBuild! é um \textit{SlackBuild} genérico com vários campos destacados por duplo colchetes, \verb![[! \dots \verb!]]!, com mostra o trecho abaixo: + +\begin{verbatim} +... + 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]]} +... +PREFIX=${PREFIX:=[[PREFIX]]} +PKG_SRC="$TMP/$SRC_NAME-$SRC_VERSION" + +... +\end{verbatim} + +Uma breve descrição destes campos é apresentada na tabela abaixo: \\ +\\ +\begin{tabular}{l|l} +\hline \hline +\textbf{Campo} & \textbf{Descrição}\\ +\hline \hline +PROGRAM NAME & nome do programa \\ +PROGRAM URL & \textit{URL} da fonte do pacote \\ +SLACKBUILD AUTHOR & nome do autor \\ +SOURCE NAME & nome da fonte, sem versão ou extensão \\ +PACKAGE NAME & nome do pacote e ser gerado \\ +ARCH & arquitetura do pacote. Padrão \verb!i486! \\ +VERSION & versão do pacote \\ +SLACKBUILD AUTHOR INITIALS & assinatura utilizada pelo autor \\ +PREFIX & prefixo da instalação (\verb!/usr!, \verb!/opt!, ...)\\ +SOURCE EXTENSION & extensão da fonte (\verb!bz2!, \verb!gz!, ...) \\ +DOWNLOAD FOLDER URL & \textit{URL} da pasta onde se encontra a fonte \\ +DECOMPRESSOR & o descompressor para a fonte (\verb!gunzip!, \verb!bunzip2!, ...) \\ +DECOMPRESSOR TEST FLAG & \textit{flag} de teste do descompressor \\ +SIGNING KEY URL & \textit{URL} da chave \textit{gpg} do fonte \\ +SIGNING KEY & chave \textit{gpg} da fonte \\ +MD5SUM EXTENSION & extensão utilizada pelo arquivo \textit{md5sum}\\ +PATCH FILES & arquivo \textit{path} \\ +NUMBER OF PREFIX SLASHES TO STRIP & \dots \\ +SOURCE NAME CONSTRUCTION STRING & string para a construção do nome do arquivo. O padrão é \$SRC\_NAME-\$VERSION.tar.\$EXTENSION \\ +OTHER CONFIGURE ARGS & argumentos de configuração passados ao \verb!./configure! \\ +DOCUMENTATION FILES & lista de arquivos para a pasta \verb!/usr/doc/PACKAGE! \\ +SLACK-DESC & conteúdo do \verb!slack-desc!, descrição do pacote \\ +REST OF DOINST.SH & conteúdo do \verb!doinst.sh! \\ +\hline +\end{tabular} +\\\\ + +Em alguns casos o nome do pacote difere do nome da fonte, como é o caso da fonte \verb!sigc++!, que gera o pacote de nome \verb!libsiggc++!. Por este motivo que existem os campos \textit{SOURCE NAME} e \textit{PACKAGE NAME}. Para uma compreensão mais profunda destes campos, aconselho ler o \textit{script} \textit{generic.SlackBuild}. + + +\subsection{As Seções} + +As seções no modelo \verb!generic.mkSlackBuild!, são iniciadas pela \textit{tag} \verb!! e terminadas com \verb!!, como em um código \textit{html}, \underline{sem espaços}. + +A única seção que não pode ter seu nome alterado é \textit{slackdesc}. Esta seção é editada de uma forma diferenciada pelo \textit{mkbuild} e a alteração de seu nome poderá gerar erro. + +Cada seção possui uma \textit{flag} com os possíveis valores: + +\begin{description} + \item[on] habilitado; + \item[off] desabilitado; + \item[all] sempre habilitado. +\end{description} + +A intenção destas \textit{flags} é gerar um padrão para as seções, deixando em \textbf{all} as seções que deverão estar sempre habilitadas e \textbf{on} ou \textbf{off} seções que podem ser habilitadas ou desabilitadas de acordo com as necessidades do \textit{SlackBuild} que será construído. + +As seções padrões do \verb!generic.mkSlackBuild! são listadas na tabela abaixo: +\\\\ +\begin{tabular}{l|l|c} +\hline +Seção & Descrição & Flag \\ +\hline +head & cabeçalho do \textit{SlackBuild} & all \\ +slackbuildrc & carrega \textit{script} \verb!slackbuildrc! & off \\ +set\_variables & inicia as variáveis & all \\ +slkflags & carrega \textit{flags} para compilação & all \\ +error\_codes & códigos de erro para o \verb!createpkg! & off \\ +start\_structure & cria diretórios para compilação & all \\ +download\_source & baixa a fonte do pacote & off \\ +md5sum\_download\_and\_check\_0 & verifica \textit{md5sum} da fonte por código & off \\ +md5sum\_download\_and\_check\_1 & verifica \textit{md5sum} da fonte por arquivo & off \\ +gpg\_signature\_check & verifica assinatura \textit{gpg} da fonte & off \\ +untar\_source & desempacota a fonte & all \\ +path\_source & aplica \textit{path} a fonte & off \\ +configure & configura pacote & off \\ +make\_package & compila o pacote & all \\ +install\_package & instala o pacote em diretório temporário & all \\ +strip\_binaries & limpa binários & off \\ +compress\_manpages & comprime páginas de manuais & off \\ +compress\_info\_files & comprime arquivos \textit{info} & off \\ +install\_documentation & instala documentação & off \\ +slackdesc & \textit{slackdesc} do pacote & off \\ +postinstall\_script & \textit{script} de pós-instalação & off \\ +build\_package & constrói pacote & all \\ +clean\_builds & remove fontes e instalação temporária & off \\ +\hline +\end{tabular} +\\\\ + + +\section{Configuração} + +Por hora, o \textit{mkbuild} utiliza apenas um variável de configuração em \verb!/etc/simplepkg/simplepkg.conf!. A variável \textit{SLACKBUILDS\_DIR} é necessária para utilizar o \textit{mkbuild} com a opção ``\textit{-c}'' ou ``-\textit{-commit}'', que incorpora os arquivos \textit{SlackBuild} e \textit{slack-required} à estrutura de diretórios do \textit{Slack.Sarava}, na cópia local. + + +\section{Criando o SlackBuild de um aplicativo} + +Para fazer um \textit{SlackBuild} com o \textit{mkbuild} é necessário criar um arquivo com os parâmetros que deseja que sejam passados para o modelo. Um arquivo de configuração simples, \textit{sample-Pyrex-small.mkbuild}, é apresentado abaixo: + +\begin{verbatim} +#-------------------- +# Variables +#-------------------- +# Author name +[[SLACKBUILD AUTHOR]]="Adalberto Simão Nader" + +# +# Complete URL address or URL base address ( without $SRC_NAME-$VERSION... ) +[[DOWNLOAD FOLDER URL]]="http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/Pyrex-0.9.5.1a.tar.gz" + +# +# Default enable sections: +# head, set_variables, slkflags, start_structure, untar_source, +# make_package, install_package, build_package +# Warning: don't remove '#>>' and "#<<" tags. +#>> Start SlackBuild Sections: + on: slackbuildrc + on: slkflags + on: error_codes + on: download_source + on: configure + on: strip_binaries + on: install_documentation + on: slackdesc + on: clean_builds +#<< End SlackBuild Sections + +#------------------ +# Sections changes +#------------------ +#>slackdesc +pyrex: Pyrex by Slack.Sarava +pyrex: +pyrex: Pyrex is a language specially designed for writing Python extension +pyrex: modules. Its designed to bridge the gap between the nice, high-level, +pyrex: easy-to-use world of Python and the messy, low-level world of C. +pyrex: +pyrex: +pyrex: +pyrex: +pyrex: +pyrex: +#$ & maior \\ +$>=$ & maior ou igual \\ +\hline +\end{tabular} + +Os campos \textit{CONDIÇÃO} e \textit{VERSÃO} podem ser omitidos. Cada pacote da dependência deve ser separado por um ``:''. + +Para o \textit{SLACK REQUIRED} definido com a linha: + +\begin{verbatim} +[[SLACK REQUIRED]]="dep1 >= 1.1.1: dep2 >= 2.2.2:dep3:dep4:dep5 = 1.0" +\end{verbatim} + +\noindent será gerado o arquivo \textit{slack-required} abaixo: + +\begin{verbatim} +# Dependency list to Pyrex +# +# dependency [condition] [version]] +dep1 >= 1.1.1 +dep2 >= 2.2.2 +dep3 +dep4 +dep5 = 1.0 +\end{verbatim} + + +\subsubsection{SLACKBUILD MODEL} + +Este parâmetro contém o nome do modelo utilizado para gerar os \textit{SlackBuilds}. O valor padrão é \textit{generic.mkSlackBuild}. Outros modelos podem ser utilizados adicionando-se o arquivo do modelo no diretório \verb!/etc/simplepkg/defaults/mkbuild/!. A linha abaixo + +\begin{verbatim} +[[SLACKBUILD MODEL]]="generic.mkSlackBuild.2" +\end{verbatim} + +\noindent define o modelo \textit{generic.mkSlackBuild.2} para a construção do \textit{SlackBuild}. + + +\subsubsection{SLACKBUILD PATH} + +Este parâmetro é necessário apenas para uso com a opção ``-c'', \textit{commit}. Ele indica o diretório, na estrutura de diretórios do Slack.Sarava, onde o \textit{SlackBuild} construído deverá ser armasenado. Se este parâmetro não for passado, o \textit{mkbuild} irá pesquisá-lo no repositório do \textit{gentoo}, pela \textit{internet}. Caso não consiga resolver com esta pesquisa, o \textit{SlackBuild} será colocado em um diretório padrão, para \textit{scripts} não classificados, em \verb!others/unclassified/$PKG_NAME!. + +\begin{verbatim} +[[SLACKBUILD PATH]]="dev/python/pyrex" +\end{verbatim} + +A estrutura de diretórios para armazenamento dos \textit{SlackBuilds} adotadas pelo \textit{Slack.Sarava} segue o mesmo padrão do \textit{portage} do \textit{gentoo}. + + +\subsubsection{Outros Parâmetros} + +Outros parâmetros podem ser passados para substituição no modelo \textit{generic.mkSlackBuild}, como o parâmetro \textit{MD5SUM EXTENSION} no trecho abaixo: + +\begin{verbatim} +#[[PATCH FILES]]="" +#[[MD5SUM CODE]]="" +[[MD5SUM EXTENSION]]="047574eb5d1b7848a70d4130035f1f3c" +#[[SIGNING KEY]]="" +#[[SIGNING KEY URL]]="" +#[[PATCH FILES]]="" +\end{verbatim} + +Além destes parâmetros padrões do \textit{generic.mkSlackBuild}, qualquer outro parâmetro pode ser criado e incluído ao modelo. Para isto é necessário que seu nome seja incluído entre duplo colchetes como no exemplo abaixo: + +\begin{verbatim} +[[NEW PARAMETER]]="new value" +\end{verbatim} + +O \textit{mkbuild} irá procurar a ocorrência da seqüência \textit{[[NEW PARAMETER]]} no modelo passado por \textit{[[SLACKBUILD MODEL]]} e irá substitui-lo por ``\textit{new value}''. + + +\subsection{Habilitando seções} + +As seções do modelo \textit{generic.mkSlackBuild} são habilitadas na seção iniciada por ``\#$>>$'' e terminada por ``\#$<<$'', no arquivos de parâmetros. Como as seções estão desabilitadas no modelo padrão, \textit{generic.mkSlackBuild}, esta seção do arquivo de parâmetros tem apenas que habilitar as seções desejadas do modelo. + +\begin{verbatim} +#>> Start SlackBuild Sections: + on: slackbuildrc + on: slkflags + on: error_codes + on: download_source + on: configure + on: strip_binaries + on: install_documentation +# linha ignorada + on: slackdesc + on: clean_builds +#<< End SlackBuild Sections +\end{verbatim} + +No caso do exemplo acima, são habilitadas as seções: \textit{slackbuildrc}, \textit{slkflags}, \textit{error\_codes}, \textit{download\_source}, \textit{configure}, \textit{strip\_binaries}, \textit{install\_documentation}, \textit{slackdesc} e \textit{clean\_builds}. Linhas iniciadas por uma tralha, \#, são ignoradas. + + +\subsubsection{Substituição de seções do modelo} + +Em algumas situações pode ser necessário substituir o conteúdo de uma seção. Estas mudanças nas seções são feitas por iniciar uma seção, no arquivo de parâmetros, por ``\verb!#>nome_da_seção!'' e terminar por ``\verb!#untar_source +# Untar program + +# Change to temp dir +cd "$TMP" + +# Uncompress e untar source +gunzip "$SRC_DIR/$SRC" | tar --no-same-owner --no-same-permissions -xvf || exit $ERROR_TAR + +# Change to source dir +cd "$PKG_SRC" +#slackdesc +pyrex: Pyrex by Slack.Sarava +pyrex: +pyrex: Pyrex is a language specially designed for writing Python extension +pyrex: modules. Its designed to bridge the gap between the nice, high-level, +pyrex: easy-to-use world of Python and the messy, low-level world of C. +pyrex: +pyrex: +pyrex: +pyrex: +pyrex: +pyrex: +#slackdesc! e \verb!# input file with build rules and variables + + Input options: + -a, --author + author name + -ai, --author_initials + author signature + -cs, --const_string + construction string to source name + -u, --url + url address to source + -pn, --pkg_name + package name + -sn, --src_name + source name + -pv, --pkg_version + package version + -md, --model + SlackBuild model file + -j, --jobs + Number of jobs to run simultaneously + --prefix + Prefix install directory + + Program options: + -h, --help + this help mesage + -c, --commit + commit SlackBuilds in local svn tree + -v, --version + program version + +EXAMPLES + mkbuild --prefix /usr/local pyrex.mkbuild + build pyrex.SlackBuild with prefix /usr/local and pyrex.mkbuild + variables and options definitions. + +AUTHOR + Written by Rduson R. Alves + + +REPORTING BUGS + Report bugs to + +COPYRIGHT + Copyright © 2006 Free Software Foundation, Inc. + This is free software. You may redistribute copies of it under the + terms of the GNU General Public License + . There is NO WARRANTY, to the + extent permitted by law. +\end{verbatim} + +Uma opção interessante é a \textit{-c}, utilizada para adicionar e atualizar uma cópia da lista de \textit{SlackBuilds}, localmente. + + +\end{document} + diff --git a/tags/0.5/doc/simplepkg.pdf b/tags/0.5/doc/simplepkg.pdf new file mode 100644 index 0000000..22cc869 Binary files /dev/null and b/tags/0.5/doc/simplepkg.pdf differ diff --git a/tags/0.5/doc/simplepkg.tex b/tags/0.5/doc/simplepkg.tex new file mode 100644 index 0000000..610ed08 --- /dev/null +++ b/tags/0.5/doc/simplepkg.tex @@ -0,0 +1,395 @@ +\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 sistemas slackware 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. +\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, 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 \emph{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 \emph{simplepkg} para obter pacotes de um repositório local ou remoto. + +Gerenciar instalações e pacotes não é tudo o que o \emph{simplepkg} faz. Ele pode ser usado até na criação de jaula e vservers, podendo manter toda a configuração das máquinas num repositório Subversion. + +O \emph{simplepkg} funciona não apenas com o Slackware mas com qualquer port (oficial ou não) que siga minimamente os padrões oficiais. + +\section{Arquitetura} + +O \emph{simplepkg} é um conjunto de scripts escritos com a filosofia KISS (Keep It Simple, Stupid) 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 templatepkg: criar ou adiciona pacotes a um template + \item lspkg: lista pacotes instalados + \item jail-update: inverso do jail-commit + \item jail-commit: atualiza o template + \item rebuildpkg: reconstrói um pacote a partir de sua entrada no /var/log/packages + \item simplaret: obtém pacotes de repositórios locais ou remotos + \item createpkg: baixa, compila e empacota software de acordo com scripts presentes num repositório + \item repos: cria e mantém repositórios + \item mkbuild: cria scripts de construção de pacotes +\end{itemize} + +\section{Instalando o simplepkg} + +Para baixar o pacote do \emph{simplepkg}, vá em \link{http://slack.sarava.org/packages/noarch/}{http://slack.sarava.org/packages/noarch/}. Depois, basta usar o comando + +\begin{verbatim} +installpkg simplepkg-VERSAO-noarch-BUILD.tgz +\end{verbatim} + +\section{Usando o simplepkg} + +As três principais aplicações desse conjunto são: + +\begin{itemize} + \item Gerenciamento de pacotes + \item Criação e manutenção de jaulas + \item Criação de pacotes +\end{itemize} + +O gerencamento de pacotes é feito através do \link{http://slack.sarava.org/simplaret}{simplaret}, e por ser algo bem específico está detalhado no artigo correspondente. As seções a seguir mostrarão como o \emph{simplepkg} pode ser utilizado para criar e manter jaulas, assim como também criar pacotes. + +\section{Criando templates de instalação} + +Originalmente, o \emph{simplepkg} foi desenvolvido para ajudar na automatização de instalações de sistemas slackware. Para isso, 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 ou criar um chroot. + +A construção de um template é feita através do programa templatepkg. Para criar um template de nome "meu-slackware" contendo a lista de pacotes atualmente instalados no seu sistema, digite + +\begin{verbatim} +templatepkg -c meu-slackware +\end{verbatim} + +A opção -c (ou --create) criará a pasta /etc/simplepkg/templates/meu-slackware, que conterá os seguintes componentes: + +\begin{itemize} + \item \emph{/etc/simplepkg/templates/meu-slackware/meu-slackware.d}: cópia de arquivos de configuração + \item \emph{/etc/simplepkg/templates/meu-slackware/meu-slackware.s}: scripts de pós-instalação + \item \emph{/etc/simplepkg/templates/meu-slackware/meu-slackware.perms}: informações sobre arquivos + \item \emph{/etc/simplepkg/templates/meu-slackware/meu-slackware.template}: lista de pacotes +\end{itemize} + +Esses quatro componentes são suficientes para armazenar todas as características de uma instalação de slackware: a lista de pacotes controla o software instalado (a partir do conteúdo da pasta \emph{/var/log/packages}), a cópia dos arquivos de configuração controla as personalizações feitas para o uso dos aplicativos e os scripts de pós-instalação cuidam de qualquer rotina que precisa ser realizada exatamente após a instalação do sistema. Já o arquivo de informações sobre arquivos contém as permissões, o dono/a e grupo de cada arquivo de configuração presente no template. + +Se você quiser criar um template a partir de uma instalação de slackware presente numa outra partição do sistema que não seja a raíz, basta usar um comando do tipo + +\begin{verbatim} +templatepkg -c meu-slackware /mnt/slackware +\end{verbatim} + +onde /mnt/slackware é o local onde o sistema alternativo está instalado. Após criado, o template possuirá apenas a lista de pacotes contendo o nome dos aplicativos instalados no seu sistema. Como a pasta /var/log/packages não preserva a ordem de instalação dos pacotes, então talvez você queira editar manualmente a lista de pacotes de um template. Para isso, use o comando + +\begin{verbatim} +templatepkg -e meu-slackware +\end{verbatim} + +Para adicionar um arquivo de configuração no seu novo template, basta dar um comando como + +\begin{verbatim} +templatepkg -a meu-slackware /etc/hosts +\end{verbatim} + +Isso adicionará o arquivo /etc/hosts no template "meu-slackware". Além de salvar o arquivo e copiá-lo automaticamente quando você instalar seu sistema, o \emph{simplepkg} ainda pode tomar conta de qualquer alteração que o /etc/hosts sofrer no sistema, seja mudança no conteúdo do arquivo, dono ou permissão. Se você ainda estiver armazenando seus templates num repositório svn (o que veremos a seguir), o \emph{simplepkg} pode ainda manter um histórico completo das alterações do arquivo. + +ATENÇÂO: evite ao máximo deixar arquivos contendo senhas ou chaves privadas num template. O lugar mais adequado para deixar esse tipo de coisa é num backup seguro. + +\section{Criando jaulas e replicando instalações} + +Uma vez que um template foi criado com uma lista de pacotes e opcionalmente com arquivos de configuração e scripts de pós-instalação (que serão detalhados a seguir), você pode replicar sua instalação de slackware utilizando o comando + +\begin{verbatim} +mkjail jaula meu-slackware +\end{verbatim} + +Isso cria uma nova árvore do slackware em /vservers/jaula contendo todos os pacotes e arquivos de configuração do template "meu-slackware". A instalação dos pacotes será feita pelo aplicativo \link{http://slack.sarava.org/simplaret}{simplaret}, que deve estar configurado corretamente e cuja configuração padrão deve funcionar para a maioria dos casos. + +Se você quiser instalar essa jaula em outro local que não seja a pasta /vservers (esse local padrão pode ser mudado pelo arquivo de configuração do \emph{simplepkg}), basta usar 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 /mnt/hda2, dispensando totalmente o programa de instalação do slackware! + +Caso nenhum template for especificado, o mkjail utiliza o template /etc/simplepkg/default. O \emph{simplepkg} já vem com alguns templates padrões, presentes em /etc/simplepkg/defaults/templates. + +\section{Scripts de pós-instalação} + +Opcionalmente, é possível manter scripts de pós-instalação num template. Tais script são executados exatamente +após a instalação de uma jaula e cópia de arquivos de configuração pelo mkjail. Para criar ou editar um script +de pós-instalação, use um comando como + +\begin{verbatim} +templatepkg -b meu-slackware nome-do-script.sh +\end{verbatim} + +Isso adicionará o script nome-do-script.sh no template "meu-slackware". O mkjail passa dois argumentos para cada script de pós-instalação: a pasta superior e o nome da jaula ("/mnt" e "hda2" no nosso exemplo anterior). Assim, um exemplo de script seria algo como + +\begin{verbatim} +#!/bin/bash +chroot $1/$2/ sbin/ldconfig +\end{verbatim} + +\section{Listando o conteúdo de um template} + +Para listar os templates disponíveis ou o conteúdo de um template, use comandos como + +\begin{verbatim} +templatepkg -l +templatepkg -l meu-slackware +\end{verbatim} + +\section{Removendo arquivos de um template} + +Analogamente à forma como se adicona arquivos num template, removê-los pode ser feito com o seguinte comando: + +\begin{verbatim} +templatepkg -d meu-slackware /etc/hosts +\end{verbatim} + +Isso remove o arquivo /etc/hosts do template "meu-slackware". + +\section{Apagando um template} + +Para apagar um template, basta utilizar um comando como + +\begin{verbatim} +templatepkg -r meu-slackware +\end{verbatim} + +\section{Atualizando um template} + +Agora que já abordamos as opções do templatepkg, é hora de visitarmos um outro aplicativo, desta vez utilizado para manter um template atualizado. O jail-commit é um script que copia as alterações dos arquivos (conteúdo, propriedade e permissões) de um template a partir do conteúdo de uma jaula ou instalação. + +Por exemplo, caso se queira copiar as alterações da jaula /mnt/hda2 no template "meu-slackware", basta usar o comando + +\begin{verbatim} +jail-commit /mnt/hda2 meu-slackware +\end{verbatim} + +Além da lista de pacotes do template "meu-slackware" ser atualizada de acordo com a lista de pacotes presente em /mnt/hda2/var/log/packages, todos os arquivos de configuração presentes no template "meu-slackware" serão comparados com os correspondentes da pasta /mnt/hda2 e as diferenças são copiadas para o template. Da mesma forma, as permissões e informação de dono/grupo dos arquivos também é atualizada no template. + +O comando jail-commit possibilita que um template sempre esteja atualizado e refletindo a configuração atual de uma instalação de slackware. Se você quiser atualizar apenas a lista de pacotes de um template, porém, use + +\begin{verbatim} +templatepkg -u meu-template +\end{verbatim} + +Para facilitar ainda mais o controle das alterações do sistema, existe ainda uma facilidade do arquivo /etc/simplepkg/jailist. Esse arquivo serve, além de outros propósitos descritos na \link{http://slack.sarava.org/simplaret}{documentação do simplaret}, para que o jail-commit saiba de antemão quais são as instalações de sistema do tipo Slackware presentes numa máquina, além da instalação principal na raíz do sistema. + +Suponha que uma máquina possua duas instalações de slackware, além da principal (raíz): + +\begin{itemize} + \item /mnt/slackware-1 usando o template "slackware-1" + \item /mnt/slackware-2 usando o template "slackware-2" +\end{itemize} + +Se o arquivo /etc/simplepkg/jailist contiver as seguintes linhas, + +\begin{verbatim} +/mnt/slackware-1 +/mnt/slackware-2 +\end{verbatim} + +então o comando + +\begin{verbatim} +jail-commit +\end{verbatim} + +atualizará o template "slackware-1" de acordo com o conteúdo da jaula /mnt/slackware-1 e o template "slackware-2" com o conteúdo da jaula /mnt/slackware-2. Se, além desses dois templates, existir um outro de nome "main", então o jail-commit sem argumentos também copiará as atualizações da instalação raíz, deixando-as no template "main". + +Você pode inclusive colocar uma entrada no crontab do tipo + +\begin{verbatim} +20 4 * * * jail-commit +\end{verbatim} + +para que seus templates sejam atualizados diariamente. Se você ainda possui o envio de emails configurado na sua máquina, então a saída do jail-commit será enviada pelo cron diariamente para seu email, contendo diffs das alterações de arquivos de configuração a lista de pacotes adicionados ou removidos no sistema. + +\section{Restaurando arquivos de configuração numa jaula} + +A operação contrária ao que o jail-commit faz também é possível: suponha que você mexeu na configuração do sistema mas se arrependeu das alterações e deseja voltar a configuração para o modo como ela se encontra no seu template, basta usar o comando + +\begin{verbatim} +jail-update /mnt/hda2 meu-slackware +\end{verbatim} + +\section{Armazenando as configurações no repositório Subversion} + +Para aumentar ainda mais a flexibilidade e o controle do conteúdo dos templates, é possível armazená-los num repositório Subversion. Para isso, edite o arquivo /etc/simplepkg/simplepkg.conf e deixe o parâmetro de configuração \emph{TEMPLATES\_UNDER\_SVN} com o valor "yes". + +Depois, crie um repositório subversion para armazenar seus templates, usando algo como + +\begin{verbatim} +svnadmin create /var/svn/simplepkg --fs-type fsfs +\end{verbatim} + +Com o repositório criado, basta importar seus templates com o comando + +\begin{verbatim} +templatepkg -e file:///var/svn/simplepkg +\end{verbatim} + +A partir daí, o comando jail-commit enviará automaticamente todas as alterações dos templates para o repositório subversion. Se, por outro lado, você quiser baixar as alterações dos templates que estão no repositório remoto para sua cópia local, use o comando + +\begin{verbatim} +templatepkg -s +\end{verbatim} + +Caso você queira importar uma pasta de templates de um repositório já existente, use + +\begin{verbatim} +templatepkg -i file:///var/svn/simplepkg +\end{verbatim} + +onde file:///var/svn/simplepkg é o camninho do repositório. + +\section{Atualização de jaulas} + +A atualização de jaulas e sistemas instalados é feita através do \link{http://slack.sarava.org/simplaret}{simplaret} e também utiliza o arquivo /etc/simplepkg/jailist. Para mais informações a respeito, consulte a \link{http://slack.sarava.org/simplaret}{documentação do simplaret} para mais detalhes. + +\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 \link{http://slack.sarava.org/simplaret}{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 + +\begin{verbatim} +VERSION=10.1 mkjail minha-jaula template-servidor +\end{verbatim} + +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 + +\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. + +\section{Criando um pacote de um template} + +Se, por algum motivo, você quiser construir um pacote com o conteúdo de um template, experimente o comando + +\begin{verbatim} +templatepkg -p nome-do-template +\end{verbatim} + +No entanto, o \emph{simplepkg} foi criado para que esse tipo de comportamento seja evitado, já que é mais simples manter templates de configuração do que pacotes contendo a configuração de uma instalação. + +\section{Construindo pacotes} + +Até aqui, apenas mostramos os aplicativos do \emph{simplepkg} usados para a manutenção de instalações de slackware. No entanto, uma das outras finalidades desta suíte é a construção de pacotes, o que é feita pelo programa createpkg, Como dito anteriormente, o createpkg: baixa, compila e empacota software de acordo com scripts presentes num repositório de scripts, funcionando com um gerenciador de "ports" para slackware. + +O createpkg pode funcionar com qualquer tipo de script de construção de pacotes (SlackBuilds) mas funcionará melhor se os mesmos seguirem o padrão descrito na página + +\begin{verbatim} +http://slack.sarava.org/wiki/Main/SlackBuilds +\end{verbatim} + +Especificamente, o createpkg foi desenvolvido para utilizar os slackbuild disponíveis em \link{http://slack.sarava.org/slackbuilds}{http://slack.sarava.org/slackbuilds}. O createpkg trabalha com repositórios do tipo subversion. + +Para obter os scripts do repositório do slack.sarava.org, digite + +\begin{verbatim} +createpkg --sync +\end{verbatim} + +Em seguida, você pode listas todos os scripts disponíveis: + +\begin{verbatim} +createpkg --list +\end{verbatim} + +Para buscar por um pacote, use + +\begin{verbatim} +createpkg --search latex2html +\end{verbatim} + +No caso, a busca é feita pelo SlackBuild do aplicativo "latex2html". Suponha agora que você queira construir o pacote desse aplicativo: + +\begin{verbatim} +createpkg latex2html +\end{verbatim} + +O pacote resultante estará na pasta /tmp ou no valor especificado pela variável de ambiente \emph{\$REPOS}. Para criar e também instalar o pacote, basta + +\begin{verbatim} +createpkg --install latex2html +\end{verbatim} + +Se o pacote possuir dependências listadas num arquivo slack-required e que não estiverem instaladas no sistema, o createpkg tentará processá-las uma a uma antes de tentar construir o pacote desejado: se as dependências não forem encontradas no repositório de scripts, então o createpkg tentará baixá-las de um repositório binário através do \link{http://slack.sarava.org/simplaret}{simplaret}. Se você não quiser que a resolução de dependências seja seguida, use a opção --no-deps. + +Para mais detalhes de funcionamento, experimente o comando + +\begin{verbatim} +createpkg --help +\end{verbatim} + +ou então acesse a página http://slack.sarava.org/wiki/Main/SlackBuilds. + +\section{Aplicativos auxiliares} + +O \emph{simplepkg} acompanha ainda alguns aplicativos auxiliares: + +\begin{itemize} + \item lspkg: lista pacotes instalados + \item rebuildpkg: reconstrói um pacote a partir de sua entrada no /var/log/packages + \item repos: cria e mantém repositórios + \item mkbuild: cria scripts de construção de pacotes +\end{itemize} + +O comando lspkg é um utilitário simples para a visualização de pacotes instalados no sistema. Já o rebuildpkg 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 + +\begin{verbatim} +rebuildpkg coreutils +\end{verbatim} + +reconstrói um pacote do coreutils usando os arquivos e as metainformações listadas no arquivo do /var/log/packages/ correspondente ao coreutils. + +Por fim, os scripts repos e mkbuild são os que se encontram na etapa de maior desenvolvimento: repos cria um repositório de pacotes a partir de uma pasta contendo pacotes do tipo pkgtool e o mkbuild é um aplicativo para auxiliar a criação de scripts de construção de pacotes que podem ser utilizados sozinhos ou pelo o createpkg. + +\section{Parâmetros de configuração} + +O arquivo de configuração do \emph{simplepkg} é o /etc/simplepkg/simplepkg.conf. Ele contém parâmetros de configuração de todos os scripts, porém neste texto não trataremos das opções específicas ao \link{http://slack.sarava.org/simplaret}{simplaret}, as quais tem uma seção específica no artigo correspondente. + +\begin{itemize} + \item \emph{JAIL\_ROOT}: pasta padrão onde as jaulas são criadas pelo mkjail. Valor padrão: "/vservers". + \item \emph{ADD\_TO\_JAIL\_LIST}: controla se uma jaula criada pelo mkjail deve ser adicionada automaticamente no arquivo /etc/simplepkg/jailist. O valor padrão é "1" (habilitado). + \item \emph{TEMPLATES\_UNDER\_SVN}: indica se os templates estão armazenados num repositório subversion. O valor padrão é "no" (não). + \item \emph{TEMPLATE\_FOLDER}: indica qual é a pasta de templates. O valor padrão é "/etc/simplepkg/templates" e não é recomendável alterá-lo. + \item \emph{TEMPLATE\_STORAGE\_STYLE}: controla a forma de armazenamento de templates. O valor padrão é "own-folder" e essa opção apenas deve ser modificada se você armazena seus templates num formato antigo do \emph{simplepkg} e deseja manter compatibilidade. +\end{itemize} + +Vale lembrar que todas as opções booleanas (isto é, que podem ser apenas habilitadas ou desabilitadas) do simplepkg.conf tem os seguintes valores permitidos: "1" e "yes" para habilitado e "0" ou "no" para desabilitado. + +\section{Mais informações} + +O \emph{simplepkg} foi escrito por Silvio Rhatto (rhatto at riseup.net) sob licença GPL e seu código fonte é disponibilizado através do repositório subversion: + +\begin{verbatim} +svn checkout svn://slack.sarava.org/simplepkg +\end{verbatim} + +O wiki de desenvolvimento: http://slack.sarava.org/wiki/Main/SimplePKG e o endereço da lista de discussão utilizada para discussões sobre o \emph{simplepkg} ou mesmo distribuições e pacotes do tipo Slackware é http://listas.sarava.org/wws/info/slack. + +\end{document} diff --git a/tags/0.5/install/doinst.sh b/tags/0.5/install/doinst.sh new file mode 100644 index 0000000..a61648e --- /dev/null +++ b/tags/0.5/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/tags/0.5/install/slack-desc b/tags/0.5/install/slack-desc new file mode 100644 index 0000000..38ea489 --- /dev/null +++ b/tags/0.5/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 packaging tool, simplaret +simplepkg: package retrieval, mkjail chroot installer and templatepkg template +simplepkg: management system. +simplepkg: +simplepkg: +simplepkg: +simplepkg: +simplepkg: diff --git a/tags/0.5/lib/common.sh b/tags/0.5/lib/common.sh new file mode 100644 index 0000000..8d2bb2f --- /dev/null +++ b/tags/0.5/lib/common.sh @@ -0,0 +1,712 @@ +#!/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 1`" + 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 + + find . -type f -name *.tgz -follow -print | sort | tr '\n' '\0' | \ + xargs -0r ls -ldL --time-style=long-iso > 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 $cwd + + 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 $cwd + + 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 [ -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 $cwd + + 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/tags/0.5/simplepkg.SlackBuild b/tags/0.5/simplepkg.SlackBuild new file mode 100755 index 0000000..60ff082 --- /dev/null +++ b/tags/0.5/simplepkg.SlackBuild @@ -0,0 +1,73 @@ +#!/bin/bash +# +# SlackBuild script for simplepkg +# + +PACKAGE="simplepkg" +PACK_DIR="package-$PACKAGE" +BUILD=${BUILD:=1rha} +VERSION="0.5" +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/tags/0.5/src/createpkg b/tags/0.5/src/createpkg new file mode 100644 index 0000000..a80b033 --- /dev/null +++ b/tags/0.5/src/createpkg @@ -0,0 +1,501 @@ +#!/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.4.1" + +function error_codes { + + # Slackbuilds error codes + ERROR_WGET=31 # wget error + ERROR_MAKE=32 # make source error + ERROR_INSTALL=33 # make install error + ERROR_MD5=34 # md5sum error + ERROR_CONF=35 # ./configure error + ERROR_HELP=36 # dasable + ERROR_TAR=37 # tar error + ERROR_MKPKG=38 # makepkg error + ERROR_GPG=39 # gpg check error + ERROR_PATCH=40 # patch error + ERROR_VCS=41 # cvs error + ERROR_MKDIR=42 # make directory error + + # Createpkg error codes + ERROR_INSTPKG=200 # installpkg error + ERROR_DEPEN=201 # dependency error + SCRIPT_OR_PACKAGE_NOT_FOUND=202 # Script or package not found +} + +function 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 + +# Execute SlackBuild script with variables protection +( INTERACT=no sh ./$SCRIPT_NAME ) + +# Check if package was built +handle_error $? $PACKAGE + +PKG_TGZ="`ls -1 -c $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/tags/0.5/src/jail-commit b/tags/0.5/src/jail-commit new file mode 100755 index 0000000..f40e5cd --- /dev/null +++ b/tags/0.5/src/jail-commit @@ -0,0 +1,175 @@ +#!/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`" + + # secure the file + chown root.root $TEMPLATE_BASE.d/$file + chmod $perms $TEMPLATE_BASE.d/$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/tags/0.5/src/jail-update b/tags/0.5/src/jail-update new file mode 100755 index 0000000..c5a008f --- /dev/null +++ b/tags/0.5/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/tags/0.5/src/lspkg b/tags/0.5/src/lspkg new file mode 100755 index 0000000..01900f2 --- /dev/null +++ b/tags/0.5/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/tags/0.5/src/mkbuild b/tags/0.5/src/mkbuild new file mode 100755 index 0000000..fce2533 --- /dev/null +++ b/tags/0.5/src/mkbuild @@ -0,0 +1,680 @@ +#!/bin/bash +# +# 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. +# +# Version 0.9.8 +PROG_VERSION=0.9.8 + +#-------------------------------------------------------------------- +# Functions +#-------------------------------------------------------------------- +function mkbuild_use() + +{ + # mkbuild help function + echo " +NAME + mkbuild - create SlackBuild script from .mkbuild input file + +SYNOPSIS + mkbuild [OPIONS] [mkbuild_file] + +DESCRIPTION + input file with build rules and variables + + Input options: + -a, --author + author name + -ai, --author_initials + author signature + -cs, --const_string + construction string to source name + -u, --url + url address to source + -pn, --pkg_name + package name + -sn, --src_name + source name + -pv, --pkg_version + package version + -md, --model + SlackBuild model file + -j, --jobs + Number of jobs to run simultaneously + --prefix + Prefix install directory + + Program options: + -h, --help + this help mesage + -c, --commit + commit SlackBuilds in local svn tree + -v, --version + program version + +EXAMPLES + mkbuild --prefix /usr/local pyrex.mkbuild + build pyrex.SlackBuild with prefix /usr/local and pyrex.mkbuild + variables and options definitions. + +AUTHOR + Written by Rduson R. Alves + +AVAILABILITY + by svn: svn checkout svn://slack.sarava.org/simplepkg + this mkbuild is found in branches/0.6/ + +REPORTING BUGS + Report bugs to + +COPYRIGHT + Copyright © 2006 Free Software Foundation, Inc. + This is free software. You may redistribute copies of it under the + terms of the GNU General Public License + . There is NO WARRANTY, to the + extent permitted by law. +" | less +} + +function error_codes { + + # Start error codes function + NULL_STRING=499 + ERROR_FILE_NOT_FOUND=500 + ERROR_CONSTRUCTION=501 + ERROR_PROGRAM=502 + ERROR_INPUT_PAR=503 +} + +function mkbuild_error { + + # Error function + case $1 in + "$ERROR_FILE_NOT_FOUND") + echo "File $2 not found!" + ;; + "$ERROR_CONSTRUCTION") + echo "Construction error in $2 variable." + ;; + "$ERROR_PROGRAM") + echo "Program logical error." + ;; + "$ERROR_INPUT_PAR") + echo "Input parameter $2 error. See \"mkbuild --help\"." + ;; + *) + echo "Unknow error!" + ;; + esac + exit $1 +} + +function is_number { + + # Check if argument is a number + local -i int + if [ $# -eq 0 ]; then + return 1 + else + (let int=$1) 2>/dev/null + return $? # Exit status of the let thread + fi +} + +function set_parameters { + + # Get and set mkbuild variables with parameters input + # Use: set_parameters $@ + # where $@ are the parameters input + # + ALL_PAR=( $@ ) # carrega todos os parâmetros + N_PAR=$# # carrega o número de parâmetros + + i=0 # inicia o contador + # Checa todos os parâmetros passados + while [ $i -lt $N_PAR ]; do + # get parameter[i] + PAR=${ALL_PAR[$i]} + case $PAR in + '-c'|'--commit') + # Commit directory + COMMIT=1 + ;; + '-d'|'--debug') + # Debug mode + set -x + ;; + '-h'|'--help' ) + # Show help mesage + mkbuild_use && exit 0 + ;; + '-v'|'--version') + # Show program version + echo -e "\nmkbuild version $PROG_VERSION\n" && exit 0 + ;; + '-a'|'--author') + # Enter with author name + let i++ + AUTHOR=${ALL_PAR[$i]} + [ ${AUTHOR:0:1} = "-" ] && mkbuild_error $ERROR_INPUT_PAR AUTHOR + ;; + '-ai'|'--author_initials') + # Enter with author name + let i++ + AUTHOR_INITIALS=${ALL_PAR[$i]} + [ ${AUTHOR_INITIALS:0:1} = "-" ] && mkbuild_error $ERROR_INPUT_PAR AUTHOR_INITIALS + ;; + '-cs'|'--const_string') + # Enter with construction source name string + let i++ + CONST_STRING=${ALL_PAR[$i]} + [ ${CONST_STRING:0:1} = "-" ] && mkbuild_error $ERROR_INPUT_PAR CONST_STRING + ;; + '-md'|'--model') + # Enter with SlackBuild model + let i++ + MODEL=${ALL_PAR[$i]} + [ ${MODEL:0:1} = "-" ] && mkbuild_error $ERROR_INPUT_PAR MODEL + ;; + '-j'|'--jobs') + # Enter with SlackBuild model + let i++ + NUMJOBS=${ALL_PAR[$i]} + [ ${NUMJOBS:0:1} = "-" ] && mkbuild_error $ERROR_INPUT_PAR NUMJOBS + [ ! is_number $NUMJOBS ] && mkbuild_error $ERROR_INPUT_PAR NUMJOBS + NUMJOBS="-j$NUMJOBS" + ;; + '--prefix') + # Enter with SlackBuild model + let i++ + PREFIX=${ALL_PAR[$i]} + [ ${PREFIX:0:1} = "-" ] && mkbuild_error $ERROR_INPUT_PAR PREFIX + ;; + '-pn'|'--pkg_name') + # Enter with package name + let i++ + PKG_NAME=${ALL_PAR[$i]} + [ ${PKG_NAME:0:1} = "-" ] && mkbuild_error $ERROR_INPUT_PAR PKG_NAME + ;; + '-pv'|'pkg_version') + # Enter with package version + let i++ + VERSION=${ALL_PAR[$i]} + [ ${VERSION:0:1} = "-" ] && mkbuild_error $ERROR_INPUT_PAR VERSION + ;; + '-sn'|'--src_name') + # Enter with source name + let i++ + SRC_NAME=${ALL_PAR[$i]} + [ ${SRC_NAME:0:1} = '-' ] && mkbuild_error $ERROR_INPUT_PAR SRC_NAME + ;; + '-u'|'--url') + # Enter with url address + let i++ + URL=${ALL_PAR[$i]} + [ ${URL:0:1} = '-' ] && mkbuild_error $ERROR_INPUT_PAR URL + ;; + *) + # mkbuild input file + MK_INPUT_FILE="${PAR//.mkbuild}.mkbuild" + [ ! -e $MK_INPUT_FILE ] && mkbuild_error $ERROR_FILE_NOT_FOUND $MK_INPUT_FILE + ;; + esac + let i++ + done +} + +function get_variable { + + # Get variable value from mkbuild file (MK_INPUT_FILE) + [ $# -ne 1 ] && mkbuild_error $ERROR_PROGRAM + [ -z $MK_INPUT_FILE ] && echo "Warning: no [mkbuild_file]." && return 0 + + grep "^\[\[${1}\]\]" $MK_INPUT_FILE | cut -f2 -d\" +} + +function edit_file { + + # Edit file $3, by change string [[$1]] to $2 + local STR_OLD + local STR_NEW + + [ $# -ne 3 ] && mkbuild_error $ERROR_PROGRAM + STR_OLD=$( echo $1 | sed 's/\//\\\//g' ) + STR_NEW=$( echo $2 | sed 's/\//\\\//g' ) + eval "sed 's/\[\[$STR_OLD\]\]/$STR_NEW/' $3 > $AUX_TMP" + mv $AUX_TMP $3 +} + +function edit_file_full { + + # Edit file $3, by change string $1 to $2 + local STR_OLD + local STR_NEW + + [ $# -ne 3 ] && mkbuild_error $ERROR_PROGRAM + STR_OLD=$( echo $1 | sed 's/\//\\\//g' ) + STR_NEW=$( echo $2 | sed 's/\//\\\//g' ) + eval "sed 's/$STR_OLD/$STR_NEW/' $3 > $AUX_TMP" + mv $AUX_TMP $3 +} + +function start_build { + + # Build initial sections + [ $# -ne 1 ] && mkbuild_error $ERROR_PROGRAM + + edit_file "SLACKBUILD AUTHOR" "$AUTHOR" $1 + edit_file "SLACKBUILD AUTHOR INITIALS" $AUTHOR_INITIALS $1 + edit_file "SOURCE NAME" "$SRC_NAME" $1 + edit_file "PROGRAM NAME" "$PKG_NAME" $1 + edit_file "PACKAGE NAME" "$PKG_NAME" $1 + edit_file "DECOMPRESSOR" "$DECOMPRESSOR" $1 + edit_file "DECOMPRESSOR TEST FLAG" "$DECOMPRESSOR_TEST_FLAG" $1 + edit_file "PROGRAM URL" "$URL" $1 + edit_file "ARCH" "$ARCH" $1 + [ `is_number $NUMJOBS` ] && NUMJOBS="-j${NUMJOBS}" + edit_file "NUMBER OF JOBS" "$NUMJOBS" $1 + edit_file "VERSION" $VERSION $1 + edit_file "SOURCE NAME CONSTRUCTION STRING" "$CONST_STRING" $1 + edit_file "EXTENSION" "$EXTENSION" $1 + edit_file "DOWNLOAD FOLDER URL" "$URL_BASE" $1 + edit_file "OTHER CONFIGURE ARGS" "$OPTIONS" $1 + edit_file "DOCUMENTATION FILES" "$DOCFILES" $1 + edit_file "PREFIX" "$PREFIX" $1 + + edit_file_full "\$EXTENSION" "$EXTENSION" $1 +} + +function clear_files { + + # Remove temporary files + rm $AUX_TMP 2>/dev/null + rm $SLACKBUILD_TEMP 2>/dev/null +} + +function set_status { + + # Set status section + # $1 - Section + # $2 - Status + # $3 - file + [ $# -ne 3 ] && mkbuild_error $ERROR_PROGRAM + if [ "`get_status $1 $3`" != "all" ]; then + eval "sed 's/^<$1>.*$/<$1> $2/' $3" > $AUX_TMP + mv $AUX_TMP $3 + else + echo "Warning: Section $1 have status all. Can't change!" + fi +} + +function get_status { + + # Get status from section + # $1 - Section + # $2 - file + [ $# -ne 2 ] && mkbuild_error $ERROR_PROGRAM + eval "sed '/^<$1>.*$/! d' $2" +} + +function activate_sections { + + # Enable and desable sections + ACTIONS_LIST=`sed '/^#>>/,/< off/, /^<\/[a-z].*>$/ d' $SLACKBUILD_TEMP > $AUX_TMP + # Remove sections names + sed '/^<.*$/ d' $AUX_TMP > $SLACKBUILD_TEMP + # Remove clear lines + sed ':i ; $! N; s/\n// ; t i' $SLACKBUILD_TEMP | sed 's///g' | sed 's///g' | sed 's//\n/g' > $AUX_TMP + sed '1,/^#\!/ {/^#\!/ b; d }' $AUX_TMP > $SLACKBUILD +} + +function section_edit { + + # Edit sections by change you values + [ -z $MK_INPUT_FILE ] && return 0 + + SECTION_LIST=`grep '^#>[a-z]' $MK_INPUT_FILE | cut -c3-` + + # Check for sections change + [ -z "$SECTION_LIST" ] && return 0 + + # Change sections + for i in $SECTION_LIST; do + if [ "$i" = "slackdesc" ]; then + # Special slackdesc section + slackdesc_edit > $AUX_TMP + mv $AUX_TMP $SLACKBUILD_TEMP + else + # Others sections + section_change $i + fi + done +} + +function slackdesc_edit { + + # Edit slackdesc section + sed -n '1,/|-----/ { // b; /|-----/ b; p; }' $SLACKBUILD_TEMP + echo -n $PKG_NAME | tr [a-z+\-] " " + echo -n "|-----handy-ruler" + let N=18+${#PKG_NAME} + for i in `seq $N $SLACKDESC_LEN`; do + echo -n "-" + done + echo -en "|\n" + + sed -n '/#>slackdesc/,/#/! d' $SLACKBUILD_TEMP > $AUX_TMP" + # Paste new section + eval "sed -n '/#>$1/,/#<$1/ { /^#>/ b; /^#> $AUX_TMP" + # Copy second halt + eval "sed '/^<\/$1>/,$ ! d' $SLACKBUILD_TEMP >> $AUX_TMP" + + mv $AUX_TMP $SLACKBUILD_TEMP +} + +function make_slack_required { + + # Build slack-required file + [ -e slack-required ] && mv slack-required slack-required.old + [ -z "$SLACK_REQUIRED" ] && return 0 + + echo -e "# Dependency list to $SRC_NAME\n#\n# dependency [condition] [version]]" > slack-required + + echo $SLACK_REQUIRED | sed 's/:/\n/g' | while read i; do + REQ=`echo $i | awk '{ print $1 }'` + CON=`echo $i | awk '{ print $2 }'` + VER=`echo $i | awk '{ print $3 }'` + echo -e "$REQ\t\t$CON\t\t$VER" >> slack-required + done +} + +function change_others_fields { + + # Change others fields started by '[[' in .mkbuild file + grep '\[\[[A-Za-z]' $MK_INPUT_FILE | while read i; do + CHANGE="`echo $i | sed 's/\[\[\(.*\)\]\]=\"\(.*\)\"/\1/'`" + VALUE="`echo $i | sed 's/\[\[\(.*\)\]\]=\"\(.*\)\"/\2/'`" + edit_file "$CHANGE" "$VALUE" $SLACKBUILD + done +} + +function commit_slackbuild { + + # Commit SlackBuild in local Slack.Sarava tree + # Get SlackBuild path + SLACKBUILD_PATH=`validate_parameter "$SLACKBUILD_PATH" "SLACKBUILD PATH" ""` + if [ $? != 0 ]; then + # Mount SlackBuild path + AUX=`lynx -dump http://gentoo-portage.com/Search?search=$PKG_NAME | sed -n '/Results:/,+1 { /Results:/ b ; p }' | head --lines=1 | tr -d " "` + [ ! -z $AUX ] && SLACKBUILD_PATH="`dirname $AUX | tr - /`/`basename $AUX`" || SLACKBUILD_PATH="others/unclassified/$PKG_NAME" + fi + + # check SlackBuilds directory + [ ! -e $SLACKBUILDS_DIR ] && createpkg --sync + # change to SlackBuilds directory + cd $SLACKBUILDS_DIR/ + + # Add SlackBuild scripts + # check path + [ ! -e $SLACKBUILD_PATH ] && svn_mkdir $SLACKBUILD_PATH + # add SlackBuild + svn_add $SLACKBUILD $SLACKBUILD_PATH + + # check slack-required + # add slack-required + [ -e $WORK/slack-required ] && svn_add slack-required $SLACKBUILD_PATH + + cd $WORK +} + +function svn_mkdir { + + # svn make directory + [ $# -ne 1 ] && mkbuild_error 0 + + echo "svn_mkdir $1 $2" + DIR_LIST=`echo $1 | tr '/' ' '` + + DIR="" + for i in $DIR_LIST; do + DIR=$DIR/$i + [ ! -e ${DIR:1} ] && svn mkdir ${DIR:1} + done +} + +function svn_add { + + # svn add file + [ $# -ne 2 ] && mkbuild_error 0 + + # copy file + if [ -e $2/$1 ]; then + echo "$2/$1 exist. Overwriter it." + cp $WORK/$1 $2/ + else + cp $WORK/$1 $2/ + # add file to svn tree + svn add $2/$1 + fi +} + +function is_number { + + # Check if $1 is a number + local -i int + if [ $# -eq 0 ]; then + return 1 + else + (let int=$1) 2>/dev/null + return $? # Exit status of the let thread + fi +} + +function validate_parameter { + + # Validate parameter in .mkbuild file + if [ ! -z "$1" ]; then + echo "$1" + else + local STRING="`get_variable "$2"`" + if [ -z "$STRING" ]; then + [ ! -z "$3" ] && echo "$3" || return 1 + else + echo "$STRING" + fi + fi +} + +function decompress_find { + + # Find decompressor program and test flag + case $EXTENSION in + 'gz'|'GZ') + DECOMPRESSOR="gunzip" + DECOMPRESSOR_TEST_FLAG="-t" + ;; + 'bz2'|'BZ2') + DECOMPRESSOR="bunzip2" + DECOMPRESSOR_TEST_FLAG="-t" + ;; + 'zip'|'ZIP') + DECOMPRESSOR="unzip" + DECOMPRESSOR_TEST_FLAG="-t" + ;; + *) + mkbuild_error $ERROR_CONSTRUCTION "DECOMPRESSOR" + ;; + esac +} + +#============================= +# Main Program +#============================= +#----------------------------- +# Common functions +COMMON="/usr/libexec/simplepkg/common.sh" +SIMPLEPKG_CONF="/etc/simplepkg/simplepkg.conf" +WORK=`pwd` +LANG=en_US +COMMIT=0 + +if [ -f "$COMMON" ]; then + source $COMMON +else + echo "error: file $COMMON found, check your $BASENAME installation" + mk_exit 0 +fi + +# createpkg and mkbuild section +SLACKBUILDS_DIR="`eval_parameter SLACKBUILDS_DIR /var/slackbuilds`" +#----------------------------- + +# Start variables +DOWNLOAD_SOURCE=0 # desable download source +# Auxiliar file +AUX_TMP=/tmp/mkbuild_tmp.$RANDOM +# Derectory to SlackBuild models +MODEL_DIR=${MODEL_DIR:="/etc/simplepkg/defaults/mkbuild"} +# SlackDesk line length +SLACKDESC_LEN=78 + +# Load error codes +error_codes + +[ $# -eq 0 ] && mkbuild_use && exit 1 + +# Configure input parameters +set_parameters $@ + +# Get values +# Author name +AUTHOR=${AUTHOR:="`get_variable "SLACKBUILD AUTHOR"`"} +[ -z "$AUTHOR" ] && mkbuild_error $ERROR_CONSTRUCTION "SLACKBUILD AUTHOR" + +# Author initials +STR_MOUNT=`echo $AUTHOR | sed 's/ /\n/g' | sed 's/^\([A-Z]\).*/\1/' | sed ':i; $!N; s/\n//; ti' | tr [A-Z] [a-z]` +AUTHOR_INITIALS="`validate_parameter "$AUTHOR_INITIALS" "SLACKBUILD AUTHOR INITIALS" "$STR_MOUNT"`" || mkbuild_error $ERROR_CONSTRUCTION "SLACKBUILD AUTHOR INITIALS" + +# URL program +URL=`validate_parameter "$URL" "DOWNLOAD FOLDER URL" ""` || mkbuild_error $ERROR_CONSTRUCTION "URL" + +STR_MOUNT="`echo $URL | rev | cut -c1-3 | rev | tr -d '.'`" +if [ $STR_MOUNT = "gz" -o $STR_MOUNT = "tgz" -o $STR_MOUNT = "bz2" -o $STR_MOUNT = "zip" ]; then + SOURCE_NAME=`basename $URL` + URL_BASE=`dirname $URL` +else + URL_BASE=$URL +fi + +# Extension +EXTENSION=`validate_parameter "$EXTENSION" "EXTENSION" "$STR_MOUNT"` || mkbuild_error $ERROR_CONSTRUCTION "EXTENSION" + +# Build archteture +ARCH=`validate_parameter "$ARCH" "ARCH" "i486"` + +# Source name +STR_MOUNT=`echo $SOURCE_NAME | sed -r 's/(.*)-(.*)\.(.*\..*)$/\1/'` +SRC_NAME=`validate_parameter "$SRC_NAME" "SOURCE NAME" "$STR_MOUNT"` || mkbuild_error $ERROR_CONSTRUCTION "SOURCE NAME" + +# Package name +STR_MOUNT=`echo $SRC_NAME | tr [A-Z_] [a-z\-]` +PKG_NAME=`validate_parameter "$PKG_NAME" "PACKAGE NAME" "$STR_MOUNT"` + +# Version +STR_MOUNT=`echo $SOURCE_NAME | sed -r 's/(.*)-(.*)\.(.*\..*)$/\2/'` +VERSION=`validate_parameter "$VERSION" "VERSION" $STR_MOUNT` || mkbuild_error $ERROR_CONSTRUCTION "VERSION" + +# Construction source name string +CONST_STRING="`validate_parameter "$CONST_STRING" "SOURCE NAME CONSTRUCTION STRING" "\\\$SRC_NAME-\\\$VERSION.tar.$EXTENSION"`" + +# Build Source Name +[ -z $SOURCE_NAME ] && SOURCE_NAME=`eval "echo $CONST_STRING"` + +# Decompressor program and test flag +DECOMPRESSOR=`validate_parameter "$DECOMPRESSOR" "DECOMPRESSOR" ""` || decompress_find + +DECOMPRESSOR_TEST_FLAG=`validate_parameter "$DECOMPRESSOR_TEST_FLAG" "DECOMPRESSOR TEST FLAG" ""` || mkbuild_error $ERROR_CONSTRUCTION "DECOMPRESSOR TEST FLAG" + +# Documentations list +DOCFILES=`validate_parameter "$DOCFILES" "DOCUMENTATION FILES" "NEWS TODO README AUTHORS INSTALL ChangeLog MAINTAINERS COPYING readme.*"` + +# ./configure option +OPTIONS=`validate_parameter "$OPTIONS" "OTHER CONFIGURE ARGS" ""` + +# PREFIX +PREFIX=`validate_parameter "$PREFIX" "PREFIX" "/usr"` + +# Number of jobs +NUMJOBS=`validate_parameter "$NUMJOBS" "NUMBER OF JOBS" ""` + +# Make slack-required file. +SLACK_REQUIRED=`validate_parameter "$SLACK_REQUIRED" "SLACK REQUIRED" ""` + +# SlackBuild model +MODEL=`validate_parameter "$MODEL" "SLACKBUILD MODEL" "generic.mkSlackBuild"` + +# +# Start build SlackBuild +SLACKBUILD=${PKG_NAME}.SlackBuild +SLACKBUILD_TEMP=$SLACKBUILD.tmp +cp $MODEL_DIR/$MODEL $SLACKBUILD_TEMP + +# Change Strings from model +start_build $SLACKBUILD_TEMP + +# On/Off sections +activate_sections + +# Change sections +section_edit + +# Remove off sections +build_slackbuild + +# Make slack-required file +make_slack_required + +if [ -e slack-required ]; then + DEPENDENCY_LIST="`cat slack-required | awk '{print $1}' | grep '^[a-z]' | tr '\012' ' '`" + edit_file "REQUIRES" "$DEPENDENCY_LIST" $SLACKBUILD +else + edit_file "REQUIRES" "Null" $SLACKBUILD +fi + +# Others changes +change_others_fields + +# Clear temporary files +clear_files + +[ $COMMIT -eq 1 ] && commit_slackbuild + diff --git a/tags/0.5/src/mkjail b/tags/0.5/src/mkjail new file mode 100755 index 0000000..f6c935c --- /dev/null +++ b/tags/0.5/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/tags/0.5/src/rebuildpkg b/tags/0.5/src/rebuildpkg new file mode 100755 index 0000000..6d3d10c --- /dev/null +++ b/tags/0.5/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/tags/0.5/src/repos b/tags/0.5/src/repos new file mode 100755 index 0000000..e4a17ee --- /dev/null +++ b/tags/0.5/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/tags/0.5/src/simplaret b/tags/0.5/src/simplaret new file mode 100755 index 0000000..c8cc2f7 --- /dev/null +++ b/tags/0.5/src/simplaret @@ -0,0 +1,1131 @@ +#!/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