Remove the automounter lookup script from the RPM
[pl_sshd.git] / pl_sshd.spec
1 %define name pl_sshd
2 %define version 1.0
3 %define release 10.planetlab%{?date:.%{date}}
4
5 Vendor: PlanetLab
6 Packager: PlanetLab Central <support@planet-lab.org>
7 Distribution: PlanetLab 3.0
8 URL: http://cvs.planet-lab.org/cvs/pl_sshd
9
10 Summary: SSH server config for PlanetLab
11 Name: %{name}
12 Version: %{version}
13 Release: %{release}
14 Requires: autofs, openssh-server
15 License: GPL
16 Group: System Environment/Base
17 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
18
19 Source0: %{name}-%{version}.tar.bz2
20
21 %description 
22 SSH server configuration for PlanetLab nodes. Configures an automounted
23 directory as source for authorized_keys files and points sshd to that
24 directory.
25
26 %prep
27 %setup
28
29 %build
30
31
32 %install
33 mkdir -p $RPM_BUILD_ROOT/var/pl_sshd/keys
34 install -D -m 0755 pl_sshd.sh $RPM_BUILD_ROOT/usr/local/sbin/pl_sshd
35 install -D -m 0755 pl_sshd $RPM_BUILD_ROOT/etc/init.d/pl_sshd
36
37 %clean
38 rm -rf $RPM_BUILD_ROOT
39
40 %files
41 %defattr(-,root,root)
42 %dir /var/pl_sshd/keys
43 %attr(0755,root,root) /usr/local/sbin/pl_sshd
44 %attr(0755,root,root) /etc/init.d/pl_sshd
45
46 %pre
47
48
49 %post
50 # 1 = install, 2 = upgrade/reinstall
51 if [ $1 -ge 1 ]; then
52     # link sshd pam config to pl_sshd so that we can actually login
53     pam_pl_sshd=/etc/pam.d/pl_sshd
54     [ -r $pam_pl_sshd ] || ln -s sshd $pam_pl_sshd
55
56     chkconfig --add pl_sshd
57
58     if [ "$1" -gt "1" ]; then  # upgrading
59         #
60         # remove funky config options for sshd (so that when we restart
61         # things will operate normally i.e., without automount magic)
62         #
63         rm -f /etc/sysconfig/sshd
64
65         #
66         # stop automounter, remove entry from auto.master, restart if
67         # necessary
68         #
69         [ "$PL_BOOTCD" != "1" ] && /etc/init.d/autofs stop
70         auto_master=/etc/auto.master
71         mv $auto_master $auto_master.pl_sshd.post
72         sed -e '\,^/var/pl_sshd/keys,d' $auto_master.pl_sshd.post \
73             >$auto_master
74
75         [ "$PL_BOOTCD" != "1" ] && /etc/init.d/autofs start
76     fi
77
78     if [[ "$PL_BOOTCD" != "1" ]]; then
79         #
80         # don't try to start/restart various things automatically,
81         # it's too ugly (particularly if we're upgrading while
82         # connected over ssh)
83         #
84         echo
85         echo "You need to manually restart autofs and sshd, and"
86         echo "start the pl_sshd (ssh on port 806) service."
87         echo "Make sure you know what you're doing, particularly"
88         echo "if you're making this change over an ssh connection."
89         echo
90     fi
91 fi
92
93 %preun
94 # 0 = erase, 1 = upgrade
95 if [ $1 -eq 0 ]; then
96         #
97         # stop pl_sshd, remove it from rcX.d init dirs, remove link
98         # to sshd's pam config
99         #
100         [ "$PL_BOOTCD" = "1" ] || /etc/init.d/pl_sshd stop || :
101         chkconfig --del pl_sshd
102         rm -f /etc/pam.d/pl_sshd
103 fi
104
105
106 %postun
107
108
109 %changelog
110 * Wed Nov  2 2005 Steve Muir <smuir@cs.princeton.edu>
111 - don't fanny around using the automounter to access ssh keys in vservers,
112   pl_conf now writes them into the normal locations
113
114 * Wed Oct 12 2005 Steve Muir <smuir@cs.princeton.edu>
115 - fix pl_sshd script name and argv[0] to satisfy re-exec requirements
116
117 * Thu Apr  7 2005 Steve Muir <smuir@cs.princeton.edu>
118 - convert auto.pl_sshd to a python script (simpler and less error-prone)
119
120 * Mon Dec  1 2003 Steve Muir <smuir@cs.princeton.edu>
121 - initial creation from files in sidewinder repository
122