/[fai]/trunk/debian/postinst
ViewVC logotype

Contents of /trunk/debian/postinst

Parent Directory Parent Directory | Revision Log Revision Log


Revision 135 - (show annotations) (download)
Fri Nov 3 13:17:52 2000 UTC (12 years, 6 months ago) by lange
File size: 3238 byte(s)
remove usr/local directory
1 #! /bin/sh
2
3 # $Id $
4 #*********************************************************************
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 set -e
14
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 . /etc/fai.conf
33
34 test -f /etc/init.d/nfs-server && nfsserver=nfs-server
35 test -f /etc/init.d/nfs-kernel-server && nfsserver=nfs-kernel-server
36
37 add_export_line() {
38
39 # add a line to /etc/exports
40
41 pattern=$1
42 shift
43 options=$*
44
45 [ -f /etc/exports ] && grep -q "^$pattern[[:space:]]" /etc/exports && return
46 echo "$pattern $options" >> /etc/exports
47 /etc/init.d/$nfsserver start >/dev/null
48 /etc/init.d/$nfsserver reload >/dev/null
49 }
50
51 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 -ng $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 case "$1" in
69 configure)
70
71 add_fai_account >/dev/null
72
73 MYTMPFILE=`mktemp /tmp/make-fai-nfsroot.XXXXXX`
74
75 echo Creating FAI nfsroot can take a long time
76 make-fai-nfsroot > $MYTMPFILE 2>&1
77
78 mkdir -p /usr/local/share/fai || true
79
80 add_export_line /usr/local/share/fai "@faiclients(ro)"
81 add_export_line $NFSROOT "@faiclients(ro,no_root_squash)"
82 add_export_line /usr "@faiclients(ro,no_root_squash)"
83
84 if [ ! -d /usr/local/share/fai/fai_config ];then
85 echo "You have no fai configuration. Copy FAI template files with:"
86 echo "cp -pR /usr/share/doc/fai/templates/* /usr/local/share/fai"
87 echo "Then change the configuration files to meet your local needs."
88 fi
89
90 ;;
91
92 abort-upgrade|abort-remove|abort-deconfigure)
93
94 ;;
95
96 *)
97 echo "postinst called with unknown argument \`$1'" >&2
98 exit 0
99 ;;
100 esac
101
102 # dh_installdeb will replace this with shell code automatically
103 # generated by other debhelper scripts.
104
105 #DEBHELPER#
106
107 exit 0

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.5