Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > b096a6d9ad5888962397267257b640b1 > files > 4

usermin-0.980-1mdk.src.rpm

%define __spec_install_post %{nil}

%define	name	usermin
%define	version	0.980
%define	release 1mdk

Summary:	A web-based user account administration interface
Name:		usermin
Version:	%{version}
Release:	%{release}
Provides:	%{name}-%{version}
Requires:	/bin/sh /usr/bin/perl
Requires:	perl perl-Net_SSLeay 
License:	BSD
Group:		System/Configuration/Other
URL:		http://www.webmin.com/index6.html
Source:		http://www.webmin.com/download/%{name}-%{version}.tar.bz2

Patch1:		usermin-0.980-init-with-reload.diff.bz2
Patch2:		usermin-0.980-os_list.diff.bz2

BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildArch:	noarch

%description
A web-based user account administration interface for Unix systems.

After installation, enter the URL https://localhost:20000/ into your
browser and login as any user on your system.

%prep
%setup -q
%patch1 -p 0 -b .init
%patch2 -p 1 -b .os_list

%build
(find . -name '*.cgi' ; find . -name '*.pl') | perl perlpath.pl %{_bindir}/perl -
rm -f mount/freebsd-mounts-*
rm -f mount/openbsd-mounts-*
#chmod -R og-rxw .

%install
mkdir -p %{buildroot}{%{_sysconfdir}/{pam.d,sysconfig},%{_initrddir},%{_var}/run/usermin,%{_datadir}/usermin}

cp -rp * %{buildroot}%{_datadir}/usermin

cp usermin-daemon %{buildroot}%{_sysconfdir}/sysconfig/usermin
cp usermin-init %{buildroot}%{_initrddir}/usermin
cp usermin-pam %{buildroot}%{_sysconfdir}/pam.d/usermin

# Fix perms for rpmlint:
find %{buildroot}%{_datadir}/usermin ! -type d -exec chmod 644 {} \;

find %{buildroot}%{_datadir}/usermin \( \
	-type d \
	-o -name "*.sh" -o -name "*.cgi" \
	-o -name "install-module.pl" -o -name "web-lib.pl" \
	-o -name "miniserv.pl" -o -name "newmods.pl" \
	-o -name "cron_editor.pl" -o -name "autoreply.pl" \
	-o -name "theme.pl" -o -name "solaris-lib.pl" \
	-o -name "unixware-lib.pl" \
	-o -name "msctile2.jpg" -o -name "theme_by.jpg" \
	-o -name "webmin_logo.jpg" \
	\) \
	-exec chmod 755 {} \;

echo rpm >%{buildroot}%{_datadir}/usermin/install-type

%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}

%pre
perl <<EOD;
# maketemp.pl
# Create the /tmp/.webmin directory if needed
# ASkwar:
# This really needs to be /tmp/.webmin, because of (at least) the setup.sh
# script

\$tmp_dir = "/tmp/.webmin";

