Hallo, dies ist ein Test.
PWD: /www/data-lst1/unixsoft/unixsoft/kaempfer/.public_html
Running in File Mode
Relative path: ./../../../../../../etc/fs/zfs/bootinstall
Real path: /usr/lib/fs/zfs/bootinstall
Zurück
#!/bin/bash -p # # Copyright (c) 2010, 2022, Oracle and/or its affiliates. # PATH="/usr/bin:/usr/sbin:${PATH}"; export PATH ARCH=$(uname -p) KARCH=$(uname -m) LOGGER=/usr/bin/logger PROGNAME=$0 DEVICES=/etc/devices BOOTFS_ADD=bootfs_add print_err() { msg=`gettext "Error installing bootloader:"` echo $msg $1 $LOGGER -t $PROGNAME -i -p syslog.err "$msg $1" } do_akbe() { # POOL and DEV arguments have already been validated at attach POOL="$1" DEV="$2" RETRY=5 /usr/lib/ak/tools/akbe -i -R -P ${POOL} 2>&1 | $LOGGER -t $PROGNAME -i while [ ${PIPESTATUS[0]} != 0 ]; do # wait a little and give it more tries before giving up if [ $RETRY -gt 0 ]; then sleep 5 RETRY=$(( $RETRY - 1 )) # akbe would raise any ereport on last retry if [ $RETRY -gt 1 ]; then /usr/lib/ak/tools/akbe -i -R -P ${POOL} 2>&1 | $LOGGER -t $PROGNAME -i else /usr/lib/ak/tools/akbe -i -F -R -P ${POOL} 2>&1 | $LOGGER -t $PROGNAME -i fi else fmt=`gettext "akbe failed on %s"` print_err "`printf "$fmt" ${POOL}`" return 1 fi done return 0 } do_installboot() { # POOL and DEV arguments have already been validated at attach POOL="$1" DEV="$2" RETRY=5 bootadm install-bootloader ${DEV} 2>&1 | $LOGGER -t $PROGNAME -i while [ ${PIPESTATUS[0]} != 0 ]; do # wait a little and give it more tries before giving up if [ $RETRY -gt 0 ]; then sleep 5 RETRY=$(( $RETRY - 1 )) bootadm install-bootloader ${DEV} 2>&1 | $LOGGER -t $PROGNAME -i else fmt=`gettext "bootadm install-bootloader failed on %s"` print_err "`printf "$fmt" ${DEV}`" return 1 fi done return 0 } # command must be either "attach" or "install" if [ "$1" != "install" -a "$1" != "attach" ] ; then msg=`gettext "Invalid usage"` print_err "$msg $1" exit 1 fi if [ "$ARCH" != "i386" -a "$ARCH" != "sparc" ] ; then msg=`gettext "Unknown architecture:"` print_err "$msg $ARCH" exit 1 fi POOL="$2" if [ "$1" == "attach" ] ; then DEV=$(echo "$3" | sed -e 's+/dsk/+/rdsk/+') if [ -z "${POOL}" -o -z "${DEV}" ]; then msg=`gettext "Invalid usage"` print_err "$* $msg" exit 1 fi fi CURPOOL=$(df -k / | awk 'NR == 2 {print $1}' | sed 's,/.*,,') BPOOL=$(zfs get -H -o value com.oracle:boot-pool "$CURPOOL" | sed 's/^-$//g') if [ "$CURPOOL" != "$POOL" -a "$BPOOL" != "$POOL" ] ; then # non-root pool; ignore exit 0 fi # # if command is attach, if resilvering has completed then do the install # immediately, else if still in progress create the attach record and exit. # if [ "$1" == "attach" ] ; then if [ -n "`zpool monitor -t resilver -o timeleft ${POOL}`" ]; then eptime=`date +%s` echo ${POOL} ${DEV} > ${DEVICES}/${BOOTFS_ADD}-${eptime} else if [[ $(getconf _SC_SUNW_FEATURE_AK) == 1 ]]; then do_akbe ${POOL} ${DEV} else do_installboot ${POOL} ${DEV} fi fi exit 0 fi # remainder of script processes 'install' command. for f in ${DEVICES}/${BOOTFS_ADD}-* do ! [ -e "$f" ] && break while read POOL DEV do if [[ $(getconf _SC_SUNW_FEATURE_AK) == 1 ]]; then do_akbe ${POOL} ${DEV} if [ $? == 0 ]; then # delete the file rm $f fi else do_installboot ${POOL} ${DEV} if [ $? == 0 ]; then # delete the file rm $f fi fi done < $f done exit 0