From 4c3842d42ba448fde829fe3f7c058999daf5cbe2 Mon Sep 17 00:00:00 2001 From: Judd Vinet Date: Fri, 12 Apr 2002 19:34:34 +0000 Subject: Imported from pacman-1.22.tar.gz --- ChangeLog | 4 +++ Makefile | 2 +- README | 18 ++++++------- TODO | 8 ------ makepkg | 50 ++++++++++++++++++++++++++++++----- makeworld | 2 +- pacman.h | 2 +- pacsync | 85 ++++++++++++++++++++++++++++++++++++++---------------------- pacsync.8.in | 2 +- 9 files changed, 115 insertions(+), 58 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2255850d..92d3124f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ VERSION DESCRIPTION ------------------------------------------------------------------ +1.22 - Some manpage typo fixes + - Added --root switch to pacsync + - Added --help and ability to specify a PKGBUILD to makepkg + - Switched default downloader to snarf 1.21 - Added better backup control -- upgrade/add and remove do different things with the -n switch 1.2 - Added wildcard handling diff --git a/Makefile b/Makefile index bde027dd..34522678 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ BINDIR = /usr/bin MANDIR = /usr/man ETCDIR = /etc -VERSION = 1.21 +VERSION = 1.22 LIBTAR_VERSION = 1.2.4 CXX = gcc diff --git a/README b/README index b39ecedb..296fbfa1 100644 --- a/README +++ b/README @@ -13,15 +13,15 @@ DESCRIPTION: upgrade packages in the system, and it will allow you to query the package database for installed packages, files and owners. - Although the package manager itself is quite simple, the pacman tarball - also comes with scripts that help automate building and installing - packages. These are used extensively in the Arch Build System (ABS), - used in Arch Linux . See ABS.txt for more - information. - - As of version 1.2, pacsync is included as well. This performs an apt-like - function, keeping your system's packages in sync with the packages on - a remote server. + Although the package manager itself is quite simple, the pacman tarball + also comes with scripts that help automate building and installing + packages. These are used extensively in the Arch Build System (ABS), + used in Arch Linux . See ABS.txt for more + information. + + As of version 1.2, pacsync is included as well. This performs an + apt-like function, keeping your system's packages in sync with the + packages on a remote server. Plans exist for dependency checking as I approach version 2.0. See TODO for more info. diff --git a/TODO b/TODO index 72b739d7..86870b08 100644 --- a/TODO +++ b/TODO @@ -1,19 +1,11 @@ -Some of these items kinda belong on more of a wishlist than a todo list. ;) - -> make sure program consistently returns a non-zero return code on - error, so scripts can rely on it - add a [sibling] option to .PKGINFO -- used when only one of the siblings can be installed at a time (eg, bsdinit,sysvinit) -> handle wildcards on the command line - sort packages by package name in pacman.db ? manage conditional file installs (ie, 'info' pages) - maybe add a 'confirm every action' option for doing paranoid installs - add a consistency check operation -- change char[xxx] to char[PATH_MAX] - add file locking to db - add a --dbpath option + dependency checking -+ fetch files via ftp - - need to manage foreign package lists like apt - upgrade currently does a double db backup; not really desirable diff --git a/makepkg b/makepkg index 17965d92..40b0dbe2 100755 --- a/makepkg +++ b/makepkg @@ -1,7 +1,6 @@ #!/bin/bash -me=`basename $0` -myver='1.21' +myver='1.22' startdir=`pwd` [ -f /etc/makepkg.conf ] && . /etc/makepkg.conf @@ -10,12 +9,34 @@ strip_url() { echo $1 | sed 's|^.*://.*/||g' } -if [ ! -f $startdir/PKGBUILD ]; then - echo "error: $startdir/PKGBUILD does not exist!" >&2 +if [ "$1" = "--help" -o "$1" = "-h" ]; then + shift + echo "makepkg version $myver" + echo "usage: $0 [build_script]" + echo + echo " if build_script is not specified, makepkg will look for a PKGBUILD" + echo " file in the current directory." + echo exit 1 fi -. $startdir/PKGBUILD +BUILDSCRIPT="`pwd`/PKGBUILD" +if [ "$1" != "" ]; then + BUILDSCRIPT=$1 +fi + +if [ ! -f $BUILDSCRIPT ]; then + echo "==> ERROR: $BUILDSCRIPT does not exist!" >&2 + exit 1 +fi + +. $BUILDSCRIPT + +# check for no-no's +if [ `echo $pkgver | grep '-'` ]; then + echo "==> ERROR: pkgver is not allowed to contain hyphens." >&2 + exit 1 +fi echo d=`date` @@ -34,8 +55,25 @@ for netfile in ${source[@]}; do echo "==> Using local copy of $file" >&2 cp /var/cache/pacman/src/$file . else + proto=`echo $netfile | sed 's|://.*||'` + if [ "$proto" != "ftp" -a "$proto" != "http" ]; then + echo "==> ERROR: $netfile was not found in the build directory and is not a proper URL." + echo "==> Aborting..." >&2 + exit 1 + fi + # check for a download utility + if [ -x /usr/bin/snarf ]; then + ftpagent="/usr/bin/snarf" + elif [ -x /usr/bin/lftpget -a "$proto" = "ftp" ]; then + ftpagent="/usr/bin/lftpget" + elif [ -x /usr/bin/wget ]; then + ftpagent="/usr/bin/wget --passive-ftp --tries=3 --waitretry=3" + else + echo "==> ERROR: You need an ftp client installed (snarf/lftp/wget) in /usr/bin" >&2 + exit 1 + fi echo "==> Downloading $file" >&2 - wget --passive-ftp --no-directories --tries=3 --waitretry=3 $netfile 2>&1 + $ftpagent $netfile 2>&1 if [ ! -f $file ]; then echo "==> ERROR: Failed to download $file" >&2 echo "==> Aborting..." >&2 diff --git a/makeworld b/makeworld index a7b8a89b..ff629a54 100755 --- a/makeworld +++ b/makeworld @@ -1,7 +1,7 @@ #!/bin/bash toplevel=`pwd` -version="1.21" +version="1.22" if [ $# -lt 2 ]; then echo "makepkg version $version" diff --git a/pacman.h b/pacman.h index d86fd524..be30a65c 100644 --- a/pacman.h +++ b/pacman.h @@ -21,7 +21,7 @@ #ifndef PACMAN_H #define PACMAN_H -#define VERSION "1.21" +#define VERSION "1.22" #define PKGEXT ".tar.gz" #define PKGDB "/var/lib/pacman/pacman.db" diff --git a/pacsync b/pacsync index 2603299a..45337916 100755 --- a/pacsync +++ b/pacsync @@ -1,10 +1,11 @@ #!/bin/bash -version="1.21" +version="1.22" tanpath="/var/lib/pacman" tandb="pacsync.db" errors=0 upgrade=0 +INSTALL_ROOT="/" message() { echo "==> $1" >&2 @@ -12,7 +13,7 @@ message() { usage() { echo "pacsync version $version" - echo "usage: $0 [package]" + echo "usage: $0 [--root ] [package]" echo "" echo "operations:" echo " sync Download a fresh package list from the server" @@ -25,7 +26,7 @@ usage() { } checkdb() { - if [ ! -f $tanpath/$tandb ]; then + if [ ! -f $INSTALL_ROOT/$tanpath/$tandb ]; then message "missing package list. (use \"sync\" first)" exit 1 fi @@ -39,9 +40,9 @@ download() { cl="$cl $SYNC_SERVER/$file" done message "Downloading $targ" - $ftpagent $cl + $ftpagent $cl 2>&1 if [ $? -gt 0 ]; then - message "ERROR: could not download $targ" + message "error: could not download $targ" return 1 fi return 0 @@ -53,8 +54,8 @@ dosync() { if [ $? -gt 0 ]; then exit 1 fi - rm -f $tanpath/$tandb - mv /tmp/$tandb $tanpath/$tandb + rm -f $INSTALL_ROOT/$tanpath/$tandb + mv /tmp/$tandb $INSTALL_ROOT/$tanpath/$tandb message "Done." } @@ -62,19 +63,19 @@ doinstall() { pkg2dl= pkg2inst= for pkgname in $*; do - line=`egrep "^[a-z]+/$pkgname-[a-zA-Z0-9\.]+-[0-9]+\.pkg\.tar\.gz$" $tanpath/$tandb` + line=`egrep "^[a-z]+/$pkgname-[a-zA-Z0-9\.]+-[0-9]+\.pkg\.tar\.gz$" $INSTALL_ROOT/$tanpath/$tandb` if [ $? -gt 0 ]; then message "package $pkgname not found" exit 1 fi - pacman=`pacman -Q $pkgname 2>/dev/null` + pacman=`pacman -Q -r $INSTALL_ROOT $pkgname 2>/dev/null` if [ $? -eq 0 ]; then message "$pkgname is already installed (try using \"upgrade\")" exit 1 fi filename=`echo $line | sed 's|^[a-z]*/||g'` pkg2inst="$pkg2inst $filename" - if [ ! -f /var/cache/pacman/pkg/$filename ]; then + if [ ! -f $INSTALL_ROOT/var/cache/pacman/pkg/$filename ]; then pkg2dl="$pkg2dl $filename" fi done @@ -85,19 +86,19 @@ doinstall() { if [ $? -gt 0 ]; then exit 1 fi - if [ `pwd` != "/var/cache/pacman/pkg" ]; then + if [ `pwd` != "$INSTALL_ROOT/var/cache/pacman/pkg" ]; then # move downloaded files into cache - mkdir -p /var/cache/pacman/pkg - mv $pkg2dl /var/cache/pacman/pkg/ + mkdir -p $INSTALL_ROOT/var/cache/pacman/pkg + mv $pkg2dl $INSTALL_ROOT/var/cache/pacman/pkg/ fi fi # install packages message "Installing packages" - cd /var/cache/pacman/pkg - pacman -A $pkg2inst + cd $INSTALL_ROOT/var/cache/pacman/pkg + pacman -A -r $INSTALL_ROOT $pkg2inst if [ $? -gt 0 ]; then - echo "ERROR: some packages failed to install" + message "error: some packages failed to install" exit 1 fi @@ -109,12 +110,12 @@ doupgrade() { pkg2dl= pkg2up= for pkgname in $*; do - line=`egrep "^[a-z]+/$pkgname-[a-zA-Z0-9\.]+-[0-9]+\.pkg\.tar\.gz$" $tanpath/$tandb` + line=`egrep "^[a-z]+/$pkgname-[a-zA-Z0-9\.]+-[0-9]+\.pkg\.tar\.gz$" $INSTALL_ROOT/$tanpath/$tandb` if [ $? -gt 0 ]; then message "package $pkgname not found" exit 1 fi - pacman=`pacman -Q $pkgname 2>/dev/null` + pacman=`pacman -Q -r $INSTALL_ROOT $pkgname 2>/dev/null` if [ $? -gt 0 ]; then message "$pkgname is not installed (use \"install\" first)" exit 1 @@ -128,7 +129,7 @@ doupgrade() { message "$pkgname is already up to date (skipping)" else pkg2up="$pkg2up $filename" - if [ ! -f /var/cache/pacman/pkg/$filename ]; then + if [ ! -f $INSTALL_ROOT/var/cache/pacman/pkg/$filename ]; then pkg2dl="$pkg2dl $filename" fi fi @@ -140,20 +141,20 @@ doupgrade() { if [ $? -gt 0 ]; then exit 1 fi - if [ `pwd` != "/var/cache/pacman/pkg" ]; then + if [ `pwd` != "$INSTALL_ROOT/var/cache/pacman/pkg" ]; then # move downloaded files into cache - mkdir -p /var/cache/pacman/pkg - mv $pkg2dl /var/cache/pacman/pkg/ + mkdir -p $INSTALL_ROOT/var/cache/pacman/pkg + mv $pkg2dl $INSTALL_ROOT/var/cache/pacman/pkg/ fi fi # install packages if [ "$pkg2up" != "" ]; then message "Upgrading packages" - cd /var/cache/pacman/pkg - pacman -U $pkg2up + cd $INSTALL_ROOT/var/cache/pacman/pkg + pacman -U -r $INSTALL_ROOT $pkg2up if [ $? -gt 0 ]; then - echo "ERROR: some packages failed to upgrade" + message "error: some packages failed to upgrade" exit 1 fi message "Done" @@ -164,10 +165,11 @@ doupgrade() { doreport() { headers=0 + newkernel=0 pkg2up= - for pkgfile in `cat $tanpath/$tandb | sed "s|^[a-z]*/||g"`; do + for pkgfile in `cat $INTALL_ROOT/$tanpath/$tandb | sed "s|^[a-z]*/||g"`; do pkgname=`echo $pkgfile | sed 's|-[a-zA-Z0-9\.]*-[0-9]*\.pkg\.tar\.gz||g'` - pacman=`pacman -Q $pkgname 2>/dev/null` + pacman=`pacman -Q -r $INSTALL_ROOT $pkgname 2>/dev/null` if [ $? -gt 0 ]; then # skip this one, it's not installed continue @@ -180,6 +182,10 @@ doreport() { # this package is up to date continue else + if [ `echo "$locfile" | egrep '^kernel-[a-zA-Z0-9\.]+-[0-9]+$'` ]; then + newkernel=1 + continue + fi if [ "$headers" = "0" ]; then echo "+--------------------------------------+--------------------------------------+" echo "| LOCAL | REMOTE |" @@ -198,6 +204,15 @@ doreport() { echo "+--------------------------------------+--------------------------------------+" fi + if [ "$newkernel" = "1" ]; then + echo + echo "NOTICE: A new kernel is available for upgrade, but this process will not" + echo " upgrade it for you. If you wish to upgrade, you must explicitly" + echo " request it by running 'pacsync upgrade kernel'. If you choose to" + echo " upgrade, make sure you re-run 'lilo' as well!" + echo + fi + # do we upgrade? if [ "$upgrade" = "1" -a "$pkg2up" != "" ]; then echo "" @@ -217,21 +232,29 @@ if [ $# -lt 1 ]; then exit 0 fi +if [ "$1" = "--root" ]; then + shift + INSTALL_ROOT=$1 + shift +fi + if [ -f /etc/pacsync.conf ]; then . /etc/pacsync.conf else - message "error: missing configuration file!" + message "error: Missing /etc/pacsync.conf configuration file!" exit 1 fi proto=`echo $SYNC_SERVER | sed 's|://.*||'` # check for a download utility -if [ -x /usr/bin/lftpget -a "$proto" = "ftp" ]; then +if [ -x /usr/bin/snarf ]; then + ftpagent="/usr/bin/snarf" +elif [ -x /usr/bin/lftpget -a "$proto" = "ftp" ]; then ftpagent="/usr/bin/lftpget" elif [ -x /usr/bin/wget ]; then ftpagent="/usr/bin/wget --passive-ftp --tries=3 --waitretry=3" else - message "error: you need an ftp client installed (lftp or wget) in /usr/bin" + message "error: you need an ftp client installed (snarf/lftp/wget) in /usr/bin" exit 1 fi @@ -272,7 +295,7 @@ case $op in ;; clean) message "Removing packages from cache" - rm -f /var/cache/pacman/pkg/* + rm -f $INSTALL_ROOT/var/cache/pacman/pkg/* ;; *) message "error: invalid operation" diff --git a/pacsync.8.in b/pacsync.8.in index a1316637..5c8945de 100644 --- a/pacsync.8.in +++ b/pacsync.8.in @@ -2,7 +2,7 @@ .SH NAME pacsync \- package update frontend for pacman .SH SYNOPSIS -\fBpacsync [package] [package] ...\fP +\fBpacsync [--root ] [package] [package] ...\fP .SH DESCRIPTION \fBpacsync\fP is a \fIpackage update\fP frontend for the \fIpacman\fP package manager. It keeps track of the versions -- cgit v1.2.3-24-g4f1b