Marcel Telka
2024-04-05 26ab531a0abac615aaedf17622ee2aa5e19c5114
tools/ips2tgz
@@ -20,10 +20,11 @@
set -e
PREFIX=$1; shift
ARCHIVE=$1; shift
SRCREPO=$1; shift
PKGLIST="$@"
[ -f $PREFIX.tar.gz ] && exit 0
[ -f $ARCHIVE ] && exit 0
if [ ! -d $PREFIX.pkgrecv ]; then
    mkdir $PREFIX.pkgrecv
@@ -79,21 +80,21 @@
    if [ -z $variant ]; then
        [ -f $PREFIX/i386/$path ] && rm -f $PREFIX/i386/$path
        [ ! -d `dirname $PREFIX/i386/$path` ] || mkdir -p `dirname $PREFIX/i386/$path`
        mkdir -p `dirname $PREFIX/i386/$path`
        cp `ls $PREFIX.pkgrecv/*/*/$hash|head -1` $PREFIX/i386/$path
        chmod $mode $PREFIX/i386/$path
        [ -f $PREFIX/sparc/$path ] && rm -f $PREFIX/sparc/$path
        [ ! -d `dirname $PREFIX/i386/$path` ] || mkdir -p `dirname $PREFIX/i386/$path`
        mkdir -p `dirname $PREFIX/sparc/$path`
        cp `ls $PREFIX.pkgrecv/*/*/$hash|head -1` $PREFIX/sparc/$path
        chmod $mode $PREFIX/sparc/$path
    elif [ $variant = i386 ]; then
        [ -f $PREFIX/i386/$path ] && rm -f $PREFIX/i386/$path
        [ ! -d `dirname $PREFIX/i386/$path` ] || mkdir -p `dirname $PREFIX/i386/$path`
        mkdir -p `dirname $PREFIX/i386/$path`
        cp `ls $PREFIX.pkgrecv/*/*/$hash|head -1` $PREFIX/i386/$path
        chmod $mode $PREFIX/i386/$path
    elif [ $variant = sparc ]; then
        [ -f $PREFIX/sparc/$path ] && rm -f $PREFIX/sparc/$path
        [ ! -d `dirname $PREFIX/i386/$path` ] || mkdir -p `dirname $PREFIX/i386/$path`
        mkdir -p `dirname $PREFIX/sparc/$path`
        cp `ls $PREFIX.pkgrecv/*/*/$hash|head -1` $PREFIX/sparc/$path
        chmod $mode $PREFIX/sparc/$path
    fi
@@ -121,18 +122,18 @@
    if [ -z $variant ]; then
        [ -f $PREFIX/i386/$path ] && rm -f $PREFIX/i386/$path
        [ ! -d `dirname $PREFIX/i386/$path` ] || mkdir -p `dirname $PREFIX/i386/$path`
        mkdir -p `dirname $PREFIX/i386/$path`
        ln `dirname $PREFIX/i386/$path`/$target $PREFIX/i386/$path
        [ -f $PREFIX/sparc/$path ] && rm -f $PREFIX/sparc/$path
        [ ! -d `dirname $PREFIX/i386/$path` ] || mkdir -p `dirname $PREFIX/i386/$path`
        mkdir -p `dirname $PREFIX/sparc/$path`
        ln `dirname $PREFIX/sparc/$path`/$target $PREFIX/sparc/$path
    elif [ $variant = i386 ]; then
        [ -f $PREFIX/i386/$path ] && rm -f $PREFIX/i386/$path
        [ ! -d `dirname $PREFIX/i386/$path` ] || mkdir -p `dirname $PREFIX/i386/$path`
        mkdir -p `dirname $PREFIX/i386/$path`
        ln `dirname $PREFIX/i386/$path`/$target $PREFIX/i386/$path
    elif [ $variant = sparc ]; then
        [ -f $PREFIX/sparc/$path ] && rm -f $PREFIX/sparc/$path
        [ ! -d `dirname $PREFIX/i386/$path` ] || mkdir -p `dirname $PREFIX/i386/$path`
        mkdir -p `dirname $PREFIX/sparc/$path`
        ln `dirname $PREFIX/sparc/$path`/$target $PREFIX/sparc/$path
    fi
@@ -159,18 +160,18 @@
    if [ -z $variant ]; then
        [ -h $PREFIX/i386/$path ] && rm -f $PREFIX/i386/$path
        [ ! -d `dirname $PREFIX/i386/$path` ] || mkdir -p `dirname $PREFIX/i386/$path`
        mkdir -p `dirname $PREFIX/i386/$path`
        ln -s $target $PREFIX/i386/$path
        [ -h $PREFIX/sparc/$path ] && rm -f $PREFIX/sparc/$path
        [ ! -d `dirname $PREFIX/i386/$path` ] || mkdir -p `dirname $PREFIX/i386/$path`
        mkdir -p `dirname $PREFIX/sparc/$path`
        ln -s $target $PREFIX/sparc/$path
    elif [ $variant = i386 ]; then
        [ -h $PREFIX/i386/$path ] && rm -f $PREFIX/i386/$path
        [ ! -d `dirname $PREFIX/i386/$path` ] || mkdir -p `dirname $PREFIX/i386/$path`
        mkdir -p `dirname $PREFIX/i386/$path`
        ln -s $target $PREFIX/i386/$path
    elif [ $variant = sparc ]; then
        [ -h $PREFIX/sparc/$path ] && rm -f $PREFIX/sparc/$path
        [ ! -d `dirname $PREFIX/i386/$path` ] || mkdir -p `dirname $PREFIX/i386/$path`
        mkdir -p `dirname $PREFIX/sparc/$path`
        ln -s $target $PREFIX/sparc/$path
    fi
@@ -195,25 +196,25 @@
for i in $PREFIX.pkgrecv/*/*/manifest.dir; do
    [ -f $i ] && . $i
    [ -f $i ] && sed -e 's/\([^ ]*\)/"\1"/g' < $i > $i-edited && . $i-edited
done
for i in $PREFIX.pkgrecv/*/*/manifest.file; do
    [ -f $i ] && . $i
    [ -f $i ] && sed -e 's/\([^ ]*\)/"\1"/g' < $i > $i-edited && . $i-edited
done
for i in $PREFIX.pkgrecv/*/*/manifest.hardlink; do
    [ -f $i ] && . $i
    [ -f $i ] && sed -e 's/\([^ ]*\)/"\1"/g' < $i > $i-edited && . $i-edited
done
for i in $PREFIX.pkgrecv/*/*/manifest.link; do
    [ -f $i ] && . $i
    [ -f $i ] && sed -e 's/\([^ ]*\)/"\1"/g' < $i > $i-edited && . $i-edited
done
for i in $PREFIX.pkgrecv/*/*/manifest.license; do
    [ -f $i ] && . $i
    [ -f $i ] && sed -e 's/\([^ ]*\)/"\1"/g' < $i > $i-edited && . $i-edited
done
tar cf - $PREFIX | gzip -9 >$PREFIX.tar.gz
tar cf - $PREFIX | gzip -9 >$ARCHIVE
rm -rf $PREFIX.pkgrecv $PREFIX