#!/bin/bash

VERSION='8.1'
BUILD='1'
NAME='zenwalk-tweaks'

arch='noarch'

CWD=$(pwd)

PKG="/tmp/$NAME-$VERSION-$arch-$BUILD"


cd $CWD
rm -rf $PKG
rm -f $PKG.txz

# Copy the /etc/skel and other desktop related config files tree
# tar -xvf $CWD/$NAME.tar.gz 
cp -rf $CWD/skel $PKG


mkdir -p $PKG/usr/src/$NAME-$VERSION
cp $CWD/$NAME.SlackBuild $PKG/usr/src/$NAME-$VERSION/

chown -R root:root $PKG

# slack-desc
mkdir -p $PKG/install
cat > $PKG/install/slack-desc << EOF
$NAME: $NAME - system level tweaks
$NAME:
$NAME: Many system wide optimizations and post-install
$NAME: tweaks
$NAME: 
$NAME: For more information, see:  http://zenwalk.org
$NAME:
$NAME:
$NAME:
$NAME:
$NAME:
EOF

cd $PKG
chown -R root.root .
find . -perm 777 -exec chmod 755 {} \;
find . -perm 775 -exec chmod 755 {} \;
find . -perm 700 -exec chmod 755 {} \;
find . -perm 770 -exec chmod 755 {} \;
find . -perm 666 -exec chmod 644 {} \;
find . -perm 664 -exec chmod 644 {} \;
find . -perm 444 -exec chmod 644 {} \;
find . -perm 600 -exec chmod 644 {} \;
find . -perm 400 -exec chmod 644 {} \;
find . -perm 440 -exec chmod 644 {} \;
find . -perm 422 -exec chmod 644 {} \;

makepkg -l y -c y $PKG.txz

rm -rf $PKG


