#Maintainer: Dimitris Tzemos <dijemos~at~gmail~dot~com>

pkgname=zzz-settings-slackel-openbox
pkgver=14.2
pkgrel=4dj
arch=noarch
#options=('noautodotnew')
options=('noextract' )

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"zzz-settings-slackel-openbox (provides system wide fixes for openbox)"
"This package provides fixes for some packages and default settings for"
"others. It can safely be removed after installation, but it should"
"never be installed or upgraded by the user, or it might change some"
"default system settings."
)

build() {
	mkdir -p $startdir/pkg/etc/ 
	echo  "slackel.example.net" > $startdir/pkg/etc/HOSTNAME
	mkdir -p $PKG/etc/rc.d/
	echo "LSB_VERSION=1.4" > "$PKG/etc/lsb-release"
    echo "DISTRIB_ID=slackel" >> "$PKG/etc/lsb-release"
    echo "DISTRIB_RELEASE=7.3" >> "$PKG/etc/lsb-release"
    echo "DISTRIB_CODENAME=Openbox" >> "$PKG/etc/lsb-release"
    #echo "DISTRIB_DESCRIPTION=\"Slackel Linux `uname -r`\"" >> "$PKG/etc/lsb-release"
    echo "DISTRIB_DESCRIPTION=\"Slackel Linux Openbox\"" >> "$PKG/etc/lsb-release"    
    sh /usr/bin/lsb_release-update
	chown -R root:root $startdir/pkg
} 

doinst() {
	if [ -f usr/bin/lxterminal ]; then
 (
  cd usr/bin
  ln -sf lxterminal xterm
 )
fi

#if [ -f etc/rc.d/rc.alsa ]; then
# (
#  cd etc/rc.d
#  chmod +x rc.alsa
# )
#fi

# Load ALSA OSS compatibility module:
#if [ -f etc/rc.d/rc.alsa-oss ]; then
#  (
#  cd etc/rc.d
#  chmod +x rc.alsa-oss
# )
#fi

if [ -r etc/rc.d/rc.pulseaudio ]; then
	chmod +x etc/rc.d/rc.pulseaudio
fi

if [ -r etc/rc.d/rc.cups ]; then
	chmod +x etc/rc.d/rc.cups
fi

#if [ -f etc/rc.d/rc.local ]; then
#   echo rfkill unblock all >> etc/rc.d/rc.local
#fi

#if [ -f etc/gdm/custom.conf ]; then
#       sed -i "s/\[daemon\]/[daemon]\n\nDefaultSession=openbox.desktop/" etc/gdm/custom.conf
#fi

if [ -f usr/share/applications/jconsole.desktop ]; then
	rm usr/share/applications/jconsole.desktop
fi	

if [ -f usr/share/applications/policytool.desktop ]; then
	rm usr/share/applications/policytool.desktop
fi	

sed -i "s/^#GraphicalTheme=\(.*\)/GraphicalTheme=Slackel/" usr/share/gdm/defaults.conf
sed -i "s/0a559a/242e1a/" etc/conky/conky.conf 
#sed -i "s/xdg-open/midori/" usr/share/applications/cups.desktop
#sed -i "s/Exec=\(.*\)/Exec=xterm -e \/usr\/bin\/htop/" usr/share/applications/htop.desktop

}

