Test3
[autosshd_ALT/autosshd_imz.git] / autosshd.spec
blob7a7b19c53ac8f3f0d39cc58839a75c83f62968eb
1 # vim: set ft=spec : -*- rpm-spec -*-
2 %define autossh_user _autossh
3 %define autossh_group _autossh
5 Name: autosshd
6 Version: 0.0.1
7 Release: alt3
9 Summary: System administration - AutoSSH system level service
10 Group: System/Servers
11 License: GPL
12 Url: http://etersoft.ru
13 Source: %name.tar
15 Packager: Dmitriy Kruglikov <dkr@altlinux.ru>
17 BuildArch: noarch
19 PreReq: pwgen shadow-utils openssh-common
21 Requires: autossh
23 %description
24 Run autossh as system service at startup
27 %prep
28 %setup -n autosshd
30 %install
31 mkdir -p %buildroot%_initdir
32 mkdir -p %buildroot%_sysconfdir/sysconfig
33 mkdir -p %buildroot/var/run/autosshd
34 mkdir -p %buildroot/var/lib/autosshd/.ssh
35 mkdir -p %buildroot%_docdir/autosshd
36 install -D -m644 doc/README %buildroot%_docdir/autosshd/README
37 install -D -m750 etc/rc.d/init.d/autosshd %buildroot%_initdir/autosshd
38 install -D -m644 etc/sysconfig/autosshd %buildroot%_sysconfdir/sysconfig/autosshd
41 %pre
42 if ! [ -f /var/lib/autosshd/.ssh/id_dsa ]; then
43 # Add the "_autossh" user
44 %_sbindir/groupadd -r -f %autossh_group 2>/dev/null ||:
45 %_sbindir/useradd -r -g %autossh_group -c 'Autossh daemon' \
46 -s /dev/null -d /var/lib/autosshd %autossh_user 2>/dev/null ||:
47 %_sbindir/usermod -p `pwgen -s 24 1` %autossh_user
48 mkdir -p /var/lib/autosshd/.ssh
49 /usr/bin/ssh-keygen -t dsa -b 1024 -C "AutoSSH daemon" -N "" -q -f /var/lib/autosshd/.ssh/id_dsa
50 echo "StrictHostKeyChecking no" > /var/lib/autosshd/.ssh/config
51 cp /var/lib/autosshd/.ssh/id_dsa.pub /var/lib/autosshd/.ssh/authorized_keys
52 chown -R %autossh_user:%autossh_group /var/lib/autosshd/
53 chown %autossh_user:%autossh_group /var/run/autosshd/
56 %post
57 %post_service %name
59 %preun
60 %preun_service %name
62 %files
63 %_initdir/*
64 %config(noreplace) %_sysconfdir/sysconfig/autosshd
65 %dir /var/lib/autosshd
66 %dir /var/run/autosshd
67 %dir %_docdir/autosshd
68 %_docdir/autosshd/*
69 %attr(0644,root,root) %_docdir/autosshd/README
71 %changelog
72 * Tue Apr 03 2012 Dmitriy Kruglikov <dkr@altlinux.org> 0.0.1-alt3
73 - Fixes
75 * Tue Apr 03 2012 Dmitriy Kruglikov <dkr@altlinux.org> 0.0.1-alt2
76 - Ready for testing
78 * Mon Apr 02 2012 Dmitriy Kruglikov <dkr@altlinux.org> 0.0.1-alt1
79 - Initial draft