BIG rework still in progress.

status:
- disk partitionning API finished.
- image transfer API finished. (support for rsync done, ssh, bittorrent, 
flamethrower plugins not yet finished)
- autoinstall-lib.sh reworked
- systemimager-deploy-client.sh big rework. Now it will handle pre install 
scripts and post install scripts and monitor reporting. all stuffs that have no 
value added to be in imaging script.
  => Imaging script will be responsible to initialize disks and lay the image 
down to it and run post install scripts. noting more.
- Still enhancing API to make it even more simple. (need to work on LVM api and 
si_mkautoinstallscript rewrite)

A typical script can be:
# This master autoinstall script was created with SystemImager v4.5.1
# Using the following command:
# /usr/sbin/si_mkautoinstallscript -quiet --autodetect-disks -image 
oscarimage_sda -force -ip-assignment static -post-install shell

# Load functions and variables left behind by the dracut logic scripts.
# autoinstall-lib loads systemimager-lib which loads /tmp/variables.txt.
# autoinstall-lib hosts funtions needed for imaging
# systemimager-lib hosts function needed for dracut logic (they are also 
usefull here)
# /tmp/variables.txt hosts all relevant variables we need to keep track.
. /lib/autoinstall-lib.sh

# Uncomment the following line if you want system messages in GUI as well
sis_enable_system_msg
[ -z $IMAGENAME ] && IMAGENAME=oscarimage_sda
[ -z $OVERRIDES ] && OVERRIDES="oscarimage_sda $GROUP_OVERRIDES $HOSTNAME "

# Check to be sure this not run from a working machine
fail_if_run_from_working_machine

stop_software_raid_devices

# Light on disk partition icon.
sis_update_step part

################################################################################
# BEGIN disk initialisation

DISK0=${DISKS[0]}

### BEGIN partition $DISK0 ###

wipe_out_partition_table $DISK0 # default to GPT

loginfo "Creating partition ${DISK0}1."
add_partition $DISK0 200
set_partition_flag ${DISK0} 1 boot

loginfo "Creating partition ${DISK0}2."
add_partition $DISK0 512
set_partition_flag ${DISK0} 2 swap

loginfo "Creating partition ${DISK0}3."
add_partition $DISK0 0
#set_partition_flag ${DISK0} 3 root

logdetail "New partition table for $DISK0:"
print_partition_table $DISK0

### BEGIN swap and filesystem creation commands ###
logaction "mkswap -v1 ${DISK0}2"
mkswap -v1 ${DISK0}2 || shellout "mkswap failed!"
loginfo "Enabling swap space."
logaction "swapon ${DISK0}2"
swapon ${DISK0}2 || shellout "swapon failed!"

logaction "mkfs.xfs  -q -f  ${DISK0}3"
mkfs.xfs  -q -f  ${DISK0}3 || shellout "mkfs.xfs  -q -f  ${DISK0}3"
logaction "mkdir -p /sysroot/"
mkdir -p /sysroot/ || shellout "mkdir failed!"
loginfo "Adding / to /etc/fstab"
echo "/dev/sda3 /sysroot/       xfs     defaults        0 0" >> /etc/fstab
loginfo "Mounting /dev/sda3 to /sysroot/"
mount /sysroot/

logaction "mkfs.ext4  -q  ${DISK0}1"
mkfs.ext4  -q  ${DISK0}1 || shellout "mkfs.ext4  -q  ${DISK0}1"
logaction "mkdir -p /sysroot/boot"
mkdir -p /sysroot/boot || shellout "mkdir failed!"
loginfo "Adding /boot to /etc/fstab"
echo "/dev/sda1 /sysroot/boot   ext4    defaults        0 0" >> /etc/fstab
loginfo "Mounting /dev/sda1 to /sysroot/boot"
mount /sysroot/boot

### END swap and filesystem creation commands ###

# Mount os filesystems to /sysroot (will shellout in case of failure)
mount_os_filesystems_to_sysroot

################################################################################
#
#   Lay the image down on the freshly formatted disk(s)
#
init_transfert
start_report_task
download_image
extract_image

beep# Leave notice of which image is installed on the client
echo $IMAGENAME > /sysroot/etc/systemimager/IMAGE_LAST_SYNCED_TO || shellout

### BEGIN generate new fstab file from autoinstallscript.conf ###
set_ip_assignment_method static

cat <<'EOF' > /sysroot/etc/fstab
/dev/sda3       /       xfs     defaults        1       2
/dev/sda2       swap    swap    defaults        0       0
/dev/sda1       /boot   ext4    defaults        1       2
/dev/fd0        /mnt/floppy     auto    noauto,owner    0       0
nfs_oscar:/home /home   nfs     rw      0       0
EOF
### END generate new fstab file from autoinstallscript.conf ###

install_overrides
beep

# Drop to debug shell later.
echo shell > /tmp/SIS_action

--
   Olivier LAHAYE
________________________________
De : LAHAYE Olivier
Envoyé : lundi 18 décembre 2017 11:49
À : sisuite-devel@lists.sourceforge.net
Objet : [PROVENANCE INTERNET] [Sisuite-devel] Reworking the partition creation 
and also the script generator.


Hi,

I'm currently rewriting the script logic by integrating a partition 
creation/edition into the systemimager dracut API (autoinstall-lib.sh)
This API will be able to handle natively diskfiles. The si_mkautoinstallscript 
will be much simpler.

For this, I'll drop support of msdos partition types for now as it is becoming 
widely deprecated and gpt is supported by most if not all currently maintained 
OSes.

Aside that, the image transfert protocols have been put in separate API plugins 
(one for rsync, one for bittorrent, .... ) This is easier for maintenance.

Regards,

--
   Olivier LAHAYE
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
sisuite-devel mailing list
sisuite-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sisuite-devel

Reply via email to