#!/bin/bash
## src2pkg script for: 	webmin
## Auto-generated by src2pkg-1.7
## src2pkg Copyright 2005-2007 Gilbert Ashley <amigo@ibilio.org>

SOURCE_URL='http://distro.ibiblio.org/pub/linux/distributions/amigolinux/download/Utils/webmin-minimal-1.380/webmin-1.380-minimal.tar.gz'

EXTRA_SOURCES='
http://distro.ibiblio.org/pub/linux/distributions/amigolinux/download/Utils/webmin-minimal-1.380/doinst.sh
http://distro.ibiblio.org/pub/linux/distributions/amigolinux/download/Utils/webmin-minimal-1.380/rc.webmin
http://distro.ibiblio.org/pub/linux/distributions/amigolinux/download/Utils/webmin-minimal-1.380/webmin-setup
http://distro.ibiblio.org/pub/linux/distributions/amigolinux/download/Utils/webmin-minimal-1.380/slack-desc
http://distro.ibiblio.org/pub/linux/distributions/amigolinux/download/Utils/webmin-minimal-1.380/README.webmin-setup
'
ALT_NAME=webmin-minimal
ALT_VERSION=1.380

ARCH='i486'
BUILD='1'
PRE_FIX='usr'
# Any extra options go here
# EXTRA_CONFIGS=''
# STD_FLAGS='-O2 -march=i486 -mtune=i686'
DOCLIST='README LICENCE LICENCE.ja PATENTS'
FORCE_ZERO_LENGTH="YES"
# Get the functions and configs
. /usr/libexec/src2pkg/FUNCTIONS ;

# do_all_processes can substitute these 16 steps:

pre_process
find_source
make_dirs
unpack_source

#fix_source_perms
# configure_source
# compile_source
# fake_install

cd $SRC_DIR ;

# While src2pkg will actually follow the setup.sh installation script
# and create a package, there will still be a couple of details missing
# in order for webmin to work properly. This is one of those cases
# where the installation is better done with manually written code.
# This package installs over 14,000 files and the normal src2pkg
# routines take a very long time to double-check everything.
# The code below is all straight from the SlackBuild script
# from SlackBuilds.org -originally written by David Somero-
# except that I leave the login username and crypt/password
# routines to be interactive during package creation. If you want
# use a different port' it could also be changed below

chown -R root:root .
chmod -R u+w,go+r-w,a-s .

(find . -name '*.cgi' ; find . -name '*.pl') | perl perlpath.pl /usr/bin/perl -

install -m0755 -d ${PKG}/usr/libexec/webmin
install -m0755 -d ${PKG}/var
install -m0755 -d ${PKG}/etc/rc.d/
install -m0755 -d ${PKG}/etc/webmin/
install -m0755 -d ${PKG}/var/log/webmin/
install -m0644 ${CWD}/rc.webmin ${PKG}/etc/rc.d/rc.webmin.new
cp -rp * ${PKG}/usr/libexec/webmin
echo slackware > ${PKG}/usr/libexec/webmin/install-type

config_dir=${PKG}/etc/webmin
var_dir=${PKG}/var/log/webmin
perl=/usr/bin/perl
autoos=1
port=10000
login=admin
#crypt="XXX"
password="dummy"
password2="dummy"
host=$(hostname)
ssl=0
atboot=0
nostart=1
nochown=1
autothird=1
nouninstall=1
noperlpath=1
export config_dir var_dir perl autoos port login password password2 host ssl atboot \
  nostart nochown autothird nouninstall noperlpath
${PKG}/usr/libexec/webmin/setup.sh

# Fixup the config files to use their real locations
sed -i -e 's:^pidfile=.*$:pidfile=/var/run/webmin.pid:' ${PKG}/etc/webmin/miniserv.conf
find ${PKG}/etc/webmin -type f | xargs sed -i -e "s:${PKG}::g"

rm -rf ${PKG}/usr/libexec/webmin/acl/Authen-SolarisRBAC-0.1
rm -f ${PKG}/usr/libexec/webmin/acl/Authen-SolarisRBAC-0.1.tar.gz

# fix_pkg_perms
# strip_bins

# We return the favor, though, by including a webmin-setup
# script which makes it easier to setup or change the configuration
# of webmin after installation. The script is just a cut-down
# version of the setup.sh script which is run during creation
# of the package or when installing webmin manually.

mkdir -p $PKG_DIR/usr/sbin
cp $CWD/webmin-setup $PKG_DIR/usr/sbin
chown root:root $PKG_DIR/usr/sbin/webmin-setup
chmod 755 $PKG_DIR/usr/sbin/webmin-setup

create_docs

cp $CWD/README.webmin-setup $PKG_DIR/usr/doc/$NAME-$VERSION

compress_man_pages
make_description
make_doinst
make_package
post_process

# src2pkg - Copyright 2005-2007  Gilbert Ashley <amigo@ibiblio.org>
## See the documentation for more help and examples. Below are some of
# the most common Extras and Options for easy cut-and-paste use.
# EXTRA_CONFIGS='' PRE_FIX='' DOCLIST=''
# MAKE_COMMAND='' INSTALL_LINE='' 
# SHELL_INSTALL='YES' CORRECT_PERMS='NO'
