diff options
Diffstat (limited to 'makepkg')
-rwxr-xr-x | makepkg | 56 |
1 files changed, 35 insertions, 21 deletions
@@ -1,7 +1,7 @@ #!/bin/bash me=`basename $0` -myver='1.0' +myver='1.1' startdir=`pwd` [ -f /etc/makepkg.conf ] && . /etc/makepkg.conf @@ -11,30 +11,34 @@ strip_url() { } if [ ! -f $startdir/PKGBUILD ]; then - echo "error: $startdir/PKGBUILD does not exist!" - exit + echo "error: $startdir/PKGBUILD does not exist!" >&2 + exit 1 fi . $startdir/PKGBUILD +echo +d=`date` +echo "==> Building package $pkgname ($d)" >&2 + # extract source -echo "==> Acquiring/Extracting Sources..." +echo "==> Acquiring/Extracting Sources..." >&2 mkdir -p src pkg cd $startdir/src for netfile in ${source[@]}; do file=`strip_url $netfile` if [ -f ../$file ]; then - echo "==> Found $file in build dir" + echo "==> Found $file in build dir" >&2 cp ../$file . elif [ -f /var/cache/pkg/$file ]; then - echo "==> Using local copy of $file" + echo "==> Using local copy of $file" >&2 cp /var/cache/pkg/$file . else - echo "==> Downloading $file" - wget --passive-ftp --no-directories --tries=3 --waitretry=3 $netfile + echo "==> Downloading $file" >&2 + wget --passive-ftp --no-directories --tries=3 --waitretry=3 $netfile 2>&1 if [ ! -f $file ]; then - echo "==> ERROR: Failed to download $file" - echo "==> Aborting..." + echo "==> ERROR: Failed to download $file" >&2 + echo "==> Aborting..." >&2 exit 1 fi mkdir -p /var/cache/pkg && cp $file /var/cache/pkg @@ -49,40 +53,50 @@ for netfile in ${source[@]}; do *) cmd="cp ../$file ." ;; esac - echo "$cmd" + echo "==> $cmd" >&2 $cmd done # build -echo "==> Building Package..." -build +echo "==> Building Package..." >&2 +build 2>&1 +if [ $? -gt 0 ]; then + echo "==> Build Failed. Aborting..." >&2 + exit 2 +fi # write the .PKGINFO file -echo "==> Generating .PKGINFO file..." +echo "==> Generating .PKGINFO file..." >&2 cd $startdir/pkg echo "# Generated by makepkg $myver" >.PKGINFO echo -n "# " >>.PKGINFO date >>.PKGINFO echo "pkgname = $pkgname" >>.PKGINFO echo "pkgver = $pkgver-$pkgrel" >>.PKGINFO +for bakfile in "${backup[@]}"; do + echo "backup = $bakfile" >>.PKGINFO +done -# remove info files +# remove info/doc files cd $startdir rm -rf pkg/usr/info pkg/usr/share/info +rm -rf pkg/usr/doc pkg/usr/share/doc # strip binaries cd $startdir -echo "==> Stripping debugging symbols from libraries..." +echo "==> Stripping debugging symbols from libraries..." >&2 find pkg/{,usr,usr/local}/lib -type f \ - -exec /usr/bin/strip --strip-debug '{}' ';' -echo "==> Stripping symbols from binaries..." + -exec /usr/bin/strip --strip-debug '{}' ';' 2>&1 +echo "==> Stripping symbols from binaries..." >&2 find pkg/{,usr,usr/local}/{bin,sbin} -type f \ - -exec /usr/bin/strip '{}' ';' + -exec /usr/bin/strip '{}' ';' 2>&1 # tar it up -echo "==> Compressing package..." +echo "==> Compressing package..." >&2 cd $startdir/pkg tar czvf $startdir/$pkgname-$pkgver-$pkgrel.pkg.tar.gz .PKGINFO * >../filelist cd $startdir -echo "==> Finished"; +d=`date` +echo "==> Finished ($d)" >&2 +exit 0 |