Revision f6f223b8 example/instance-image.d/interfaces
b/example/instance-image.d/interfaces | ||
---|---|---|
29 | 29 |
fi |
30 | 30 |
|
31 | 31 |
DIG="$(which dig)" |
32 |
OS_TYPE="" |
|
33 |
FQDN="" |
|
34 | 32 |
|
35 | 33 |
# discover fqdn name using dig |
36 | 34 |
if [ -n "$NIC_0_IP" -a -n "${DIG}" ] ; then |
... | ... | |
47 | 45 |
exit 1 |
48 | 46 |
fi |
49 | 47 |
|
50 |
if [ -e ${TARGET}/etc/redhat-release ] ; then |
|
51 |
OS_TYPE="redhat" |
|
52 |
elif [ -e ${TARGET}/etc/debian_version ] ; then |
|
53 |
OS_TYPE="debian" |
|
54 |
elif [ -e ${TARGET}/etc/gentoo-release ] ; then |
|
55 |
OS_TYPE="gentoo" |
|
56 |
elif [ -e ${TARGET}/etc/SuSE-release ] ; then |
|
57 |
OS_TYPE="suse" |
|
48 |
get_os_type |
|
49 |
|
|
50 |
if [ "${NIC_COUNT}" -gt 0 -a -n "${OS_TYPE}" ] ; then |
|
51 |
${OS_TYPE}_setup |
|
52 |
else |
|
53 |
log_error "Unsupported OS_TYPE" |
|
58 | 54 |
fi |
59 | 55 |
|
56 |
# Functions |
|
57 |
|
|
60 | 58 |
debian_setup() { |
61 | 59 |
if [ ! -d "${TARGET}/etc/network" ] ; then |
62 | 60 |
log_error "Missing target network directory" |
... | ... | |
136 | 134 |
fi |
137 | 135 |
} |
138 | 136 |
|
139 |
if [ "${NIC_COUNT}" -gt 0 ] ; then |
|
140 |
case "${OS_TYPE}" in |
|
141 |
debian) |
|
142 |
debian_setup |
|
143 |
;; |
|
144 |
redhat) |
|
145 |
redhat_setup |
|
146 |
;; |
|
147 |
gentoo) |
|
148 |
gentoo_setup |
|
149 |
;; |
|
150 |
suse) |
|
151 |
suse_setup |
|
152 |
;; |
|
153 |
*) |
|
154 |
log_error "Unsupported OS_TYPE" |
|
155 |
exit 1 |
|
156 |
;; |
|
157 |
esac |
|
158 |
fi |
|
159 |
|
|
160 | 137 |
exit 0 |
Also available in: Unified diff