From 4799691c4e1d7024bff7324646f8f604ce0e2516 Mon Sep 17 00:00:00 2001 From: David Somero Date: Tue, 11 May 2010 20:02:11 +0200 Subject: system/webmin: Added to 12.0 repository --- system/webmin/README | 28 ++++++++ system/webmin/doinst.sh | 24 +++++++ system/webmin/rc.webmin | 81 ++++++++++++++++++++++++ system/webmin/slack-desc | 19 ++++++ system/webmin/webmin.SlackBuild | 137 ++++++++++++++++++++++++++++++++++++++++ system/webmin/webmin.info | 8 +++ 6 files changed, 297 insertions(+) create mode 100644 system/webmin/README create mode 100644 system/webmin/doinst.sh create mode 100644 system/webmin/rc.webmin create mode 100644 system/webmin/slack-desc create mode 100644 system/webmin/webmin.SlackBuild create mode 100644 system/webmin/webmin.info (limited to 'system/webmin') diff --git a/system/webmin/README b/system/webmin/README new file mode 100644 index 0000000000..636b2762d5 --- /dev/null +++ b/system/webmin/README @@ -0,0 +1,28 @@ +Webmin is a web-based interface for system administration for Unix. +Using any modern web browser, you can setup user accounts, Apache, +DNS, file sharing, and much more. Webmin removes the need to manually +edit Unix configuration files like /etc/passwd and lets you manage +a system from the console or remotely. + +Webmin consists of a simple web server and a number of CGI programs +which directly update system files like /etc/inetd.conf and /etc/passwd. +The web server and all CGI programs are written in Perl version 5, and use +only the standard perl modules. + +Some modules will require manual configuration from within webmin. +Login with root and root's password. + +If you need to start webmin at boot. +The recommended way is to add the following to your /etc/rc.d/rc.local +script and make sure rc.webmin has executable permissions set: + if [ -x /etc/rc.d/rc.webmin ]; then + /etc/rc.d/rc.webmin start + fi +After the webmin service is started, point your web browser to +http://localhost:10000 and login as root to use webmin. + +Note that if you upgrade from a older version of this SlackBuild +you __MUST__ use the new /etc/rc.d/rc.webmin file. +Also, if you are upgrading, you need to backup your /etc/webmin directory. +All of the config files will be deleted by this upgrade - however, that +problem is solved in future upgrades, so it won't be an issue again. diff --git a/system/webmin/doinst.sh b/system/webmin/doinst.sh new file mode 100644 index 0000000000..765079d88b --- /dev/null +++ b/system/webmin/doinst.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +# Keep same perms on rc.webmin.new: +if [ -e etc/rc.d/rc.webmin ]; then + cp -a etc/rc.d/rc.webmin etc/rc.d/rc.webmin.new.incoming + cat etc/rc.d/rc.webmin.new > etc/rc.d/rc.webmin.new.incoming + mv etc/rc.d/rc.webmin.new.incoming etc/rc.d/rc.webmin.new +fi + +# Signal the startup script to do some post install configuration +touch etc/webmin/FIRSTRUN diff --git a/system/webmin/rc.webmin b/system/webmin/rc.webmin new file mode 100644 index 0000000000..72067fe843 --- /dev/null +++ b/system/webmin/rc.webmin @@ -0,0 +1,81 @@ +#!/bin/sh +# Description: Start or stop the Webmin server + +start=/etc/webmin/start +stop=/etc/webmin/stop +lockfile=/var/lock/subsys/webmin +confFile=/etc/webmin/miniserv.conf +pidFile=$(grep "^pidfile=" $confFile | sed -e 's/pidfile=//g') + +pkg_postinst () { + echo "Running postinstall scripts .." + + local crypt=$(grep "^root:" /etc/shadow | cut -f 2 -d :) + crypt=${crypt//\\/\\\\} + crypt=${crypt//\//\\\/} + sed -i "s/root:XXX/root:${crypt}/" /etc/webmin/miniserv.users + + if [ -d /usr/libexec/webmin ]; then + cd /usr/libexec/webmin + WEBMIN_CONFIG=/etc/webmin WEBMIN_VAR=/var/log/webmin /usr/libexec/webmin/run-postinstalls.pl + fi + + echo "done" +} + +case "$1" in +'start') + if [ -e /etc/webmin/FIRSTRUN ]; then + pkg_postinst + rm -f /etc/webmin/FIRSTRUN + fi + $start >/dev/null 2>&1 /dev/null 2>&1 + echo "Webmin Started" + fi + ;; +'stop') + $stop + RETVAL=$? + if [ "$RETVAL" = "0" ]; then + rm -f $lockfile + fi + pidfile=`grep "^pidfile=" $confFile | sed -e 's/pidfile=//g'` + if [ "$pidfile" = "" ]; then + pidfile=$pidFile + fi + echo "Webmin Stopped" + rm -f $pidfile + ;; +'status') + pidfile=`grep "^pidfile=" $confFile | sed -e 's/pidfile=//g'` + if [ "$pidfile" = "" ]; then + pidfile=$pidFile + fi + if [ -s $pidfile ]; then + pid=`cat $pidfile` + kill -0 $pid >/dev/null 2>&1 + if [ "$?" = "0" ]; then + echo "Webmin (pid $pid) is running" + RETVAL=0 + else + echo "Webmin is stopped" + RETVAL=1 + fi + else + echo "Webmin is stopped" + RETVAL=1 + fi + ;; +'restart') + $stop ; $start + RETVAL=$? + ;; +*) + echo "Usage: $0 { start | stop | restart }" + RETVAL=1 + ;; +esac +exit $RETVAL diff --git a/system/webmin/slack-desc b/system/webmin/slack-desc new file mode 100644 index 0000000000..29bc0cd2bc --- /dev/null +++ b/system/webmin/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' on +# the right side marks the last column you can put a character in. You must make +# exactly 11 lines for the formatting to be correct. It's also customary to +# leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +webmin: webmin (web-based interface for system administration) +webmin: +webmin: Webmin is a web-based interface for system administration for Unix. +webmin: You can initially login in at http://localhost:10000 +webmin: with user root and root's password. +webmin: +webmin: Homepage: http://www.webmin.com +webmin: +webmin: +webmin: +webmin: diff --git a/system/webmin/webmin.SlackBuild b/system/webmin/webmin.SlackBuild new file mode 100644 index 0000000000..377960d85b --- /dev/null +++ b/system/webmin/webmin.SlackBuild @@ -0,0 +1,137 @@ +#!/bin/sh + +# Slackware build script for Webmin http://www.webmin.com + +# Copyright 2006-2007 David Somero (dsomero@hotmail.com) +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=webmin +VERSION=1.400 +ARCH=noarch +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=${TMP}/package-${PRGNAM} +OUTPUT=${OUTPUT:-/tmp} + +# Check if webmin is running - if so, the build will fail... +if [ -e /etc/webmin/miniserv.conf ]; then + PIDFILE=$(grep "^pidfile=" /etc/webmin/miniserv.conf | sed -e 's/pidfile=//g') + if [ -e $PIDFILE ]; then + echo "Webmin is running or a stale pid file exists." + echo "Stop webmin and/or remove $PIDFILE" + exit 1 + fi +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.*z* +cd $PRGNAM-$VERSION +chown -R root:root . +chmod -R u+w,go+r-w,a-s . + +rm -f mount/{freebsd,openbsd,macos}-mounts* + +( find . -name '*.cgi' ; find . -name '*.pl' ) | perl perlpath.pl /usr/bin/perl - + +install -d -m 0755 $PKG/usr/libexec/webmin +install -d -m 0755 $PKG/var +install -d -m 0755 $PKG/etc/rc.d/ +install -d -m 0755 $PKG/etc/webmin/ +install -d -m 0755 $PKG/var/log/webmin/ +install -m 0644 $CWD/rc.webmin $PKG/etc/rc.d/rc.webmin +cp -rp * $PKG/usr/libexec/webmin +echo "slackware" > $PKG/usr/libexec/webmin/install-type +echo "/usr/libexec/webmin" > $PKG/usr/libexec/webmin/install-dir + +config_dir=$PKG/etc/webmin +var_dir=$PKG/var/log/webmin +perl=/usr/bin/perl +autoos=1 +port=10000 +login=root +crypt="XXX" +host=$(hostname) +ssl=0 +atboot=0 +nostart=1 +nochown=1 +autothird=1 +nouninstall=1 +noperlpath=1 +nopostinstall=1 + +export config_dir var_dir perl autoos port login crypt host ssl atboot nostart nochown autothird nouninstall noperlpath nopostinstall + +cd $PKG/usr/libexec/webmin + ./setup.sh 2>&1 +cd - + +# Fixup the package files to use their real locations +sed -i -e 's:^pidfile=.*$:pidfile=/var/run/webmin.pid:' $PKG/etc/webmin/miniserv.conf +find $PKG -type f | xargs sed -i -e "s:$PKG::g" + +# Remove some stuff we don't need +rm -rf $PKG/usr/libexec/webmin/acl/Authen-SolarisRBAC-0.1 +rm -f $PKG/usr/libexec/webmin/acl/Authen-SolarisRBAC-0.1.tar.gz + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a LICENCE* README ${CWD}/webmin.SlackBuild $PKG/usr/doc/$PRGNAM-$VERSION +chown -R root:root $PKG/usr/doc/$PRGNAM-$VERSION +chmod 644 $PKG/usr/doc/$PRGNAM-$VERSION/* + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +# Find config files and add the .new. +# Used by the next block of code. +get_config_files() { + for i in $(ls -1 $1); do + if [ -d "$1/$i" ]; then + get_config_files "$1/$i" + else + echo -n "$1/$i.new " | sed -e "s/^$(echo $PKG | sed -e 's/\//\\\//g')\///g" + mv "$1/$i" "$1/$i.new" + fi + done +} + +# Finish the doinst.sh by adding the .new file list and config loop +if [ -e $PKG/etc ]; then + etc_files=$(get_config_files $PKG/etc) + +cat <> $PKG/install/doinst.sh +for FILE in $etc_files +do + config \$FILE +done +DOINST +fi + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz diff --git a/system/webmin/webmin.info b/system/webmin/webmin.info new file mode 100644 index 0000000000..01fc7a2496 --- /dev/null +++ b/system/webmin/webmin.info @@ -0,0 +1,8 @@ +PRGNAM="webmin" +VERSION="1.400" +HOMEPAGE="http://www.webmin.com/" +DOWNLOAD="http://downloads.sourceforge.net/webadmin/webmin-1.400.tar.gz" +MD5SUM="c52399bc70f0277d69fb128930e09fd0" +MAINTAINER="David Somero" +EMAIL="dsomero@hotmail.com" +APPROVED="rworkman" -- cgit v1.2.3