From b6387b954f7c35d0d51978aac24ca6bd6a5308fc Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 30 May 2007 11:04:49 -0400 Subject: scripts: do autoconf path replacement right This should finally get the path replacement in our scripts right. This is the way the autoconf package itself does it and should not need much further tweaking. Threw in a few trailing whitespace corrections from the scripts as well. Signed-off-by: Dan McGee --- scripts/Makefile.am | 47 +++++++++++++++++++++++++++++++++++++++++++++- scripts/abs.in | 19 ++++++++++--------- scripts/gensync.in | 23 ++++++++++++----------- scripts/makepkg.in | 21 +++++++++++---------- scripts/makeworld.in | 13 +++++++------ scripts/pacman-optimize.in | 15 ++++++++------- scripts/rankmirrors.in | 3 ++- scripts/repo-add.in | 21 +++++++++++---------- scripts/repo-remove.in | 17 +++++++++-------- scripts/updatesync.in | 17 +++++++++-------- 10 files changed, 125 insertions(+), 71 deletions(-) (limited to 'scripts') diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 45f0957d..1ebd785f 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -12,4 +12,49 @@ bin_SCRIPTS = \ repo-remove \ updatesync -abs gensync makepkg makeworld pacman-optimize rankmirrors repo-add repo-remove re-pacman updatesync: +EXTRA_DIST = \ + abs.in \ + gensync.in \ + makepkg.in \ + makeworld.in \ + pacman-optimize.in \ + rankmirrors.in \ + repo-add.in \ + repo-remove.in \ + updatesync.in + +# Files that should be removed, but which Automake does not know. +MOSTLYCLEANFILES = $(bin_SCRIPTS) *.tmp + +#### Taken from the autoconf scripts Makefile.am #### +edit = sed \ + -e 's|@localedir[@]|$(localedir)|g' \ + -e 's|@sysconfdir[@]|$(sysconfdir)|g' \ + -e 's|@prefix[@]|$(prefix)|g' \ + -e 's|@PACKAGE_VERSION[@]|$(PACKAGE_VERSION)|g' \ + -e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \ + -e 's|@ROOTDIR[@]|$(ROOTDIR)|g' \ + -e 's|@DBPATH[@]|$(DBPATH)|g' \ + -e 's|@LOCKFILE[@]|$(LOCKFILE)|g' \ + -e 's|@configure_input[@]|Generated from $@.in; do not edit by hand.|g' + +## All the scripts depend on Makefile so that they are rebuilt when the +## prefix etc. changes. Use chmod -w to prevent people from editing the +## wrong file by accident. +$(bin_SCRIPTS): Makefile + rm -f $@ $@.tmp + $(edit) `test -f ./$@.in || echo $(srcdir)/`$@.in >$@.tmp + chmod +x $@.tmp + chmod a-w $@.tmp + mv $@.tmp $@ + +abs: $(srcdir)/abs.in +gensync: $(srcdir)/gensync.in +makepkg: $(srcdir)/makepkg.in +makeworld: $(srcdir)/makeworld.in +pacman-optimize: $(srcdir)/pacman-optimize.in +rankmirrors: $(srcdir)/rankmirrors.in +repo-add: $(srcdir)/repo-add.in +repo-remove: $(srcdir)/repo-remove.in +re-pacman: $(srcdir)/re-pacman.in +updatesync: $(srcdir)/updatesync.in diff --git a/scripts/abs.in b/scripts/abs.in index b086aea6..42ad56af 100644 --- a/scripts/abs.in +++ b/scripts/abs.in @@ -1,27 +1,28 @@ #!/bin/bash -# -# abs -# +# +# abs - download a PKGBUILD tree from a CVS repository +# @configure_input@ +# # Copyright (c) 2002-2007 by Judd Vinet -# +# # 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, +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. # myver='@PACKAGE_VERSION@' -CONFDIR="@SYSCONFDIR@/abs" +CONFDIR="@sysconfdir@/abs" CONNMODE="m" [ -f "$CONFDIR/abs.conf" ] && source "$CONFDIR/abs.conf" @@ -65,7 +66,7 @@ update() { cd "$ABSROOT" fi done -} +} if [ "$1" = "-h" -o "$1" = "--help" ]; then usage diff --git a/scripts/gensync.in b/scripts/gensync.in index 0639f89c..977dff06 100644 --- a/scripts/gensync.in +++ b/scripts/gensync.in @@ -1,22 +1,23 @@ #!/bin/bash -# +# # gensync -# +# @configure_input@ +# # Copyright (c) 2002-2007 by Judd Vinet -# +# # 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, +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. # @@ -37,9 +38,9 @@ usage() { echo echo "note: The name is important. It must be of the form" echo " {treename}.db.tar.gz where {treename} is the name of the custom" - echo " package repository you configured in @SYSCONFDIR@/pacman.conf. The" + echo " package repository you configured in @sysconfdir@/pacman.conf. The" echo " generated database must reside in the same directory as your" - echo " custom packages (also configured in @SYSCONFDIR@/pacman.conf)" + echo " custom packages (also configured in @sysconfdir@/pacman.conf)" echo echo "example: gensync /var/abs/local /home/mypkgs/custom.db.tar.gz" echo @@ -94,10 +95,10 @@ if [ $# -lt 2 ]; then fi # source system and user makepkg.conf -if [ -r @SYSCONFDIR@/makepkg.conf ]; then - source @SYSCONFDIR@/makepkg.conf +if [ -r @sysconfdir@/makepkg.conf ]; then + source @sysconfdir@/makepkg.conf else - echo "ERROR: @SYSCONFDIR@/makepkg.conf not found. Can not continue." >&2 + echo "ERROR: @sysconfdir@/makepkg.conf not found. Can not continue." >&2 exit 1 # $E_CONFIG_ERROR # TODO: error codes fi diff --git a/scripts/makepkg.in b/scripts/makepkg.in index 278050d7..da852b33 100644 --- a/scripts/makepkg.in +++ b/scripts/makepkg.in @@ -1,8 +1,9 @@ #!/bin/bash # # makepkg - make packages compatable for use with pacman +# @configure_input@ # -# Copyright (c) 2002-2006 by Judd Vinet +# Copyright (c) 2002-2007 by Judd Vinet # Copyright (c) 2005 by Aurelien Foret # Copyright (c) 2006 by Miklos Vajna # Copyright (c) 2005 by Christian Hamar @@ -21,7 +22,7 @@ # # 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, +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. # @@ -30,7 +31,7 @@ source gettext.sh TEXTDOMAIN=makepkg export TEXTDOMAIN -TEXTDOMAINDIR='@LOCALEDIR@' +TEXTDOMAINDIR='@localedir@' export TEXTDOMAINDIR myver='@PACKAGE_VERSION@' @@ -38,14 +39,14 @@ startdir=$(pwd) # Only use ABSROOT if we haven't been passed a SRCROOT on the command line. if [ -z "$SRCROOT" ]; then - if [ -r @SYSCONFDIR@/abs/abs.conf ]; then - source @SYSCONFDIR@/abs/abs.conf + if [ -r @sysconfdir@/abs/abs.conf ]; then + source @sysconfdir@/abs/abs.conf fi if [ -r ~/.abs.conf ]; then source ~/.abs.conf fi SRCROOT=$ABSROOT -fi +fi # Options ASROOT=0 @@ -649,8 +650,8 @@ _PKGDEST=${PKGDEST} _SRCDEST=${SRCDEST} # Source makepkg.conf; fail if it is not found -if [ -r @SYSCONFDIR@/makepkg.conf ]; then - source @SYSCONFDIR@/makepkg.conf +if [ -r @sysconfdir@/makepkg.conf ]; then + source @sysconfdir@/makepkg.conf else error "$(gettext "/etc/makepkg.conf not found. cannot continue")" exit 1 # $E_CONFIG_ERROR # TODO: error codes @@ -1024,7 +1025,7 @@ else fi done #Validate integrity checks - else + else integrity_sums=($(eval echo \${${integrity_name}s[@]})) if [ ${#integrity_sums[@]} -eq ${#source[@]} ]; then @@ -1103,7 +1104,7 @@ else fi fi done - + if [ "$EUID" = "0" ]; then # chown all source files to root.root chown -R root.root "$startdir/src" diff --git a/scripts/makeworld.in b/scripts/makeworld.in index ca5b7261..e752b119 100644 --- a/scripts/makeworld.in +++ b/scripts/makeworld.in @@ -1,22 +1,23 @@ #!/bin/bash -# +# # makeworld -# +# @configure_input@ +# # Copyright (c) 2002-2007 by Judd Vinet -# +# # 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, +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. # diff --git a/scripts/pacman-optimize.in b/scripts/pacman-optimize.in index ca6378f2..0224b7c3 100644 --- a/scripts/pacman-optimize.in +++ b/scripts/pacman-optimize.in @@ -1,22 +1,23 @@ #!/bin/bash -# +# # pacman-optimize -# +# @configure_input@ +# # Copyright (c) 2002-2007 by Judd Vinet -# +# # 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, +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. # @@ -39,7 +40,7 @@ error() { usage() { echo "pacman-optimize (pacman) $myver" echo "usage: $0 [pacman_db_root]" - echo + echo echo "pacman-optimize is a little hack that should improve the performance" echo "of pacman when reading/writing to its filesystem-based database." echo diff --git a/scripts/rankmirrors.in b/scripts/rankmirrors.in index da0811c0..2b284efe 100644 --- a/scripts/rankmirrors.in +++ b/scripts/rankmirrors.in @@ -1,6 +1,7 @@ #! /usr/bin/python # -# rankmirrors : read a list of mirrors from a file and rank them by speed +# rankmirrors - read a list of mirrors from a file and rank them by speed +# @configure_input@ # # Original Idea copyright (c) 2006 R.G. # Modified 2006 by Dan McGee diff --git a/scripts/repo-add.in b/scripts/repo-add.in index fdcc43a9..4dcde346 100644 --- a/scripts/repo-add.in +++ b/scripts/repo-add.in @@ -1,22 +1,23 @@ #!/bin/bash # -# repo-add : add a package to a given repo database file -# +# repo-add - add a package to a given repo database file +# @configure_input@ +# # Copyright (c) 2006 Aaron Griffin -# +# # 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, +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. myver='@PACKAGE_VERSION@' @@ -99,7 +100,7 @@ db_write_entry() builddate="" packager="" csize="" - size="" + size="" _groups="" _depends="" _backups="" @@ -138,7 +139,7 @@ db_write_entry() if [ -z "$pkgname" -o -z "$pkgver" ]; then echo " error: invalid package file" return 1 - fi + fi # remove any other package in the DB with same name for existing in *; do @@ -237,8 +238,8 @@ if [ $# -lt 2 ]; then fi # source system and user makepkg.conf -if [ -r @SYSCONFDIR@/makepkg.conf ]; then - source @SYSCONFDIR@/makepkg.conf +if [ -r @sysconfdir@/makepkg.conf ]; then + source @sysconfdir@/makepkg.conf else echo "ERROR: /etc/makepkg.conf not found. Can not continue." >&2 exit 1 # $E_CONFIG_ERROR # TODO: error codes diff --git a/scripts/repo-remove.in b/scripts/repo-remove.in index 0bb37075..a0b4a70a 100644 --- a/scripts/repo-remove.in +++ b/scripts/repo-remove.in @@ -1,22 +1,23 @@ #!/bin/bash # -# repo-remove : remove a package entry from a given repo database file -# +# repo-remove - remove a package entry from a given repo database file +# @configure_input@ +# # Copyright (c) 2007 Dan McGee -# +# # 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, +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. myver='@PACKAGE_VERSION@' @@ -93,8 +94,8 @@ if [ $# -lt 2 ]; then fi # source system and user makepkg.conf -if [ -r @SYSCONFDIR@/makepkg.conf ]; then - source @SYSCONFDIR@/makepkg.conf +if [ -r @sysconfdir@/makepkg.conf ]; then + source @sysconfdir@/makepkg.conf else echo "ERROR: /etc/makepkg.conf not found. Can not continue." >&2 exit 1 # $E_CONFIG_ERROR # TODO: error codes diff --git a/scripts/updatesync.in b/scripts/updatesync.in index 6a59edc5..c0888c74 100644 --- a/scripts/updatesync.in +++ b/scripts/updatesync.in @@ -1,23 +1,24 @@ #!/bin/bash -# +# # updatesync -# +# @configure_input@ +# # Copyright (c) 2004 by Jason Chu # Derived from gensync (c) 2002-2006 Judd Vinet -# +# # 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, +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. # @@ -96,8 +97,8 @@ if [ $# -lt 3 ]; then fi # source system and user makepkg.conf -if [ -r @SYSCONFDIR@/makepkg.conf ]; then - source @SYSCONFDIR@/makepkg.conf +if [ -r @sysconfdir@/makepkg.conf ]; then + source @sysconfdir@/makepkg.conf else echo "ERROR: /etc/makepkg.conf not found. Can not continue." >&2 exit 1 # $E_CONFIG_ERROR # TODO: error codes -- cgit v1.2.3