Debian Codegraph @

sbin/drbl-3n-conf

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 # Author: Steven Shiau <steven _at_ clonezilla org>
3 # License: GPL
4 #
5 # set the NFS, NIS, NAT config for DRBL clients to access
6
7 # Load DRBL setting and functions
8 DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}"
9
10 . $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
11
12 #
13 check_if_root
14
15 # main
16 usagescip-shell shell shell-project 0.0.0 usage().() {
17 echoscip-shell system . . echo. "To generate or clean NFS, NIS and NAT setting for DRBL clients to access"
18 echoscip-shell system . . echo. "Usage: $0 [Options] {generate|clean}"
19 echoscip-shell system . . echo. "Options:"
20 echoscip-shell system . . echo. "-a, --all-subnet: All subnet can access to this NFS/NIS/NAT server."
21 echoscip-shell system . . echo. "-n, --no-restart: Do not restart NFS/NIS services (except NAT, i.e. NAT will always be restarted)"
22 echoscip-shell system . . echo. "-v, --verbose: Verbose mode."
23 echoscip-shell system . . echo. "Example: To generate NFS, NIS and NAT setting for DRBL clients to access"
24 echoscip-shell system . . echo. "$0 generate"
25 }
26
27 # default setting
28 all_subnet="no"
29 restart_srv="yes"
30
31 while [scip-shell system . . `[`. $# -gt 0 ]; do
32 case "$1" in
33 -a|--all-subnet)
34 all_subnet="yes"
35 shift;;
36 -n|--no-restart)
37 restart_srv="no"
38 shift;;
39 -v|--verbose)
40 shift; verbose="on"
41 ;;
42 -*) echoscip-shell system . . echo. "${0}: ${1}: invalid option" >&2
43 usagescip-shell shell shell-project 0.0.0 usage(). >& 2
44 exit 2 ;;
45 *) break ;;
46 esac
47 done
48 switch=$1
49
50 [scip-shell system . . `[`. -z "$switch" ] && usagescip-shell shell shell-project 0.0.0 usage(). && exit 1
51 ask_and_load_lang_set en
52
53 [scip-shell system . . `[`. "$all_subnet" = "yes" ] && SUBNET_OPT="--all-subnet"
54 [scip-shell system . . `[`. "$restart_srv" = "no" ] && RESTART_OPT="--no-restart"
55 # load the preset mode
56 [scip-shell system . . `[`. -f "/etc/drbl/drbl_deploy.confscip-shell filesystem . . `/etc/drbl/drbl_deploy.conf`." ] && . /etc/drbl/drbl_deploy.confscip-shell source . . `/etc/drbl/drbl_deploy.conf`.
57 if [scip-shell system . . `[`. "$drbl_mode" != "drbl_ssi_mode" ]; then
58 [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
59 echoscip-shell system . . echo. "$msg_not_in_SSI_mode"
60 [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
61 echoscip-shell system . . echo. "$msg_program_stop"
62 exit 1
63 fi
64
65 # update /etc/hosts
66 drbl-etc-hosts
67 # Update the /etc/hosts in clients
68 # Find the template client
69 for ih in $drblroot/*; do
70 # use the 1st one drbl client we found as template
71 if [scip-shell system . . `[`. -d "$ih" ]; then
72 template="$ih"
73 break
74 fi
75 done
76 cpscip-shell system . . cp. -f /etc/hostsscip-shell filesystem . . `/etc/hosts`. $drbl_common_root/etc/hosts
77 cpscip-shell system . . cp. -f /etc/hostsscip-shell filesystem . . `/etc/hosts`. $template/etc/hosts
78
79 case "$switch" in
80 "generate")
81 drbl-nfs-exports $SUBNET_OPT $RESTART_OPT generate
82 echoscip-shell system . . echo. "$msg_delimiter_star_line"
83 drbl-yp-securenets $SUBNET_OPT $RESTART_OPT generate
84 echoscip-shell system . . echo. "$msg_delimiter_star_line"
85 drbl-nat-rules $SUBNET_OPT generate
86 echoscip-shell system . . echo. "done!"
87 ;;
88 "clean")
89 drbl-nfs-exports clean
90 echoscip-shell system . . echo. "$msg_delimiter_star_line"
91 drbl-yp-securenets clean
92 echoscip-shell system . . echo. "$msg_delimiter_star_line"
93 drbl-nat-rules clean
94 echoscip-shell system . . echo. "done!"
95 ;;
96 *)
97 usagescip-shell shell shell-project 0.0.0 usage().
98 exit 1
99 ;;
100 esac