- check $PL_BOOTCD instead of $RUNLEVEL
[pl_sshd.git] / pl_sshd.spec
index deb6d34..734d30d 100644 (file)
@@ -1,11 +1,11 @@
 %define name pl_sshd
 %define version 1.0
 %define name pl_sshd
 %define version 1.0
-%define release 4.planetlab%{?date:.%{date}}
+%define release 8.planetlab%{?date:.%{date}}
 
 Vendor: PlanetLab
 Packager: PlanetLab Central <support@planet-lab.org>
 Distribution: PlanetLab 3.0
 
 Vendor: PlanetLab
 Packager: PlanetLab Central <support@planet-lab.org>
 Distribution: PlanetLab 3.0
-URL: http://www.planet-lab.org
+URL: http://cvs.planet-lab.org/cvs/pl_sshd
 
 Summary: SSH server config for PlanetLab
 Name: %{name}
 
 Summary: SSH server config for PlanetLab
 Name: %{name}
@@ -33,7 +33,7 @@ directory.
 mkdir -p $RPM_BUILD_ROOT/var/pl_sshd/keys
 install -D -m 0755 pl_sshd.sh $RPM_BUILD_ROOT/usr/local/sbin/pl_sshd.sh
 install -D -m 0755 pl_sshd $RPM_BUILD_ROOT/etc/init.d/pl_sshd
 mkdir -p $RPM_BUILD_ROOT/var/pl_sshd/keys
 install -D -m 0755 pl_sshd.sh $RPM_BUILD_ROOT/usr/local/sbin/pl_sshd.sh
 install -D -m 0755 pl_sshd $RPM_BUILD_ROOT/etc/init.d/pl_sshd
-install -D -m 0755 auto.pl_sshd $RPM_BUILD_ROOT/etc/auto.pl_sshd
+install -D -m 0755 auto.pl_sshd.py $RPM_BUILD_ROOT/etc/auto.pl_sshd
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -49,8 +49,6 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %post
 
 
 %post
-RUNLEVEL=`/sbin/runlevel`
-
 # 1 = install, 2 = upgrade/reinstall
 if [ $1 -ge 1 ]; then
     # create the magic directory for automount
 # 1 = install, 2 = upgrade/reinstall
 if [ $1 -ge 1 ]; then
     # create the magic directory for automount
@@ -78,7 +76,7 @@ if [ $1 -ge 1 ]; then
 
     chkconfig --add pl_sshd
 
 
     chkconfig --add pl_sshd
 
-    if [[ "$RUNLEVEL" != "unknown" ]]; then
+    if [[ "$PL_BOOTCD" != "1" ]]; then
        #
        # don't try to start/restart various things automatically,
        # it's too ugly (particularly if we're upgrading while
        #
        # don't try to start/restart various things automatically,
        # it's too ugly (particularly if we're upgrading while
@@ -94,15 +92,13 @@ if [ $1 -ge 1 ]; then
 fi
 
 %preun
 fi
 
 %preun
-RUNLEVEL=`/sbin/runlevel`
-
 # 0 = erase, 1 = upgrade
 if [ $1 -eq 0 ]; then
        #
        # stop pl_sshd, remove it from rcX.d init dirs, remove link
        # to sshd's pam config
        #
 # 0 = erase, 1 = upgrade
 if [ $1 -eq 0 ]; then
        #
        # stop pl_sshd, remove it from rcX.d init dirs, remove link
        # to sshd's pam config
        #
-       [ "$RUNLEVEL" = "unknown" ] || /etc/init.d/pl_sshd stop || :
+       [ "$PL_BOOTCD" = "1" ] || /etc/init.d/pl_sshd stop || :
        chkconfig --del pl_sshd
        rm -f /etc/pam.d/pl_sshd
 
        chkconfig --del pl_sshd
        rm -f /etc/pam.d/pl_sshd
 
@@ -111,7 +107,7 @@ if [ $1 -eq 0 ]; then
        # things will operate normally i.e., without automount magic)
        #
        rm /etc/sysconfig/sshd
        # things will operate normally i.e., without automount magic)
        #
        rm /etc/sysconfig/sshd
-       if [ "$RUNLEVEL" != "unknown" ]; then
+       if [ "$PL_BOOTCD" != "1" ]; then
            echo
            echo "You need to manually restart sshd."
            echo "Make sure you know what you're doing, particularly"
            echo
            echo "You need to manually restart sshd."
            echo "Make sure you know what you're doing, particularly"
@@ -123,13 +119,13 @@ if [ $1 -eq 0 ]; then
        # stop automounter, remove entry from auto.master, restart if
        # necessary
        #
        # stop automounter, remove entry from auto.master, restart if
        # necessary
        #
-       [ "$RUNLEVEL" != "unknown" ] && /etc/init.d/autofs stop
+       [ "$PL_BOOTCD" != "1" ] && /etc/init.d/autofs stop
        auto_master=/etc/auto.master
        mv $auto_master $auto_master.pl_sshd.preun
        sed -e '\,^/var/pl_sshd/keys,d' $auto_master.pl_sshd.preun \
            >$auto_master
 
        auto_master=/etc/auto.master
        mv $auto_master $auto_master.pl_sshd.preun
        sed -e '\,^/var/pl_sshd/keys,d' $auto_master.pl_sshd.preun \
            >$auto_master
 
-       [ "$RUNLEVEL" != "unknown" ] && /etc/init.d/autofs start
+       [ "$PL_BOOTCD" != "1" ] && /etc/init.d/autofs start
 fi
 
 
 fi
 
 
@@ -137,6 +133,9 @@ fi
 
 
 %changelog
 
 
 %changelog
+* Thu Apr  7 2005 Steve Muir <smuir@cs.princeton.edu>
+- convert auto.pl_sshd to a python script (simpler and less error-prone)
+
 * Mon Dec  1 2003 Steve Muir <smuir@cs.princeton.edu>
 - initial creation from files in sidewinder repository
 
 * Mon Dec  1 2003 Steve Muir <smuir@cs.princeton.edu>
 - initial creation from files in sidewinder repository