summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pc-sysinstall/backend/functions.sh
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/pc-sysinstall/backend/functions.sh')
-rwxr-xr-xusr.sbin/pc-sysinstall/backend/functions.sh115
1 files changed, 115 insertions, 0 deletions
diff --git a/usr.sbin/pc-sysinstall/backend/functions.sh b/usr.sbin/pc-sysinstall/backend/functions.sh
index f51902a..847d97e 100755
--- a/usr.sbin/pc-sysinstall/backend/functions.sh
+++ b/usr.sbin/pc-sysinstall/backend/functions.sh
@@ -283,3 +283,118 @@ get_zpool_name()
return
fi
};
+
+write_image()
+{
+ IMAGE_FILE="$1"
+ DEVICE_FILE="$2"
+
+ if [ -z "${IMAGE_FILE}" ]
+ then
+ echo "ERROR: Image file not specified!"
+ exit 1
+ fi
+
+ if [ -z "${DEVICE_FILE}" ]
+ then
+ echo "ERROR: Device file not specified!"
+ exit 1
+ fi
+
+ if [ ! -f "${IMAGE_FILE}" ]
+ then
+ echo "ERROR: '${IMAGE_FILE}' does not exist!"
+ exit 1
+ fi
+
+ DEVICE_FILE="${DEVICE_FILE#/dev/}"
+ DEVICE_FILE="/dev/${DEVICE_FILE}"
+
+ if [ ! -c "${DEVICE_FILE}" ]
+ then
+ echo "ERROR: '${DEVICE_FILE}' is not a character device!"
+ exit 1
+ fi
+
+ if [ "${RES}" = "0" ]
+ then
+ rc_halt "dd if=${IMAGE_FILE} of=${DEVICE_FILE} ibs=16k obs=16k"
+ fi
+
+ return 0
+};
+
+install_fresh()
+{
+ # Lets start setting up the disk slices now
+ setup_disk_slice
+
+ # Disk setup complete, now lets parse WORKINGSLICES and setup the bsdlabels
+ setup_disk_label
+
+ # Now we've setup the bsdlabels, lets go ahead and run newfs / zfs
+ # to setup the filesystems
+ setup_filesystems
+
+ # Lets mount the partitions now
+ mount_all_filesystems
+
+ # We are ready to begin extraction, lets start now
+ init_extraction
+
+ # Check if we have any optional modules to load
+ install_components
+
+ # Check if we have any packages to install
+ install_packages
+
+ # Do any localization in configuration
+ run_localize
+
+ # Save any networking config on the installed system
+ save_networking_install
+
+ # Now add any users
+ setup_users
+
+ # Now run any commands specified
+ run_commands
+
+ # Do any last cleanup / setup before unmounting
+ run_final_cleanup
+
+ # Unmount and finish up
+ unmount_all_filesystems
+
+ echo_log "Installation finished!"
+}
+
+install_upgrade()
+{
+ # We're going to do an upgrade, skip all the disk setup
+ # and start by mounting the target drive/slices
+ mount_upgrade
+
+ # Start the extraction process
+ init_extraction
+
+ # Do any localization in configuration
+ run_localize
+
+ # ow run any commands specified
+ run_commands
+
+ # Merge any old configuration files
+ merge_old_configs
+
+ # Check if we have any optional modules to load
+ install_components
+
+ # Check if we have any packages to install
+ install_packages
+
+ # All finished, unmount the file-systems
+ unmount_upgrade
+
+ echo_log "Upgrade finished!"
+}
OpenPOWER on IntegriCloud