CHNTPW=chntpw
SGDISK=sgdisk
GROWFS_UFS=growfs.ufs
+DUMPFS_UFS=dumpfs.ufs
DATE="date -u" # Time in UTC
EATMYDATA=eatmydata
MOUNT="mount -n"
log_error() {
ERRORS+=("$*")
- send_monitor_message_${HYPERVISOR} "ERROR: $@"
send_result_${HYPERVISOR} "ERROR: $@"
# Use return instead of exit. The set -x options will terminate the script
dev="$1"
table=$(get_partition_table "$dev")
+ if [ -z "$table" ]; then
+ return 0
+ fi
if [ $(get_partition_count "$table") -eq 0 ]; then
return 0
done
}
+get_ufstype() {
+ local device ufs
+
+ device="$1"
+ ufs="$($DUMPFS_UFS "$device" | head -1 | awk '{ match ($3, /\((.+)\)/, ufs); print ufs[1] }')"
+
+ case "$ufs" in
+ UFS1)
+ echo 44bsd
+ ;;
+ UFS2)
+ echo ufs2
+ ;;
+ *)
+ log_error "Unsupported UFS type: \`$ufs' in device $device"
+ echo ""
+ ;;
+ esac
+}
+
cleanup() {
# if something fails here, it shouldn't call cleanup again...
trap - EXIT
return 0
}
-
return_success() {
send_result_${HYPERVISOR} "SUCCESS"
}