/[fai]/trunk/debian/fai-server.postinst
ViewVC logotype

Contents of /trunk/debian/fai-server.postinst

Parent Directory Parent Directory | Revision Log Revision Log


Revision 97 - (hide annotations) (download)
Tue Oct 24 09:24:10 2000 UTC (12 years, 7 months ago) by lange
Original Path: trunk/debian/postinst
File size: 3156 byte(s)
if user LOGUSER exists, do not create this account
1 lange 2 #! /bin/sh
2 lange 7
3     # $Id $
4 lange 2 #*********************************************************************
5     # postinst -- setup fai
6     #
7     # This script is part of FAI (Fully Automatic Installation)
8     # Copyright (c) 2000 by Thomas Lange, Universitaet zu Koeln
9     #*********************************************************************
10     #
11     # see: dh_installdeb(1)
12    
13 lange 97 set -e
14 lange 2
15     # summary of how this script can be called:
16     # * <postinst> `configure' <most-recently-configured-version>
17     # * <old-postinst> `abort-upgrade' <new version>
18     # * <conflictor's-postinst> `abort-remove' `in-favour' <package>
19     # <new-version>
20     # * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
21     # <failed-install-package> <version> `removing'
22     # <conflicting-package> <version>
23     # for details, see /usr/doc/packaging-manual/
24     #
25     # quoting from the policy:
26     # Any necessary prompting should almost always be confined to the
27     # post-installation script, and should be protected with a conditional
28     # so that unnecessary prompting doesn't happen if a package's
29     # installation fails and the `postinst' is called with `abort-upgrade',
30     # `abort-remove' or `abort-deconfigure'.
31    
32 lange 97 . /etc/fai.conf
33    
34 lange 75 test -f /etc/init.d/nfs-server && nfsserver=nfs-server
35     test -f /etc/init.d/nfs-kernel-server && nfsserver=nfs-kernel-server
36 lange 2
37     add_export_line() {
38    
39 lange 97 # add a line to /etc/exports
40 lange 2
41     pattern=$1
42     shift
43     options=$*
44    
45 lange 97 [ -f /etc/exports ] && grep -q "^$pattern[[:space:]]" /etc/exports && return
46 lange 2 echo "$pattern $options" >> /etc/exports
47 lange 97 /etc/init.d/$nfsserver start >/dev/null
48     /etc/init.d/$nfsserver reload >/dev/null
49 lange 2 }
50    
51 lange 97 add_fai_account() {
52    
53     if id $LOGUSER 2>/dev/null 1>&2 ; then
54     echo Account \$LOGUSER=$LOGUSER already exists.
55     echo Make sure, that all install clients can
56     echo log into this account without a password
57     else
58     adduser --system --disabled-password --gecos "fai account for log files" $LOGUSER || true
59     gid=`id -g $LOGUSER`
60     perl -pi.bak -e "s#^$LOGUSER:(.+):/bin/false#$LOGUSER:\1:/bin/bash#" /etc/passwd
61     echo "+@faiclients root" > /home/$LOGUSER/.rhosts
62     chown $LOGUSER:$gid /home/$LOGUSER/.rhosts
63     chmod go-rwx /home/$LOGUSER/.rhosts
64     touch /home/$LOGUSER/.account_created_by_fai_package
65     fi
66     }
67    
68 lange 2 case "$1" in
69     configure)
70    
71 lange 97 add_fai_account >/dev/null
72 lange 75
73 lange 97 echo Creating FAI nfsroot can take a long time
74     make-fai-nfsroot > /tmp/make-fai-nfsroot.log 2>&1
75 lange 75
76 lange 97 add_export_line /usr/local/share/fai "@faiclients(ro)"
77     add_export_line $NFSROOT "@faiclients(ro,no_root_squash)"
78     add_export_line /usr "@faiclients(ro,no_root_squash)"
79 lange 2
80 lange 97 if [ ! -d /usr/local/share/fai/fai_config ];then
81     echo "You have no fai configuration. Copy FAI template files with:"
82     echo "cp -pR /usr/share/doc/fai/templates/* /usr/local/share/fai"
83     echo "Then change the configuration files to meet your local needs."
84     fi
85 lange 2
86     ;;
87    
88     abort-upgrade|abort-remove|abort-deconfigure)
89    
90     ;;
91    
92     *)
93     echo "postinst called with unknown argument \`$1'" >&2
94     exit 0
95     ;;
96     esac
97    
98     # dh_installdeb will replace this with shell code automatically
99     # generated by other debhelper scripts.
100    
101     #DEBHELPER#
102    
103     exit 0

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.5