if (!-d \$tmp_dir) {
	mkdir(\$tmp_dir, 0755) || exit 1;
	chown(\$<, \$(, \$tmp_dir);
	chmod(0755, \$tmp_dir);
	}
@st = stat(\$tmp_dir);
if (@st && \$st[4] == \$< && \$st[5] == \$( && \$st[2] & 0x4000 &&
    (\$st[2] & 0777) == 0755) {
	exit 0;
	}
else {
	exit 1;
	}


EOD
if [ "$?" != "0" ]; then
	echo "Failed to create or check temp files directory /tmp/.webmin"
	exit 1
fi
perl >/tmp/$$.check <<EOD;
if (-r "/etc/.issue") {
	\$etc_issue = \`cat /etc/.issue\`;
	}
elsif (-r "/etc/issue") {
	\$etc_issue = \`cat /etc/issue\`;
	}
\$uname = \`uname -a\`;

if (\$etc_issue =~ /Mandrake\\s+release\\s+5\\.3/i) {
	print "oscheck='Mandrake Linux 5.3'\\n";
	}
if (\$etc_issue =~ /Mandrake\\s+release\\s+6\\.0/i) {
	print "oscheck='Mandrake Linux 6.0'\\n";
	}
if (\$etc_issue =~ /Mandrake\\s+release\\s+6\\.1/i) {
	print "oscheck='Mandrake Linux 6.1'\\n";
	}
if (\$etc_issue =~ /Mandrake\\s+release\\s+7\\.0/i) {
	print "oscheck='Mandrake Linux 7.0'\\n";
	}
if (\$etc_issue =~ /Mandrake\\s+release\\s+7\\.1/i) {
	print "oscheck='Mandrake Linux 7.1'\\n";
	}
if (\$etc_issue =~ /Mandrake\\s+release\\s+7\\.2/i) {
	print "oscheck='Mandrake Linux 7.2'\\n";
	}
if (\`cat /etc/mandrake-release 2>&1\` =~ /8\\.0/ || \$etc_issue =~ /Mandrake\\s+release\\s+8\\.0/i) {
	print "oscheck='Mandrake Linux 8.0'\\n";
	}
if (\`cat /etc/mandrake-release 2>&1\` =~ /8\\.1/ || \$etc_issue =~ /Mandrake\\s+Linux\\s+release\\s+8\\.1/i) {
	print "oscheck='Mandrake Linux 8.1'\\n";
	}
if (\`cat /etc/mandrake-release 2>&1\` =~ /8\\.2/ || \$etc_issue =~ /Mandrake\\s+Linux\\s+release\\s+8\\.2/i) {
	print "oscheck='Mandrake Linux 8.2'\\n";
	}
if (\`cat /etc/mandrake-release 2>&1\` =~ /8\\.3/ || \$etc_issue =~ /Mandrake\\s+Linux\\s+release\\s+8\\.3/i) {
	print "oscheck='Mandrake Linux 8.2'\\n";
	}
if (\`cat /etc/mandrake-release 2>&1\` =~ /9\\.0/ || \$etc_issue =~ /Mandrake\\s+Linux\\s+release\\s+9\\.0/i) {
	print "oscheck='Mandrake Linux 9.0'\\n";
	}
if (\`cat /etc/mandrake-release 2>&1\` =~ /9\\.1/ || \$etc_issue =~ /Mandrake\\s+Linux\\s+release\\s+9\\.1/i) {
	print "oscheck='Mandrake Linux 9.1'\\n";
	}
if (\$etc_issue =~ /Mandrake\\s+Corporate\\s+Server\\s+release\\s+1\\.0/i) {
	print "oscheck='Mandrake Linux Corporate Server 1.0'\\n";
	}

EOD
. /tmp/$$.check
rm -f /tmp/$$.check
if [ ! -r %{_sysconfdir}/usermin/config ]; then
	if [ "$oscheck" = "" ]; then
		echo Unabled to identify operating system
		exit 2
	fi
	#echo Operating system is $oscheck
fi

%post
if [ "$1" != 1 ]; then
	# Upgrading the RPM, so stop the old usermin properly
	service usermin stop
fi
cd %{_datadir}/usermin
config_dir=%{_sysconfdir}/usermin
var_dir=%{_var}/run/usermin
perl=%{_bindir}/perl
autoos=1
port=20000
host=`hostname`
ssl=1
atboot=1
nochown=1
autothird=1
noperlpath=1
nouninstall=1
nostart=1
export config_dir var_dir perl autoos port host ssl nochown autothird noperlpath nouninstall nostart allow
./setup.sh > /tmp/usermin-setup.out 2>&1

rm -f %{_var}/lock/subsys/usermin
service usermin start

cat > %{_sysconfdir}/usermin/uninstall.sh <<EOFF
#!/bin/sh
printf "Are you sure you want to uninstall Usermin? (y/n) : "
read answer
printf "\n"
if [ "\$answer" = "y" ]; then
	echo "Removing usermin RPM .."
	#rpm -e --nodeps usermin
	urpme usermin
	echo "Done!"
fi
EOFF
chmod +x %{_sysconfdir}/usermin/uninstall.sh
echo "Usermin install complete. You can now login to https://$host:20000/"
echo "as any user on your system."

%_post_service usermin

%preun
%_preun_service usermin

%postun
if [ "$1" = 0 ]; then
	grep root=%{_datadir}/usermin %{_sysconfdir}/usermin/miniserv.conf >/dev/null 2>&1
	if [ "$?" = 0 ]; then
		# RPM is being removed, and no new version of usermin
		# has taken it's place. Delete the config files
		rm -rf %{_sysconfdir}/usermin %{_var}/usermin
	fi
fi

%files
%defattr(-,root,root)
%doc LICENCE* README
#%{_libexecdir}/usermin
%{_datadir}/usermin
%config(noreplace) %{_sysconfdir}/sysconfig/usermin
%config(noreplace) %{_sysconfdir}/pam.d/usermin
%config(noreplace) %{_initrddir}/usermin

%changelog
* Sat Dec 28 2002 Alexander Skwar <ASkwar@DigitalProjects.com> 0.980-1mdk
- 0.980

* Sun Sep  8 2002 Alexander Skwar <ASkwar@DigitalProjects.com> 0.940-1mdk
- 0.940
- Updated os checks for Mandrake 9.0 and removed check for non-existant 8.3

* Thu Jun  6 2002 Alexander Skwar <ASkwar@DigitalProjects.com> 0.920-1mdk
- First Mandrake relase