Last change
on this file since 651 was
459,
checked in by sebas, 15 years ago
|
nombre mas generico del archivo
|
File size:
1022 bytes
|
Line | |
---|
1 | #!/bin/sh |
---|
2 | # check out de http://bazaar.launchpad.net/~ltsp-upstream/ltsp/ltsp-trunk/annotate/head%3A/client/initramfs/scripts/nfs-bottom/ltsp |
---|
3 | # set hostname to ltsp if none is received from dhcp |
---|
4 | |
---|
5 | read HOSTNAME < /proc/sys/kernel/hostname |
---|
6 | if [ "${HOSTNAME}" = "(none)" ]; then |
---|
7 | HOSTNAME_BASE="ltsp" |
---|
8 | # get networking configuration |
---|
9 | . /tmp/net-*.conf |
---|
10 | if [ -f ${rootmnt}/etc/lts.conf ] && [ -x ${rootmnt}/usr/bin/getltscfg ]; then |
---|
11 | # get defaults from lts.conf |
---|
12 | eval $(chroot ${rootmnt} /usr/bin/getltscfg -a) |
---|
13 | fi |
---|
14 | case $HOSTNAME_EXTRA in |
---|
15 | mac) |
---|
16 | HOSTNAME_EXTRA=$(ip link show $DEVICE | awk '/ether/{print $2}' | cut -c 9- | tr -d ':') |
---|
17 | ;; |
---|
18 | ip|"") |
---|
19 | HOSTNAME_EXTRA=$(echo "$IPV4ADDR.$IPV4NETMASK" | awk -F "." '{ print (($1%(256-$5)*256+$2%(256-$6))*256+$3%(256-$7))*256+$4%(256-$8) }') |
---|
20 | ;; |
---|
21 | esac |
---|
22 | echo "$HOSTNAME_BASE$HOSTNAME_EXTRA" > /proc/sys/kernel/hostname |
---|
23 | fi |
---|
24 | cat /proc/sys/kernel/hostname > ${rootmnt}/etc/hostname || true |
---|
Note: See
TracBrowser
for help on using the repository browser.