diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2017-10-07 19:32:06 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2017-10-07 19:32:06 -0300 |
commit | 0d6bcb2b7d08e3a41481372c1ae0d11868d88b1b (patch) | |
tree | d4429ce3a62e9cb5d095ad567b5f821d99a7b9f5 /src/rebuildpkg | |
parent | 5bfb15bdbedbc7273a283d611c84ed1cf401011b (diff) | |
download | simplepkg-0d6bcb2b7d08e3a41481372c1ae0d11868d88b1b.tar.gz simplepkg-0d6bcb2b7d08e3a41481372c1ae0d11868d88b1b.tar.bz2 |
New repo layout with git migration
Diffstat (limited to 'src/rebuildpkg')
-rwxr-xr-x | src/rebuildpkg | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/src/rebuildpkg b/src/rebuildpkg new file mode 100755 index 0000000..65315ad --- /dev/null +++ b/src/rebuildpkg @@ -0,0 +1,86 @@ +#!/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" + +function usage { + echo "usage: ROOT=/otherroot `basename $0` <package-name>" +} + +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.$MKBUILD_COMPRESS +mv $package_name.$MKBUILD_COMPRESS $TMP/ +echo "done: package rebuilt and stored at $TMP/$package_name.$MKBUILD_COMPRESS" |