-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate-config.sh
105 lines (98 loc) · 2.62 KB
/
update-config.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#
# The routines within this file are designed for use with the
# Voyage Linux Distribution, and may be freely copied under the
# terms given in file 'License'.
#
# Copyright (C) 2006 William Brack <[email protected]>
#
#
# We define some functions to make the mainline code cleaner
#
# Function update_modules
# Uses VOYAGE_SYSTEM_MODULES to generate a list of modules to
# be loaded during system boot
# Params: $1 - root directory of target
#
update_modules() {
local saveifs modname buildlist
saveifs=$IFS
IFS=";"
buildlist="
#
# These lines generated automatically by `basename $0`
# on `date`
#
"
for modname in $VOYAGE_SYSTEM_MODULES; do
rmspace=`echo $modname | sed -e "s/^ *//"`
buildlist="$buildlist\n$rmspace"
done
IFS=$saveifs
echo -e "$buildlist" >> $1/etc/modules
}
#
# Function update_inittab()
# Modifies /etc/inittab to take account of whether or not
# there is a serial console
# Params: $1 - location of the root directory for input file
# $2 - location of the root directory for the result
# Result:
#
update_inittab() {
if [ $VOYAGE_SYSTEM_CONSOLE == serial ]; then
cmd1="/^[0-9]:/ s/^/#/"
cmd2="s/^#T0:/T0:/;s/ttyS0 .*00/ttyS0 ${VOYAGE_SYSTEM_SERIAL}/"
else
cmd1="/^#[0-9]:/ s/^#//"
cmd2="s/^T0:/#T0:/"
fi
cat $1/etc/inittab | sed -e "$cmd1" | sed -e "$cmd2" > \
$2/etc/inittab
}
#
# Function update_pcmcia()
# Sets the target system to take account of whether or not
# there is pcmcia hardware present
# Params: $1 - root directory of target
#
update_pcmcia() {
check_yn $VOYAGE_SYSTEM_PCMCIA
if [ $? -le 0 ]; then
echo "Removing pcmcia from update-rc.d" >&2
chroot $1 update-rc.d -f pcmcia remove >&2
fi
}
#
# Function remove_dnsmasq_pxe()
# Remove line containing dnsmasq.pxe.conf in /etc/dnsmasq.more.conf
# Params: $1 - root directory of target
#
remove_dnsmasq_pxe() {
if [ -n $1 ] && [ -f $1/etc/dnsmasq.more.conf ] ; then
sed -i "$1/etc/dnsmasq.more.conf" -e "/dnsmasq.pxe.conf/ D" >&2
echo "Removing dnsmasq.pxe.conf in /etc/dnsmasq.more.conf" >&2
fi
}
#
# Function reconfig_resolvconf()
# reconfigure resolvconf package
# Params: $1 - root directory of target
#
reconfig_resolvconf() {
PKG=$(cat $1/voyage.dpkg.list |grep resolvconf)
if [ ! -z "$PKG" ] ; then
echo "Reconfiguring resolvconf"
chroot $1 sh -c "DEBIAN_FRONTEND=noninteractive dpkg-reconfigure resolvconf"
fi
}
#
# Function reconfig_ntp()
# reconfigure ntp configuration files
# Params: $1 - root directory of target
#
reconfig_ntp() {
if [ -f $1/etc/ntp.pool.conf ] ; then
echo "Reconfiguring ntp configuration"
mv $1/etc/ntp.pool.conf $1/etc/ntp.conf
fi
}