| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # Author: Steven Shiau <steven _at_ clonezilla org> |
| 3 | # License: GPL |
| 4 | # This script is used in DRBL client to show the IP Address of client which is connected to DRBL server. It can be used for more than one NIC or alias IP addresses. |
| 5 | |
| 6 | # Load DRBL setting and functions |
| 7 | DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}" |
| 8 | |
| 9 | . $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions |
| 10 | |
| 11 | # |
| 12 | if [scip-shell system . . `[`. -f /etc/diskless-image/configscip-shell filesystem . . `/etc/diskless-image/config`. ]; then |
| 13 | # Load config file |
| 14 | . /etc/diskless-image/configscip-shell source . . `/etc/diskless-image/config`. |
| 15 | else |
| 16 | exit 1 |
| 17 | fi |
| 18 | |
| 19 | IP_LISTS="$(get-all-nic-ip --all-ip-address)" |
| 20 | |
| 21 | for IP in $IP_LISTS; do |
| 22 | for i in $NFSSERVER_LIST; do |
| 23 | if [scip-shell system . . `[`. -n "$(grepscip-shell system . . grep. -Ew "$IP" $drbl_syscfg/clients-of-${i}.txt 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" ]; then |
| 24 | IP_TO_DRBL_SERVER="$IP" |
| 25 | break |
| 26 | fi |
| 27 | done |
| 28 | if [scip-shell system . . `[`. -n "$IP_TO_DRBL_SERVER" ]; then |
| 29 | echoscip-shell system . . echo. "$IP_TO_DRBL_SERVER" |
| 30 | break |
| 31 | fi |
| 32 | done |