-if [ "$1" -ge 1 ]; then
- # create the magic directory for automount
- keydir=/var/pl_sshd/keys
- [ -d $keydir ] || mkdir -p $keydir
-
- # add appropriate entry to auto.master
- auto_master=/etc/auto.master
- auto_master_entry="$keydir /etc/auto.pl_sshd"
- grep -qF "$auto_master_entry" $auto_master || \
- echo $auto_master_entry >>$auto_master
-
+# 1 = install, 2 = upgrade/reinstall
+if [ $1 -ge 1 ]; then
+ # create the magic directory for automount
+ keydir=/var/pl_sshd/keys
+
+ # add appropriate entry to auto.master
+ auto_master=/etc/auto.master
+ auto_master_entry="$keydir /etc/auto.pl_sshd"
+ grep -qF "$auto_master_entry" $auto_master || \
+ echo $auto_master_entry >>$auto_master
+
+ #
+ # use the sysconfig file to tell our system sshd to look in the
+ # magic location for authorized_keys files
+ #
+ sysconfig_sshd=/etc/sysconfig/sshd
+ [ -r $sysconfig_sshd ] && \
+ mv $sysconfig_sshd $sysconfig_sshd.pl_sshd
+ echo "OPTIONS='-o \"AuthorizedKeysFile $keydir/%u/authorized_keys\"'" \
+ >$sysconfig_sshd
+
+ # link sshd pam config to pl_sshd so that we can actually login
+ pam_pl_sshd=/etc/pam.d/pl_sshd
+ [ -r $pam_pl_sshd ] || ln -s sshd $pam_pl_sshd
+
+ chkconfig --add pl_sshd
+
+ if [[ "$RUNLEVEL" != "unknown" ]]; then