#!/bin/sh
#
# Copyright 2005 Paul Blazejowski <paulb@blazebox.homeip.net>
# Available under the terms of the GNU GPL.
#

NAME="network-manager"
VERSION="0.6.2"
REVISION="7"
PKG_SOURCEURL='http://ftp.gnome.org/pub/GNOME/sources/NetworkManager/0.6/NetworkManager-$VERSION.tar.bz2'
PKG_SOURCEMD5=''

PKG_PATCH[0]="nm-fix-header.patch"
PKG_PATCH[1]="nm-slackware-backend.patch"
PKG_PATCH[2]="nm-slackware-initscript.patch"
PKG_PATCH[3]="rc.networkmanager"
PKG_PATCH[4]="networkmanager-supplicant_timeout.patch"

. $DLG_ROOT/config
. $DLG_ROOT/SCRIPTS/dropline-functions.sh

configfile /etc/rc.d/rc.networkmanager

cflags
cxxflags
prepare
applypatch 0 1
applypatch 1 1
applypatch 2 1
applypatch 4 1
analyzesource

# bump configure
spewdo "cd $PKG_SRCROOT"
autoreconf

configure --with-distro=slackware --localstatedir=/var
make -j3
makecheck
makeinstall install-strip

# We remove the default rc.networkmanager script
spewdo "rm $PKG_STAGEROOT$PKG_SYSCONFDIR/rc.d/rc.networkmanager"
# We also remove the rc.networkmanager-dispatcher script
# unless there is a reason that it should be enbled???
spewdo "rm $PKG_STAGEROOT$PKG_SYSCONFDIR/rc.d/rc.networkmanager-dispatcher"

# and we insert our modified version
findpatch initscript ${PKG_PATCH[3]}
sysvinitsetup $initscript 345 95

# Copy the nm-tool utility
spewdo "cp $PKG_SRCROOT/test/nm-tool $PKG_STAGEROOT$PKG_PREFIX/bin"

# Remove the autostart nm-applet.desktop file
# because of issues with splash hanging...
spewdo "rm $PKG_STAGEROOT$PKG_PREFIX/share/gnome/autostart/nm-applet.desktop"

tidydocumentation
analyzebinaries
finalizepackage

# chmod 0644 the rc.networkmanager script
spewdo "chmod 0644 $PKG_STAGEROOT$PKG_SYSCONFDIR/rc.d/rc.networkmanager.new"

packagize
cleanup

