PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
if [ $$ -eq 1 ]; then
- mount / -o remount
+ #mount / -o remount
+ mount -t tmpfs -o size=20m tmpfs /tmp
/etc/init.d/udev start
- hwclock -u -s
+ #hwclock -u -s
(exec $0) &
wait
exit 0 # Hopefully this is never called...
fi
+export PATH
+
. @commondir@/common.sh
set -e
"\`snf_image_activate_helper' is missing"
fi
-if [ ! -b "$FLOPPY_DEV" ]; then
- log_error "Floppy device is not present!"
+prepare_helper
+
+if [ ! -b "$RULES_DEV" ]; then
+ log_error "Device file hosting the rules file: \`$RULES_DEV' does not exist"
fi
-floppy=$(mktemp -d --tmpdir floppy.XXXXXX)
-add_cleanup rmdir "$floppy"
+rules=$(mktemp -d --tmpdir rules.XXXXXX)
+add_cleanup rmdir "$rules"
-mount $FLOPPY_DEV $floppy
-add_cleanup umount "$floppy"
+$MOUNT $RULES_DEV $rules
+add_cleanup umount "$rules"
-if [ -f "$floppy/rules" ]; then
- source "$floppy/rules"
+if [ -f "$rules/rules" ]; then
+ source "$rules/rules"
else
- log_error "Floppy does not contain \`rules\' file"
+ log_error "$RULES_DEV does not contain \`rules\' file"
fi
-if [ -f "$floppy/unattend.xml" ]; then
- export SNF_IMAGE_UNATTEND="$floppy/unattend.xml"
+if [ -f "$rules/unattend.xml" ]; then
+ export SNF_IMAGE_UNATTEND="$rules/unattend.xml"
fi
if [ -n "$SNF_IMAGE_PROPERTIES" ]; then
log_error "Required image property \`ROOT_PARTITION' is missing or empty."
fi
- export SNF_IMAGE_RESIZE_PART="$(get_partition_to_resize "$SNF_IMAGE_DEV")"
+ if [[ ! "$SNF_IMAGE_PROPERTY_OSFAMILY" =~ ^(linux|windows|freebsd|openbsd|netbsd)$ ]]; then
+ log_error "Supported values for OSFAMILY property are: linux|windows|freebsd|openbsd|netbsd"
+ fi
- if [[ ! "$SNF_IMAGE_PROPERTY_OSFAMILY" =~ ^(linux|windows)$ ]]; then
- log_error "Supported values for OSFAMILY property are: linux|windows"
+ SNF_IMAGE_RESIZE_PART="$(get_partition_to_resize "$SNF_IMAGE_DEV")"
+ if [ -z "$SNF_IMAGE_RESIZE_PART" ]; then
+ exit 0
fi
+ export SNF_IMAGE_RESIZE_PART
+
# If something goes wrong with the tasks, try to umount the disk file
# systems that are still mounted.
trap '{ umount_all "$target"; }' ERR
fi
-echo "SUCCESS" > "$RESULT"
+return_success
cleanup
trap - EXIT