From 2f839ffec30eea2025cced9fb690ab612795c6ac Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 11:38:03 +0100 Subject: first move towards making my deployment procedure usable for other people too --- src/core/procedures/automatic | 131 ++++++++++++++++++++++++ unofficial/modules/ddeploy/procedures/automatic | 128 ----------------------- 2 files changed, 131 insertions(+), 128 deletions(-) create mode 100644 src/core/procedures/automatic delete mode 100644 unofficial/modules/ddeploy/procedures/automatic diff --git a/src/core/procedures/automatic b/src/core/procedures/automatic new file mode 100644 index 0000000..0e47f7b --- /dev/null +++ b/src/core/procedures/automatic @@ -0,0 +1,131 @@ +#!/bin/bash +# This procedure is EARLY in development!! +# This is a procedure for automatic deployment/installation/configuration of systems. # TODO: document! (readme, notes about deployment profiles, examples, ...) + +# In theory, the only manual thing should maybe be configuring the runtime network +# TODO: implement profile reading +# TODO: I don't know if you can do non-interactive dm_crypt stuff.. maybe by pulling luks keyfiles from svn/git/..? + +depend_module yaourt +depend_procedure core base + +phase_preparation=(\ + configure \ + intro \ + sysprep \ + runtime_network \ + runtime_svn \ + msg_automatic \ + select_source \ + runtime_packages \ + runtime_yaourt) + +phase_finish=(configure_home msg_report) + + +worker_intro () +{ + notify "Automatic procedure running..." +} + + +worker_configure () +{ + var_UI_TYPE=${arg_ui_type:-cli} +} + + +worker_msg_manual () +{ + # All things that need to be done manually first + notify "A few manual things need to happen first..." +} + + +worker_msg_automatic () +{ + notify "**** From now on. everything will be automatic. Enjoy the show!" # not true: you need pass for dm_crypt +} + + +worker_runtime_network () +{ + if ask_yesno "Do you want to (re)-configure your networking?" + then + interactive_runtime_network + else + infofy "Ok. skipping network config" + fi +} + + +worker_runtime_svn () +{ + SVN_USERNAME=dieter #TODO: softcode this + ask_password svn #TODO: if user entered incorrect password, the install process will just fail.. + SVN="svn --username $SVN_USERNAME --password $SVN_PASSWORD" + SVN_BASE=https://192.168.1.2/svn/repos + ask_string "Which host are you installing?" desktop-a7nx8 + TARGET_HOST=$ANSWER_STRING #TODO: allow passing as cmdline argument (and check with svn info). handle -z $ANSWER_STRING + _accept_ssl_cert +} + + +worker_prepare_disks () +{ + svn export $SVN_BASE/ddm-configs/$TARGET_HOST/trunk/disks/.blockdata $RUNTIME_DIR || die_error "Could not svn export $SVN_BASE/ddm-configs/$TARGET_HOST/trunk/disks/.blockdata into $RUNTIME_DIR" + svn export $SVN_BASE/ddm-configs/$TARGET_HOST/trunk/disks/.partitions $RUNTIME_DIR || die_error "Could not svn export $SVN_BASE/ddm-configs/$TARGET_HOST/trunk/disks/.partitions into $RUNTIME_DIR" + + process_disks || die_error "Could not process_disks" + process_filesystems || die_error "Could not process_filesystems" + + #TODO: support rollback + + + # TODO: fstab? auto-add to fstab with libs? auto mkdir's on target_dir? + true +} + +worker_package_list () +{ + $SVN export $SVN_BASE/ddm-configs/$TARGET_HOST/trunk/package-list $var_PKG_FILE || die_error "Could not export package list!" + # cat -> there are newlines in it -> var=`echo $var` -> not anymore :) + TARGET_PACKAGES=`cat $var_PKG_FILE` && TARGET_PACKAGES=`echo $TARGET_PACKAGES` || die_error "Could not cat package list. THIS SHOULD NEVER HAPPEN." + true +} + + +worker_install_packages () +{ + target_prepare_pacman core extra community #TODO: it would be better if this was a separate worker, i think + [ -z "$TARGET_PACKAGES" ] && die_error "No packages listed to be installed!" + installpkg +} + + +worker_configure_home () +{ + #checkout from svn + true +} + + +worker_set_clock () +{ + #timezone="Europe/Brussels" + #Not doing anything. hwclock is set already and configs are coming from svn anyway.. + true +} + + +worker_install_bootloader () +{ + install-grub /dev/sda +} + + +worker_runtime_yaourt () +{ + _yaourt_replace_pacman +} + diff --git a/unofficial/modules/ddeploy/procedures/automatic b/unofficial/modules/ddeploy/procedures/automatic deleted file mode 100644 index 1756ce8..0000000 --- a/unofficial/modules/ddeploy/procedures/automatic +++ /dev/null @@ -1,128 +0,0 @@ -#!/bin/bash -# TODO: I think it would be best that *nothing* is asked , eg everything passed as cmdline arg, or make 'ddeploy profiles' containing username, svn host, etc etc etc -depend_module yaourt -depend_procedure core base - -var_RUNTIME_PACKAGES="svn" - -phase_preparation=(\ - configure \ - intro \ - sysprep \ - msg_manual \ - runtime_network \ - runtime_svn \ - msg_automatic \ - select_source \ - runtime_packages \ - runtime_yaourt) - -phase_finish=(configure_home msg_report) - - -worker_intro () -{ - notify "DDeploy::automatic procedure running..." -} - - -worker_configure () -{ - var_UI_TYPE=${arg_ui_type:-cli} -} - - -worker_msg_manual () -{ - # All things that need to be done manually first - notify "A few manual things need to happen first..." -} - - -worker_msg_automatic () -{ - notify "**** From now on. everything will be automatic. Enjoy the show!" # not true: you need pass for dm_crypt -} - - -worker_runtime_network () -{ - if ask_yesno "Do you want to (re)-configure your networking?" - then - interactive_runtime_network - else - infofy "Ok. skipping network config" - fi -} - - -worker_runtime_svn () -{ - SVN_USERNAME=dieter #TODO: softcode this - ask_password svn #TODO: if user entered incorrect password, the install process will just fail.. - SVN="svn --username $SVN_USERNAME --password $SVN_PASSWORD" - SVN_BASE=https://192.168.1.2/svn/repos - ask_string "Which host are you installing?" desktop-a7nx8 - TARGET_HOST=$ANSWER_STRING #TODO: allow passing as cmdline argument (and check with svn info). handle -z $ANSWER_STRING - _accept_ssl_cert -} - - -worker_prepare_disks () -{ - svn export $SVN_BASE/ddm-configs/$TARGET_HOST/trunk/disks/.blockdata $RUNTIME_DIR || die_error "Could not svn export $SVN_BASE/ddm-configs/$TARGET_HOST/trunk/disks/.blockdata into $RUNTIME_DIR" - svn export $SVN_BASE/ddm-configs/$TARGET_HOST/trunk/disks/.partitions $RUNTIME_DIR || die_error "Could not svn export $SVN_BASE/ddm-configs/$TARGET_HOST/trunk/disks/.partitions into $RUNTIME_DIR" - - process_disks || die_error "Could not process_disks" - process_filesystems || die_error "Could not process_filesystems" - - #TODO: support rollback - - - # TODO: fstab? auto-add to fstab with libs? auto mkdir's on target_dir? - true -} - -worker_package_list () -{ - $SVN export $SVN_BASE/ddm-configs/$TARGET_HOST/trunk/package-list $var_PKG_FILE || die_error "Could not export package list!" - # cat -> there are newlines in it -> var=`echo $var` -> not anymore :) - TARGET_PACKAGES=`cat $var_PKG_FILE` && TARGET_PACKAGES=`echo $TARGET_PACKAGES` || die_error "Could not cat package list. THIS SHOULD NEVER HAPPEN." - true -} - - -worker_install_packages () -{ - target_prepare_pacman core extra community #TODO: it would be better if this was a separate worker, i think - [ -z "$TARGET_PACKAGES" ] && die_error "No packages listed to be installed!" - installpkg -} - - -worker_configure_home () -{ - #checkout from svn - true -} - - -worker_set_clock () -{ - #timezone="Europe/Brussels" - #Not doing anything. hwclock is set already and configs are coming from svn anyway.. - true -} - - -worker_install_bootloader () -{ - install-grub /dev/sda -} - - -worker_runtime_yaourt () -{ - _yaourt_replace_pacman -} - -- cgit v1.2.3-54-g00ecf