You are not logged in.
Heya all,
since there were quite some requests for this. I made a PKGBUILD for webmin. I have to say ... this wasn't an easy one for me. I choose for webmin-minimal so that peopel can add the modules they want.
However, when you look at the code, you'll see that it needs improvements ...
What is done:
it builds and installs. It creates a new user and group, both called webmin. these groups will be deleted when you uninstall the package (see comments if this is good or bad).
~Todo:
* No SSL can be used ... this is pretty critical I think. There is an SSLeay package in testing I saw, but webmin couldn't find it.
* I also get an error in the webmin-log that it can find a/the perl PAM-module ...
* The web-interface seems to function, but you can't request a proces-list: this is maybe a bug in the program?? Webmin requests "proc/index_.cgi", but that file doesn't exist. The file "proc/index.cgi" exists however.
* I've written code the generate a random initial password. However, this code doesn't seem to function. For the moment there is a static password ... but I suppose you'll change it when you install webmin. Anyway, Ithink it would be better if the initial one would be a random password. This code belongs in the install-file to my opinion and not in the PKGVUILD like now, but this requires some effort to implement since there is some code for setting up the password in the setup-file.
* A lot of comments in the code ...
Now it's time to sleep ... .
PKGBUILD:
#Michel Branbants <michel.linux@tiscali.be>
pkgname=webmin
pkgver=1.170
pkgrel=1
pkgdesc="Webmin is a web-based interface for system administration for Unix. Using any browser that supports tables and forms (and Java for the File Manager module), you can setup user accounts, Apache, DNS, file sharing and so on. 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 no non-standard Perl modules."
url="http://www.webmin.com"
depends=('perl>=5.0' 'coreutils')
backup=('etc/webmin/miniserv.conf')
install=webmin.install
source=(http://belnet.dl.sourceforge.net/sourceforge/webadmin/$pkgname-$pkgver-minimal.tar.gz
setup.sh.patch
copyconfig.pl.patch
webmin.install)
md5sums=('a2bc5d04524c52af8955c703179e8af4' '0332a42a04a9c522d483e8d2d61fcee1'
'72f5472f6b8fedf02cf8222cf962053b' '521d14ee48a8203f3765cadc9fbd9379')
build() {
cd $startdir/src/$pkgname-$pkgver
patch ./setup.sh $startdir/setup.sh.patch
patch ./copyconfig.pl $startdir/copyconfig.pl.patch
declare -r local installDir="/usr/share/webmin"
#configdir must be an absolute path
declare -r local configDir="/etc/webmin"
#this is the var_dir-variable
declare -r local logAndPidDir="/var/webmin"
#I added 2 new dirs to the setup-script, but I'm not completely sure if I just may add them. And what's var_dir's purpose now?So, for the log and run-files these directories should be used
declare -r local logDir="/var/log/webmin"
declare -r local pidDir="/var/run/webmin"
declare -r local os_type="generic-linux"
declare -r local os_version="2.6"
declare -r local real_os_type="Generic Linux"
declare -r local real_os_version="2.6"
declare -r local webminServerport="10000"
#username maybe not contain a ':' or a ' '(a space :)) and may not be "webmin"
declare -r local adminLoginname="admin"
#password may not contain a ':'.
#dit moet eigenlijk in de install-file
echo "generating initial administrator password ..."
declare -r local adminpass=$(genPassword 8)
echo "#The first and last quote of the loginpass-value are only to delimit the password and aren't part of the password!
initial webmin administrator-account:
loginname:$adminLoginname
loginpass:"$adminpass"" > $startdir/SHRED or REMOVE ME-webminAdminAccount
echo "info written to "SHRED or REMOVE ME-webminAdminAccount""
#no SSL need SSLeay installed somewhere perl can find it!
#post-setup-script: (line 735) setup-post.sh
./setup.sh "$installDir" "$startdir/pkg" "$configDir" "$logAndPidDir" "$webminServerport" "$adminLoginname" "$adminpass" "$os_type" "$os_version" "$real_os_type" "$real_os_version" "$logDir" "$pidDir"
echo "administrator-account-info written to "$startdir/SHRED or REMOVE ME-webminAdminAccount""
}
#############################
#############################
#$1 = length of Password. Must be AT LEAST 8 CHARACTERS. Some people will say this is not necessary maybe or not enough. Anyway this password is the initial password.
genPassword() {
declare -r local passLength=$1
if [[ 8 -gt $passLength ]]; then
#writing to stderr
echo "password length needs to be at least 8 characters" 1>&2
return 1
fi
declare local pass=$(genRandomString $passLength)
#the password may not contain ':'.
#Replace all occurences of ':' with another character. Mayeb first check if there is a problem ...
#could be endless loop .. but I would suppose it is a random generator ... I try maximum 3 times
#to avoid an endless loop, else the character 'A' will be chosen to replace ':'
declare local replacement=':';
declare -i local iter=1;
while [[ ':' == $replacement ]] && [[ $iter -le 3 ]]; do
replacement=`head -c 1 /dev/random`
iter=$iter+1
done
if [[ ':' == $replacement ]]; then
replacement='A'
fi
pass=${pass//:/$replacement}
echo "$pass"
return 0
}
#$1 = length of string.
genRandomString() {
declare -ri local stringLength=$1;
#/dev/random instead od /dev/urandom will be used for more chance on a good random values.
#/dev/random can however block if not enough input is available
declare local string
read -n $stringLength string < /dev/random
#echo "$string"
echo "QueCeraCera"
}
#Contributor: Michel Brabants <michel.linux@tiscali.be>
# This is a default template for a post-install scriptlet. You can
# remove any functions you don't need (and this header).
# arg 1: the new package version
pre_install() {
/bin/true
}
# arg 1: the new package version
post_install() {
declare -r local USER="webmin"
declare -r local GROUP="webmin"
#searching for free gid in range of 1-100 : error should be captured : todo
declare -ri freeGid=$(getFreeGid);
echo -n "Creating group $GROUP : ";
if [[ 0 -eq `/usr/sbin/groupadd -g $freeGid $GROUP` ]]; then
echo " OK";
else
echo " FAILED";
fi
#searching for free uid in range of 1-1000 : error should be captured : todo
declare -ri freeUid=$(getFreeUid);
echo -n "Creating user $USER with primary group $GROUP";
if [[ 0 -eq `/usr/sbin/useradd -c "user for webmin" -g "$GROUP" -G "$AUDIO_GROUP" -s "/bin/false" -u $freeUid $USER` ]]; then
echo " OK";
else
echo " FAILED;"
fi
update_permissions $USER $GROUP;
}
# arg 1: the new package version
# arg 2: the old package version
pre_upgrade() {
/bin/true
}
# arg 1: the new package version
# arg 2: the old package version
post_upgrade() {
#we don't add the user again ... or should we check if it still exists?
declare -r local USER="webmin"
declare -r local GROUP="webmin"
update_permissions $USER $GROUP;
}
# arg 1: the old package version
pre_remove() {
/bin/true
}
# arg 1: the old package version
post_remove() {
rm -rf /var/log/webmin
rm -rf /var/run/webmin
declare -r local USER="webmin"
declare -r local GROUP="webmin"
#delete the webmin user. Mayeb to tricky? Somebody may be using it already
#userdel seems to delete the user and the group
echo -n "Deleting user $USER and group $GROUP: ";
if [[ 0 -eq `/usr/sbin/userdel $USER` ]]
then
echo " OK";
else
echo " FAILED";
fi
#echo -n "Deleting group $GROUP : ";
#if [[ 6 -eq `/usr/sbin/groupdel $GROUP` ]]
#then
# echo " OK";
# else
# echo " FAILED";
#fi
}
#############################
#############################
# arg 1: username
# arg 2: groupname
#would be better if we used the file-list that is in the package?
update_permissions() {
declare -r local USER=$1;
declare -r local GROUP=$2;
echo "Setting owner:group of webmin-files to $USER:$GROUP and setting permissions ...";
#change file- and directory-permissions
chown -R $USER:$GROUP /etc/webmin
chmod -R o= /etc/webmin
chown -R $USER:$GROUP /usr/share/webmin
chmod -R o= /usr/share/webmin
chown -R $USER:$GROUP /var/log/webmin
chmod u+s,g+s,o=,o+t /var/log/webmin
chown -R $USER:$GROUP /var/run/webmin
chmod u+s,g+s,o=,o+t /var/run/webmin
echo "Setting owner:group and permissions : DONE"
}
#############################
#the almighty bash :). You can use functions together with pipes :).
getFreeUid() {
echo "$(uidRangeFilter 1 1000 | sort -g | getFreeId 1 1000)";
}
getFreeGid() {
echo "$(gidRangeFilter 1 100 | sort -g | getFreeId 1 100)"
}
#give all existing uid's back within the range of $1-$2
uidRangeFilter() {
#going into restricted mode
set -r;
declare -ri local minId=$1;
declare -ri local maxId=$2;
if [[ $maxId -lt $minId ]]; then
echo "maximum rangebound is smaller than minimum rangebound.";
echo "command: ./uidRangeFilter minimumBound maximumBound"
exit 1;
fi
#should mayeb check on overflow. Surely since this is a critical file
#IFS = internal field separator/delimiter
IFS=:;
while read name passwd uid theRest; do
if [[ $uid -ge $minId ]] && [[ $uid -le $maxId ]]; then
echo "$uid";
fi;
done < /etc/passwd;
}
#give all existing gid's back within the range of $1-$2
gidRangeFilter() {
#going into restricted mode
set -r;
declare -ri local minId=$1;
declare -ri local maxId=$2;
if [[ $maxId -lt $minId ]]; then
echo "maximum rangebound is smaller than minimum rangebound.";
echo "command: ./gidRangeFilter minimumBound maximumBound"
exit 1;
fi
#should mayeb check on overflow. Surely since this is a critical file
#IFS = internal field separator/delimiter
IFS=:;
while read name passwd gid theRest; do
if [[ $gid -ge $minId ]] && [[ $gid -le $maxId ]]; then
echo "$gid";
fi;
done < /etc/group;
}
#find a freeId that is in the range of $1-$2 given that the input-stream contains already occupied id's, sorted from small to big.
getFreeId() {
#enter restricted mode
set -r;
declare -ri local minId=$1;
declare -ri local maxId=$2;
if [[ $maxId -lt $minId ]]; then
echo "maximum id is smaller than minimum id.";
echo "command: ./freeId minimumId maximumId"
exit 1;
fi;
declare -i local freeId=$minId;
#uid's are within the requested range and sorted from small to big
while read uid; do
#userId is occupied
if [[ $freeId -eq $uid ]]; then
let freeId+=1;
else
echo "$freeId";
return;
fi;
done
if [[ $maxId -ge $freeId ]]; then
echo "$freeId";
return;
fi;
#no free userId found
echo "";
return;
}
op=$1
shift
$op $*
--- setup.sh 2004-12-03 01:19:35.000000000 +0100
+++ setup-new.sh 2004-12-03 01:53:42.000000000 +0100
@@ -32,6 +32,22 @@
PERLLIB="$PERLLIB:$perllib"
fi
+declare -r local DESTDIR=$2;
+declare -r local config_dir=$3;
+#what is the purpose for var_dir?
+declare -r local var_dir=$4;
+#what is the influence of placing the log- and pid-files in another directory than var_dir?
+declare -r local os_type=$8;
+#leaned something new: from $9 paramters need to be surrounded by brackets!!
+declare -r local os_version=${9};
+declare -r local real_os_type=${10};
+declare -r local real_os_version=${11};
+declare -r local port=$5;
+declare -r local login=$6;
+declare -r local password=$7;
+declare -r local log_dir=${12};
+declare -r local pid_dir=${13};
+
echo "***********************************************************************"
echo "* Welcome to the Webmin setup script, version $ver *"
echo "***********************************************************************"
@@ -40,40 +56,40 @@
echo ""
# Only root can run this
-id | grep "uid=0(" >/dev/null
-if [ $? != "0" ]; then
- uname -a | grep -i CYGWIN >/dev/null
- if [ $? != "0" ]; then
- echo "ERROR: The Webmin install script must be run as root";
- echo "";
- exit 1;
- fi
-fi
+#id | grep "uid=0(" >/dev/null
+#if [ $? != "0" ]; then
+# uname -a | grep -i CYGWIN >/dev/null
+# if [ $? != "0" ]; then
+# echo "ERROR: The Webmin install script must be run as root";
+# echo "";
+# exit 1;
+# fi
+#fi
# Use the supplied destination directory, if any
if [ "$1" != "" ]; then
wadir=$1
- echo "Installing Webmin from $srcdir to $wadir ..."
- if [ ! -d "$wadir" ]; then
- mkdir "$wadir"
+ echo "Installing Webmin from $srcdir to $DESTDIR$wadir ..."
+ if [ ! -d "$DESTDIR$wadir" ]; then
+ mkdir -p "$DESTDIR$wadir"
if [ "$?" != "0" ]; then
- echo "ERROR: Failed to create $wadir"
+ echo "ERROR: Failed to create $DESTDIR$wadir"
echo ""
exit 1
fi
else
# Make sure dest dir is not in use
- ls "$wadir" | grep -v rpmsave >/dev/null 2>&1
- if [ "$?" = "0" -a ! -r "$wadir/setup.sh" ]; then
- echo "ERROR: Installation directory $wadir contains other files"
+ ls "$DESTDIR$wadir" | grep -v rpmsave >/dev/null 2>&1
+ if [ "$?" = "0" -a ! -r "$DESTDIR$wadir/setup.sh" ]; then
+ echo "ERROR: Installation directory $DESTDIR$wadir contains other files"
echo ""
exit 1
fi
fi
else
- echo "Installing Webmin in $wadir ..."
+ echo "Installing Webmin in $DESTDIR$wadir ..."
fi
-cd "$wadir"
+cd "$DESTDIR$wadir"
# Validate source directory
allmods=`cd "$srcdir"; echo */module.info | sed -e 's//module.info//g'`
@@ -108,16 +124,16 @@
echo ""
exit 2
fi
-if [ ! -d $config_dir ]; then
- mkdir $config_dir;
+if [ ! -d $DESTDIR$config_dir ]; then
+ mkdir -p $DESTDIR$config_dir;
if [ $? != 0 ]; then
- echo "ERROR: Failed to create directory $config_dir"
+ echo "ERROR: Failed to create directory $DESTDIR$config_dir"
echo ""
exit 2
fi
fi
-if [ -r "$config_dir/config" ]; then
- echo "Found existing Webmin configuration in $config_dir"
+if [ -r "$DESTDIR$config_dir/config" ]; then
+ echo "Found existing Webmin configuration in $DESTDIR$config_dir"
echo ""
upgrading=1
fi
@@ -197,9 +213,9 @@
rm -f $config_dir/module.infos.cache
else
# Config directory exists .. make sure it is not in use
- ls $config_dir | grep -v rpmsave >/dev/null 2>&1
+ ls $DESTDIR$config_dir | grep -v rpmsave >/dev/null 2>&1
if [ "$?" = "0" -a "$config_dir" != "/etc/webmin" ]; then
- echo "ERROR: Config directory $config_dir is not empty"
+ echo "ERROR: Config directory $DESTDIR$config_dir is not empty"
echo ""
exit 2
fi
@@ -223,14 +239,55 @@
exit ""
exit 3
fi
- if [ ! -d $var_dir ]; then
- mkdir $var_dir
+ if [ ! -d $DESTDIR$var_dir ]; then
+ mkdir -p $DESTDIR$var_dir
if [ $? != 0 ]; then
- echo "ERROR: Failed to create directory $var_dir"
+ echo "ERROR: Failed to create directory $DESTDIR$var_dir"
echo ""
exit 3
fi
fi
+
+ abspath=`echo $log_dir | grep "^/"`
+ if [ "$abspath" = "" ]; then
+ echo "Log-file-directory(log_dir) must be an absolute path"
+ echo ""
+ exit 3
+ fi
+ if [ "$log_dir" = "/" ]; then
+ echo "Log directory(log_dir) cannot be /"
+ echo ""
+ exit 3
+ fi
+ if [ ! -d $DESTDIR$log_dir ]; then
+ mkdir -p $DESTDIR$log_dir;
+ if [[ $? != 0 ]]; then
+ echo "ERROR: Failed to create directory $DESTDIR$log_dir"
+ echo ""
+ exit 3
+ fi
+ fi
+
+ abspath=`echo $pid_dir | grep "^/"`
+ if [ "$abspath" = "" ]; then
+ echo "Pid-file-directory(pid_dir) must be an absolute path"
+ echo ""
+ exit 3
+ fi
+ if [ "$pid_dir" = "/" ]; then
+ echo "Pid directory(pid_dir) cannot be /"
+ echo ""
+ exit 3
+ fi
+ if [ ! -d $DESTDIR$pid_dir ]; then
+ mkdir -p $DESTDIR$pid_dir;
+ if [[ $? != 0 ]]; then
+ echo "ERROR:Failed to create directory $DESTDIR$log_dir"
+ echo ""
+ exit 3
+ fi
+ fi
+
echo ""
# Ask where perl is installed
@@ -256,7 +313,7 @@
fi
else
printf "Full path to perl (default $perldef): "
- read perl
+# read perl
if [ "$perl" = "" ]; then
perl=$perldef
fi
@@ -386,6 +443,7 @@
echo ""
exit 14
fi
+
printf "Login password: "
if [ "$password" = "" -a "$crypt" = "" ]; then
stty -echo
@@ -425,82 +483,84 @@
fi
# Ask whether to run at boot time
- if [ "$atboot" = "" ]; then
- initsupp=`grep "^os_support=" "$srcdir/init/module.info" | sed -e 's/os_support=//g' | grep $os_type`
- atboot=0
- if [ "$initsupp" != "" ]; then
- printf "Start Webmin at boot time (y/n): "
- read atbootyn
- if [ "$atbootyn" = "y" -o "$atbootyn" = "Y" ]; then
- atboot=1
- fi
- else
- echo "Webmin does not support being started at boot time on your system."
- fi
- fi
+ #if [ "$atboot" = "" ]; then
+ # initsupp=`grep "^os_support=" "$srcdir/init/module.info" | sed -e 's/os_support=//g' | grep $os_type`
+ # atboot=0
+ # if [ "$initsupp" != "" ]; then
+ # printf "Start Webmin at boot time (y/n): "
+ # read atbootyn
+ # if [ "$atbootyn" = "y" -o "$atbootyn" = "Y" ]; then
+ # atboot=1
+ # fi
+ # else
+ # echo "Webmin does not support being started at boot time on your system."
+ # fi
+ #fi
+ #user has to decide this for him/herself
+ atboot=0
makeboot=$atboot
# Copy files to target directory
echo "***********************************************************************"
- if [ "$wadir" != "$srcdir" ]; then
- echo "Copying files to $wadir .."
- (cd "$srcdir" ; tar cf - . | (cd "$wadir" ; tar xf -))
+ if [ "$DESTDIR$wadir" != "$srcdir" ]; then
+ echo "Copying files to $DESTDIR$wadir .."
+ (cd "$srcdir" ; tar cf - . | (cd "$DESTDIR$wadir" ; tar xf -))
echo "..done"
echo ""
fi
# Create webserver config file
- echo $perl > $config_dir/perl-path
- echo $var_dir > $config_dir/var-path
+ echo $perl > $DESTDIR$config_dir/perl-path
+ echo $var_dir > $DESTDIR$config_dir/var-path
echo "Creating web server config files.."
cfile=$config_dir/miniserv.conf
- echo "port=$port" >> $cfile
- echo "root=$wadir" >> $cfile
- echo "mimetypes=$wadir/mime.types" >> $cfile
- echo "addtype_cgi=internal/cgi" >> $cfile
- echo "realm=Webmin Server" >> $cfile
- echo "logfile=$var_dir/miniserv.log" >> $cfile
- echo "errorlog=$var_dir/miniserv.error" >> $cfile
- echo "pidfile=$var_dir/miniserv.pid" >> $cfile
- echo "logtime=168" >> $cfile
- echo "ppath=$ppath" >> $cfile
- echo "ssl=$ssl" >> $cfile
- echo "env_WEBMIN_CONFIG=$config_dir" >> $cfile
- echo "env_WEBMIN_VAR=$var_dir" >> $cfile
- echo "atboot=$atboot" >> $cfile
- echo "logout=$config_dir/logout-flag" >> $cfile
- echo "listen=10000" >> $cfile
- echo "denyfile=\.pl$" >> $cfile
- echo "log=1" >> $cfile
- echo "blockhost_failures=5" >> $cfile
- echo "blockhost_time=60" >> $cfile
- echo "syslog=1" >> $cfile
+ echo "port=$port" >> $DESTDIR$cfile
+ echo "root=$wadir" >> $DESTDIR$cfile
+ echo "mimetypes=$wadir/mime.types" >> $DESTDIR$cfile
+ echo "addtype_cgi=internal/cgi" >> $DESTDIR$cfile
+ echo "realm=Webmin Server" >> $DESTDIR$cfile
+ echo "logfile=$log_dir/miniserv.log" >> $DESTDIR$cfile
+ echo "errorlog=$log_dir/miniserv.error" >> $DESTDIR$cfile
+ echo "pidfile=$pid_dir/miniserv.pid" >> $DESTDIR$cfile
+ echo "logtime=168" >> $DESTDIR$cfile
+ echo "ppath=$ppath" >> $DESTDIR$cfile
+ echo "ssl=$ssl" >> $DESTDIR$cfile
+ echo "env_WEBMIN_CONFIG=$config_dir" >> $DESTDIR$cfile
+ echo "env_WEBMIN_VAR=$var_dir" >> $DESTDIR$cfile
+ echo "atboot=$atboot" >> $DESTDIR$cfile
+ echo "logout=$config_dir/logout-flag" >> $DESTDIR$cfile
+ echo "listen=10000" >> $DESTDIR$cfile
+ echo "denyfile=\.pl$" >> $DESTDIR$cfile
+ echo "log=1" >> $DESTDIR$cfile
+ echo "blockhost_failures=5" >> $DESTDIR$cfile
+ echo "blockhost_time=60" >> $DESTDIR$cfile
+ echo "syslog=1" >> $DESTDIR$cfile
if [ "$allow" != "" ]; then
- echo "allow=$allow" >> $cfile
+ echo "allow=$allow" >> $DESTDIR$cfile
fi
if [ "$session" != "" ]; then
- echo "session=$session" >> $cfile
+ echo "session=$session" >> $DESTDIR$cfile
else
- echo "session=1" >> $cfile
+ echo "session=1" >> $DESTDIR$cfile
fi
if [ "$pam" != "" ]; then
- echo "pam=$pam" >> $cfile
+ echo "pam=$pam" >> $DESTDIR$cfile
fi
md5pass=`$perl -e 'print crypt("test", "\$1\$A9wB3O18\$zaZgqrEmb9VNltWTL454R/") eq "\$1\$A9wB3O18\$zaZgqrEmb9VNltWTL454R/" ? "1n" : "0n"'`
ufile=$config_dir/miniserv.users
if [ "$crypt" != "" ]; then
- echo "$login:$crypt:0" > $ufile
+ echo "$login:$crypt:0" > $DESTDIR$ufile
else
if [ "$md5pass" = "1" ]; then
- $perl -e 'print "$ARGV[0]:",crypt($ARGV[1], "$1$XXXXXXXX"),":0n"' "$login" "$password" > $ufile
+ $perl -e 'print "$ARGV[0]:",crypt($ARGV[1], "$1$XXXXXXXX"),":0n"' "$login" "$password" > $DESTDIR$ufile
else
- $perl -e 'print "$ARGV[0]:",crypt($ARGV[1], "XX"),":0n"' "$login" "$password" > $ufile
+ $perl -e 'print "$ARGV[0]:",crypt($ARGV[1], "XX"),":0n"' "$login" "$password" > $DESTDIR$ufile
fi
fi
- chmod 600 $ufile
- echo "userfile=$ufile" >> $cfile
+ chmod 600 $DESTDIR$ufile
+ echo "userfile=$ufile" >> $DESTDIR$cfile
kfile=$config_dir/miniserv.pem
openssl version >/dev/null 2>&1
@@ -517,74 +577,74 @@
root@$host
EOF
if [ "$?" = "0" ]; then
- cat $tempdir/cert $tempdir/key >$kfile
+ cat $tempdir/cert $tempdir/key >$DESTDIR$kfile
fi
rm -f $tempdir/cert $tempdir/key
fi
if [ ! -r $kfile ]; then
# Fall back to the built-in key
- cp "$wadir/miniserv.pem" $kfile
+ cp "$DESTDIR$wadir/miniserv.pem" $DESTDIR$kfile
fi
- chmod 600 $kfile
- echo "keyfile=$config_dir/miniserv.pem" >> $cfile
+ chmod 600 $DESTDIR$kfile
+ echo "keyfile=$config_dir/miniserv.pem" >> $DESTDIR$cfile
- chmod 600 $cfile
+ chmod 600 $DESTDIR$cfile
echo "..done"
echo ""
echo "Creating access control file.."
afile=$config_dir/webmin.acl
- rm -f $afile
+ rm -f $DESTDIR$afile
if [ "$defaultmods" = "" ]; then
- echo "$login: $allmods" >> $afile
+ echo "$login: $allmods" >> $DESTDIR$afile
else
- echo "$login: $defaultmods" >> $afile
+ echo "$login: $defaultmods" >> $DESTDIR$afile
fi
- chmod 600 $afile
+ chmod 600 $DESTDIR$afile
echo "..done"
echo ""
if [ "$login" != "root" -a "$login" != "admin" ]; then
# Allow use of RPC by this user
- echo rpc=1 >>$config_dir/$login.acl
+ echo rpc=1 >>$DESTDIR$config_dir/$login.acl
fi
fi
if [ "$noperlpath" = "" ]; then
echo "Inserting path to perl into scripts.."
- (find "$wadir" -name '*.cgi' -print ; find "$wadir" -name '*.pl' -print) | $perl "$wadir/perlpath.pl" $perl -
+ (find "$DESTDIR$wadir" -name '*.cgi' -print ; find "$DESTDIR$wadir" -name '*.pl' -print) | $perl "$DESTDIR$wadir/perlpath.pl" $perl -
echo "..done"
echo ""
fi
echo "Creating start and stop scripts.."
-rm -f $config_dir/stop $config_dir/start $config_dir/restart
-echo "#!/bin/sh" >>$config_dir/start
-echo "echo Starting Webmin server in $wadir" >>$config_dir/start
-echo "trap '' 1" >>$config_dir/start
-echo "LANG=" >>$config_dir/start
-echo "export LANG" >>$config_dir/start
-echo "#PERLIO=:raw" >>$config_dir/start
-echo "unset PERLIO" >>$config_dir/start
-echo "export PERLIO" >>$config_dir/start
-echo "PERLLIB=$PERLLIB" >>$config_dir/start
-echo "export PERLLIB" >>$config_dir/start
+rm -f $DESTDIR$config_dir/stop $DESTDIR$config_dir/start $DESTDIR$config_dir/restart
+echo "#!/bin/sh" >>$DESTDIR$config_dir/start
+echo "echo Starting Webmin server in $wadir" >>$DESTDIR$config_dir/start
+echo "trap '' 1" >>$DESTDIR$config_dir/start
+echo "LANG=" >>$DESTDIR$config_dir/start
+echo "export LANG" >>$DESTDIR$config_dir/start
+echo "#PERLIO=:raw" >>$DESTDIR$config_dir/start
+echo "unset PERLIO" >>$DESTDIR$config_dir/start
+echo "export PERLIO" >>$DESTDIR$config_dir/start
+echo "PERLLIB=$PERLLIB" >>$DESTDIR$config_dir/start
+echo "export PERLLIB" >>$DESTDIR$config_dir/start
uname -a | grep -i 'HP/*UX' >/dev/null
if [ $? = "0" ]; then
- echo "exec '$wadir/miniserv.pl' $config_dir/miniserv.conf &" >>$config_dir/start
+ echo "exec '$wadir/miniserv.pl' $config_dir/miniserv.conf &" >>$DESTDIR$config_dir/start
else
- echo "exec '$wadir/miniserv.pl' $config_dir/miniserv.conf" >>$config_dir/start
+ echo "exec '$wadir/miniserv.pl' $config_dir/miniserv.conf" >>$DESTDIR$config_dir/start
fi
-echo "#!/bin/sh" >>$config_dir/stop
-echo "echo Stopping Webmin server in $wadir" >>$config_dir/stop
-echo "pidfile=`grep "^pidfile=" $config_dir/miniserv.conf | sed -e 's/pidfile=//g'`" >>$config_dir/stop
-echo "kill `cat $pidfile`" >>$config_dir/stop
+echo "#!/bin/sh" >>$DESTDIR$config_dir/stop
+echo "echo Stopping Webmin server in $wadir" >>$DESTDIR$config_dir/stop
+echo "pidfile=`grep "^pidfile=" $config_dir/miniserv.conf | sed -e 's/pidfile=//g'`" >>$DESTDIR$config_dir/stop
+echo "kill `cat $pidfile`" >>$DESTDIR$config_dir/stop
-echo "#!/bin/sh" >>$config_dir/restart
-echo "$config_dir/stop && $config_dir/start" >>$config_dir/restart
+echo "#!/bin/sh" >>$DESTDIR$config_dir/restart
+echo "$config_dir/stop && $config_dir/start" >>$DESTDIR$config_dir/restart
-chmod 755 $config_dir/start $config_dir/stop
+chmod 755 $DESTDIR$config_dir/start $DESTDIR$config_dir/stop
echo "..done"
echo ""
@@ -593,13 +653,13 @@
else
echo "Copying config files.."
fi
-$perl "$wadir/copyconfig.pl" "$os_type" "$os_version" "$wadir" $config_dir "" $allmods
+$perl "$DESTDIR$wadir/copyconfig.pl" "$os_type" "$os_version" "$wadir" $config_dir "$DESTDIR" "" $allmods
if [ "$upgrading" != 1 ]; then
# Store the OS and version
- echo "os_type=$os_type" >> $config_dir/config
- echo "os_version=$os_version" >> $config_dir/config
- echo "real_os_type=$real_os_type" >> $config_dir/config
- echo "real_os_version=$real_os_version" >> $config_dir/config
+ echo "os_type=$os_type" >> $DESTDIR$config_dir/config
+ echo "os_version=$os_version" >> $DESTDIR$config_dir/config
+ echo "real_os_type=$real_os_type" >> $DESTDIR$config_dir/config
+ echo "real_os_version=$real_os_version" >> $DESTDIR$config_dir/config
if [ -r /etc/system.cnf ]; then
# Found a caldera system config file .. get the language
source /etc/system.cnf
@@ -608,61 +668,62 @@
elif [ "$CONF_LST_LANG" = "uk" ]; then
CONF_LST_LANG=en
fi
- grep "lang=$CONF_LST_LANG," "$wadir/lang_list.txt" >/dev/null 2>&1
+ grep "lang=$CONF_LST_LANG," "$DESTDIR$wadir/lang_list.txt" >/dev/null 2>&1
if [ "$?" = 0 ]; then
- echo "lang=$CONF_LST_LANG" >> $config_dir/config
+ echo "lang=$CONF_LST_LANG" >> $DESTDIR$config_dir/config
fi
fi
# Turn on logging by default
- echo "log=1" >> $config_dir/config
+ echo "log=1" >> $DESTDIR$config_dir/config
else
# one-off hack to set log variable in config from miniserv.conf
- grep log= $config_dir/config >/dev/null
+ grep log= $DESTDIR$config_dir/config >/dev/null
if [ "$?" = "1" ]; then
- grep log= $config_dir/miniserv.conf >> $config_dir/config
- grep logtime= $config_dir/miniserv.conf >> $config_dir/config
- grep logclear= $config_dir/miniserv.conf >> $config_dir/config
+ grep log= $DESTDIR$config_dir/miniserv.conf >> $DESTDIR$config_dir/config
+ grep logtime= $DESTDIR$config_dir/miniserv.conf >> $DESTDIR$config_dir/config
+ grep logclear= $DESTDIR$config_dir/miniserv.conf >> $DESTDIR$config_dir/config
fi
fi
-echo $ver > $config_dir/version
+echo $ver > $DESTDIR$config_dir/version
echo "..done"
echo ""
# Set passwd_ fields in miniserv.conf from global config
for field in passwd_file passwd_uindex passwd_pindex passwd_cindex passwd_mindex; do
- grep $field= $config_dir/miniserv.conf >/dev/null
+ grep $field= $DESTDIR$config_dir/miniserv.conf >/dev/null
if [ "$?" != "0" ]; then
- grep $field= $config_dir/config >> $config_dir/miniserv.conf
+ grep $field= $DESTDIR$config_dir/config >> $DESTDIR$config_dir/miniserv.conf
fi
done
-grep passwd_mode= $config_dir/miniserv.conf >/dev/null
+grep passwd_mode= $DESTDIR$config_dir/miniserv.conf >/dev/null
if [ "$?" != "0" ]; then
- echo passwd_mode=0 >> $config_dir/miniserv.conf
+ echo passwd_mode=0 >> $DESTDIR$config_dir/miniserv.conf
fi
# If Perl crypt supports MD5, then make it the default
if [ "$md5pass" = "1" ]; then
- echo md5pass=1 >> $config_dir/config
+ echo md5pass=1 >> $DESTDIR$config_dir/config
fi
# Set a special theme if none was set before
if [ "$theme" = "" ]; then
- theme=`cat "$wadir/defaulttheme" 2>/dev/null`
+ theme=`cat "$DESTDIR$wadir/defaulttheme" 2>/dev/null`
fi
-oldthemeline=`grep "^theme=" $config_dir/config`
+oldthemeline=`grep "^theme=" $DESTDIR$config_dir/config`
oldtheme=`echo $oldthemeline | sed -e 's/theme=//g'`
-if [ "$theme" != "" ] && [ "$oldthemeline" = "" ] && [ -d "$wadir/$theme" ]; then
- echo "theme=$theme" >> $config_dir/config
- echo "preroot=$theme" >> $config_dir/miniserv.conf
+if [ "$theme" != "" ] && [ "$oldthemeline" = "" ] && [ -d "$DESTDIR$wadir/$theme" ]; then
+ echo "theme=$theme" >> $DESTDIR$config_dir/config
+ echo "preroot=$theme" >> $DESTDIR$config_dir/miniserv.conf
fi
# Set the product field in the global config
-grep product= $config_dir/config >/dev/null
+grep product= $DESTDIR$config_dir/config >/dev/null
if [ "$?" != "0" ]; then
- echo product=webmin >> $config_dir/config
+ echo product=webmin >> $DESTDIR$config_dir/config
fi
+#I disbled makeboot. If enabled, then $DESTIDIR needs tp be added to this section
if [ "$makeboot" = "1" ]; then
echo "Configuring Webmin to start at boot time.."
(cd "$wadir/init" ; WEBMIN_CONFIG=$config_dir WEBMIN_VAR=$var_dir "$wadir/init/atboot.pl")
@@ -671,8 +732,8 @@
fi
if [ "$nouninstall" = "" ]; then
- echo "Creating uninstall script $config_dir/uninstall.sh .."
- cat >$config_dir/uninstall.sh <<EOF
+ echo "Creating uninstall script $DESTDIR$config_dir/uninstall.sh .."
+ cat >$DESTDIR$config_dir/uninstall.sh <<EOF
#!/bin/sh
printf "Are you sure you want to uninstall Webmin? (y/n) : "
read answer
@@ -688,89 +749,91 @@
echo "Done!"
fi
EOF
- chmod +x $config_dir/uninstall.sh
+ chmod +x $DESTDIR$config_dir/uninstall.sh
echo "..done"
echo ""
fi
echo "Changing ownership and permissions .."
-chown -R root $config_dir
-chgrp -R bin $config_dir
-chmod -R og-rw $config_dir
-chmod 755 $config_dir/{sendmail,qmailadmin,postfix}*/config >/dev/null 2>&1
-chmod 755 $config_dir/{sendmail,qmailadmin,postfix}*/autoreply.pl >/dev/null 2>&1
-chmod 755 $config_dir/{sendmail,qmailadmin,postfix}*/filter.pl >/dev/null 2>&1
-chmod 755 $config_dir/squid*/squid-auth.pl >/dev/null 2>&1
-chmod 755 $config_dir/squid*/users >/dev/null 2>&1
-chmod +r $config_dir/version
+chown -R root $DESTDIR$config_dir
+chgrp -R bin $DESTDIR$config_dir
+chmod -R og-rw $DESTDIR$config_dir
+chmod 755 $DESTDIR$config_dir/{sendmail,qmailadmin,postfix}*/config >/dev/null 2>&1
+chmod 755 $DESTDIR$config_dir/{sendmail,qmailadmin,postfix}*/autoreply.pl >/dev/null 2>&1
+chmod 755 $DESTDIR$config_dir/{sendmail,qmailadmin,postfix}*/filter.pl >/dev/null 2>&1
+chmod 755 $DESTDIR$config_dir/squid*/squid-auth.pl >/dev/null 2>&1
+chmod 755 $DESTDIR$config_dir/squid*/users >/dev/null 2>&1
+chmod +r $DESTDIR$config_dir/version
if [ "$nochown" = "" ]; then
- chown -R root "$wadir"
- chgrp -R bin "$wadir"
- chmod -R og-w "$wadir"
- chmod -R a+rx "$wadir"
-fi
-if [ $var_dir != "/var" ]; then
- chown -R root $var_dir
- chgrp -R bin $var_dir
- chmod -R og-rwx $var_dir
+ chown -R root "$DESTDIR$wadir"
+ chgrp -R bin "$DESTDIR$wadir"
+ chmod -R og-w "$DESTDIR$wadir"
+ chmod -R a+rx "$DESTDIR$wadir"
+fi
+if [ $DESTDIR$var_dir != "/var" ]; then
+ chown -R root $DESTDIR$var_dir
+ chgrp -R bin $DESTDIR$var_dir
+ chmod -R og-rwx $DESTDIR$var_dir
fi
echo "..done"
echo ""
# Save target directory if one was specified
-if [ "$wadir" != "$srcdir" ]; then
- echo $wadir >$config_dir/install-dir
+if [ "$DESTDIR$wadir" != "$srcdir" ]; then
+ echo $wadir >$DESTDIR$config_dir/install-dir
else
- rm -f $config_dir/install-dir
+ rm -f $DESTDIR$config_dir/install-dir
fi
-if [ "$nopostinstall" = "" ]; then
- echo "Running postinstall scripts .."
- (cd "$wadir" ; WEBMIN_CONFIG=$config_dir WEBMIN_VAR=$var_dir "$wadir/run-postinstalls.pl")
- echo "..done"
- echo ""
-fi
+#This is not for now ... this is for in the install-script
+#if [ "$nopostinstall" = "" ]; then
+# echo "Running postinstall scripts .."
+# (cd "$wadir" ; WEBMIN_CONFIG=$config_dir WEBMIN_VAR=$var_dir "$wadir/run-postinstalls.pl")
+# echo "..done"
+# echo ""
+#fi
# Run package-defined post-install script
-if [ -r "$srcdir/setup-post.sh" ]; then
- . "$srcdir/setup-post.sh"
-fi
-
-if [ "$nostart" = "" ]; then
- if [ "$inetd" != "1" ]; then
- echo "Attempting to start Webmin mini web server.."
- $config_dir/start
- if [ $? != "0" ]; then
- echo "ERROR: Failed to start web server!"
- echo ""
- exit 14
- fi
- echo "..done"
- echo ""
- fi
-
- echo "***********************************************************************"
- echo "Webmin has been installed and started successfully. Use your web"
- echo "browser to go to"
- echo ""
- host=`hostname`
- if [ "$ssl" = "1" ]; then
- echo " https://$host:$port/"
- else
- echo " http://$host:$port/"
- fi
- echo ""
- echo "and login with the name and password you entered previously."
- echo ""
- if [ "$ssl" = "1" ]; then
- echo "Because Webmin uses SSL for encryption only, the certificate"
- echo "it uses is not signed by one of the recognized CAs such as"
- echo "Verisign. When you first connect to the Webmin server, your"
- echo "browser will ask you if you want to accept the certificate"
- echo "presented, as it does not recognize the CA. Say yes."
- echo ""
- fi
-fi
+#if [ -r "$srcdir/setup-post.sh" ]; then
+# . "$srcdir/setup-post.sh"
+#fi
+
+#don't start the webserver
+#if [ "$nostart" = "" ]; then
+# if [ "$inetd" != "1" ]; then
+# echo "Attempting to start Webmin mini web server.."
+# $config_dir/start
+# if [ $? != "0" ]; then
+# echo "ERROR: Failed to start web server!"
+# echo ""
+# exit 14
+# fi
+# echo "..done"
+# echo ""
+# fi
+
+# echo "***********************************************************************"
+# echo "Webmin has been installed and started successfully. Use your web"
+# echo "browser to go to"
+# echo ""
+# host=`hostname`
+# if [ "$ssl" = "1" ]; then
+# echo " https://$host:$port/"
+# else
+# echo " http://$host:$port/"
+# fi
+# echo ""
+# echo "and login with the name and password you entered previously."
+# echo ""
+# if [ "$ssl" = "1" ]; then
+# echo "Because Webmin uses SSL for encryption only, the certificate"
+# echo "it uses is not signed by one of the recognized CAs such as"
+# echo "Verisign. When you first connect to the Webmin server, your"
+# echo "browser will ask you if you want to accept the certificate"
+# echo "presented, as it does not recognize the CA. Say yes."
+# echo ""
+# fi
+#fi
if [ "$oldwadir" != "$wadir" -a "$upgrading" = 1 -a "$deletedold" != 1 ]; then
echo "The directory from the previous version of Webmin"
--- copyconfig.pl 2004-12-02 23:17:37.000000000 +0100
+++ copyconfig-new.pl 2004-12-03 01:00:26.000000000 +0100
@@ -9,12 +9,13 @@
$ver = $ARGV[1];
$wadir = $ARGV[2];
$confdir = $ARGV[3];
+$DESTDIR = $ARGV[4];
# Find all clones
-opendir(DIR, $wadir);
+opendir(DIR, $DESTDIR.$wadir);
foreach $f (readdir(DIR)) {
- if (readlink("$wadir/$f")) {
- @st = stat("$wadir/$f");
+ if (readlink("$DESTDIR.$wadir/$f")) {
+ @st = stat("$DESTDIR.$wadir/$f");
push(@{$clone{$st[1]}}, $f);
}
}
@@ -24,7 +25,7 @@
@mods = @ARGV[4..$#ARGV];
foreach $m (@mods) {
# Find any range-number config files
- $srcdir = "$wadir/$m";
+ $srcdir = "$DESTDIR.$wadir/$m";
$rangefile = undef;
opendir(DIR, $srcdir);
while($f = readdir(DIR)) {
Offline