diff options
author | Dieter Plaetinck <dieter@plaetinck.be> | 2009-03-13 21:15:09 +0100 |
---|---|---|
committer | Dieter Plaetinck <dieter@plaetinck.be> | 2009-03-13 21:15:09 +0100 |
commit | 06e6aa5d5eaa01ff7a371a66c88da8568f7f7e68 (patch) | |
tree | 5918fe64096a13a7a1da73e2125d0308885b0cea | |
parent | d120e407654b5f1c88cb146511b9439b80190bb7 (diff) |
uniformize variable handling automatic procedure, change the package related variable stuff, support choosing grub device in automatic, fix grub installing bug, cleanup official vs dieters stuff, etc
-rw-r--r-- | examples/generic-install-on-sda | 25 | ||||
-rw-r--r-- | src/core/libs/lib-software.sh | 3 | ||||
-rw-r--r-- | src/core/libs/lib-ui-interactive.sh | 2 | ||||
-rw-r--r-- | src/core/procedures/automatic | 65 | ||||
-rw-r--r-- | src/core/procedures/base | 6 | ||||
-rw-r--r-- | unofficial/dieter-desktop-a7n8x.automaticprofile (renamed from examples/deployconfig-dieter) | 25 | ||||
-rw-r--r-- | unofficial/modules/dieter/procedures/dieter-automatic | 27 |
7 files changed, 76 insertions, 77 deletions
diff --git a/examples/generic-install-on-sda b/examples/generic-install-on-sda index 0afdea5..9d25776 100644 --- a/examples/generic-install-on-sda +++ b/examples/generic-install-on-sda @@ -1,23 +1,28 @@ -# these variables are defaults, but it doesn't hurt to define them. +# these variables are optional, here are the defaults (feel free to omit them) -AUTOMATIC_SOURCE=cd -AUTOMATIC_FILE_URL=file:///src/core/pkg -AUTOMATIC_SYNC_URL= +SOURCE=cd +FILE_URL=file:///src/core/pkg +SYNC_URL= # Do you want to have additional pacman repositories or packages available at runtime (during installation)? -AUTOMATIC_RUNTIME_REPOSITORIES= -AUTOMATIC_RUNTIME_PACKAGES= +RUNTIME_REPOSITORIES= +RUNTIME_PACKAGES= # packages to install -TARGET_GROUPS=base #all packages in this group will be installed -TARGET_PACKAGES=openssh # you can also specify separate packages +TARGET_GROUPS=base #all packages in this group will be installed (defaults to base if no group and no packages are specified) +TARGET_PACKAGES=openssh # you can also specify separate packages (this is empty by default) +# you can optionally also override some functions... worker_intro () { infofy "Automatic procedure running the generic-install-on-sda example config. THIS WILL ERASE AND OVERWRITE YOUR /DEV/SDA. IF YOU DO NOT WANT THIS PRESS CTRL+C WITHIN 10 SECONDS" sleep 10 } -var_PARTITIONS='/dev/sda 100:ext2:+ 512:swap *:ext4' -var_BLOCKDATA='/dev/sda1 raw no_label ext2;yes;/boot;target;no_opts;no_label;no_params + +# These variables are mandatory + +GRUB_DEVICE=/dev/sda +PARTITIONS='/dev/sda 100:ext2:+ 512:swap *:ext4' +BLOCKDATA='/dev/sda1 raw no_label ext2;yes;/boot;target;no_opts;no_label;no_params /dev/sda2 raw no_label swap;yes;no_mountpoint;target;no_opts;no_label;no_params /dev/sda3 raw no_label ext4;yes;/;target;no_opts;no_label;no_params'
\ No newline at end of file diff --git a/src/core/libs/lib-software.sh b/src/core/libs/lib-software.sh index 455a3cc..a915d4f 100644 --- a/src/core/libs/lib-software.sh +++ b/src/core/libs/lib-software.sh @@ -27,9 +27,10 @@ installpkg() { notify "Package installation will begin now. You can watch the output in the progress window. Please be patient." target_special_fs on - ALL_PACKAGES=$TARGET_PACKAGES + ALL_PACKAGES=$var_TARGET_PACKAGES [ -n "$TARGET_GROUPS" ] && ALL_PACKAGES="$ALL_PACKAGES "`list_packages group "$TARGET_GROUPS" | awk '{print $2}'` ALL_PACKAGES=`echo $ALL_PACKAGES` + [ -z "$ALL_PACKAGES" ] && die_error "No packages/groups specified to install" run_background pacman_installpkg "$PACMAN_TARGET --noconfirm -S $ALL_PACKAGES" $TMP_PACMAN_LOG #TODO: There may be something wrong here. See http://projects.archlinux.org/?p=installer.git;a=commitdiff;h=f504e9ecfb9ecf1952bd8dcce7efe941e74db946 ASKDEV (Simo) follow_progress " Installing... Please Wait " $TMP_PACMAN_LOG $BACKGROUND_PID diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh index 33522d2..bce3790 100644 --- a/src/core/libs/lib-ui-interactive.sh +++ b/src/core/libs/lib-ui-interactive.sh @@ -634,7 +634,7 @@ interactive_select_packages() { _pkglist="$(echo "$_pkglist" | sort -f -k 2)" ask_checklist "Select Packages To Install." $_pkglist || return 1 - TARGET_PACKAGES=$ANSWER_CHECKLIST # contains now all package names + var_TARGET_PACKAGES=$ANSWER_CHECKLIST # contains now all package names return 0 } diff --git a/src/core/procedures/automatic b/src/core/procedures/automatic index f088ff8..65174de 100644 --- a/src/core/procedures/automatic +++ b/src/core/procedures/automatic @@ -1,5 +1,4 @@ #!/bin/bash -# This procedure is in development!! # This is a procedure for automatic deployment/installation/configuration of systems. # TODO: document! (readme, notes about deployment profiles, examples, ...) # check /usr/share/aif/examples for some example config files. # This procedure can easily replace the old quickinst script if you look at the "generic install" config file @@ -7,13 +6,13 @@ # It should be: # phase_preparation=(configure intro sysprep select_source runtime_network runtime_repositories runtime_packages) # phase_basics=(set_clock prepare_disks) -# phase_system=(package_listTODO install_packages auto_fstab auto_networkTODO auto_locale auto_keymap_font configure_system mkinitcpio locales install_bootloader) +# phase_system=(package_list install_packages auto_fstab auto_networkTODO auto_locale auto_keymap_font configure_system mkinitcpio locales install_bootloader) # phase_finish=(msg_report) # In theory, the only manual thing should maybe be configuring the runtime network and putting the configfile in place # TODO: I don't know if you can do non-interactive dm_crypt stuff.. maybe by pulling luks keyfiles from svn/git/..? # TODO: for worker_configure_system, we probably want the user to specify hostname, root pass etc. - +# TODO: implement setting hostname, keymap, consolefont, network settings # for a list of recognized variables, see examples/generic-install-on-sda depend_procedure core base @@ -37,7 +36,7 @@ process_args () worker_intro () { - notify "Automatic procedure running..." + notify "Automatic procedure running profile $var_AUTOMATIC_PROFILE ..." } @@ -46,17 +45,23 @@ worker_configure () var_UI_TYPE=${arg_ui_type:-cli} [ -z "$var_AUTOMATIC_PROFILE" ] && die_error "You must specify a config file to use this procedure" source $var_AUTOMATIC_PROFILE || die_error "Could not source config $var_AUTOMATIC_PROFILE" - var_RUNTIME_REPOSITORIES=$AUTOMATIC_RUNTIME_REPOSITORIES - var_RUNTIME_PACKAGES=$AUTOMATIC_RUNTIME_PACKAGES - [ -z "$var_PARTITIONS" ] && die_error "You did not specify a partition scheme" - [ -z "$var_BLOCKDATA" ] && die_error "You did not specify a partition scheme" + # Check mandatory options + [ -z "$PARTITIONS" ] && die_error "You did not specify a partition scheme" + [ -z "$BLOCKDATA" ] && die_error "You did not specify a partition scheme" + [ -z "$GRUB_DEVICE" ] && die_error "You did not specify a grub device" + # initialize internal variables based on variables set by the user (some of the vars are handled in other workers): + var_RUNTIME_REPOSITORIES=$RUNTIME_REPOSITORIES + var_RUNTIME_PACKAGES=$RUNTIME_PACKAGES + var_GRUB_DEVICE=$GRUB_DEVICE + var_PARTITIONS=$PARTITIONS + var_BLOCKDATA=$BLOCKDATA } worker_select_source () { - var_PKG_SOURCE_TYPE=${AUTOMATIC_SOURCE:-cd} - var_FILE_URL=${AUTOMATIC_FILE_URL:-file:///src/core/pkg} - var_SYNC_URL=${AUTOMATIC_SYNC_URL:-} + var_PKG_SOURCE_TYPE=${SOURCE:-cd} + var_FILE_URL=${FILE_URL:-file:///src/core/pkg} + var_SYNC_URL=${SYNC_URL:-} } worker_runtime_network () @@ -72,27 +77,6 @@ worker_runtime_network () } -# Check if we have all needed settings loaded from the profile -worker_runtime_settings () -{ - if check_is_in svn $var_RUNTIME_PACKAGES - then - [ -z "$SVN_USERNAME" ] && ask_string "Please enter your svn username" && SVN_USERNAME=$ANSWER_STRING - [ -z "$SVN_PASSWORD" ] && ask_password svn #TODO: if user entered incorrect password, the install process will just fail.. - [ -z "$SVN_BASE" ] && ask_string "What's the base path of your svn repo? (no ending /) " && SVN_BASE=$ANSWER_STRING - [ -z "$DEPLOY_CLASS" ] && ask_string "Which hostclass are you installing? (optional)" '' 0 && DEPLOY_CLASS=$ANSWER_STRING - SVN="svn --username $SVN_USERNAME --password $SVN_PASSWORD" - elif check_is_in moo $var_RUNTIME_PACKAGES - then - # Maybe more stuff later - true - fi - [ -z "$HOSTNAME" ] && ask_string "Hostname of target system?" && HOSTNAME=$ANSWER_STRING - - return 0 -} - - worker_prepare_disks () { echo "$var_PARTITIONS" > $TMP_PARTITIONS @@ -111,11 +95,17 @@ worker_prepare_disks () true } +worker_package_list () +{ + var_TARGET_PACKAGES=$TARGET_PACKAGES + var_TARGET_GROUPS=$TARGET_GROUPS + [ -z "$var_TARGET_PACKAGES" -a -z "$var_TARGET_GROUPS" ] && var_TARGET_GROUPS=base +} + 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 } @@ -135,12 +125,5 @@ worker_auto_network () { worker_install_bootloader () { - install-grub /dev/sda #TODO: this can be more flexible.. -} - - -worker_runtime_yaourt () -{ - _yaourt_replace_pacman + grub_install $var_GRUB_DEVICE --root-directory=/mnt } - diff --git a/src/core/procedures/base b/src/core/procedures/base index 602fccb..6d99421 100644 --- a/src/core/procedures/base +++ b/src/core/procedures/base @@ -135,18 +135,16 @@ worker_prepare_disks () } -# Put the list of packages to be installed in $TARGET_PACKAGES +# Put the list of packages to be installed in $var_TARGET_PACKAGES and $var_TARGET_GROUPS worker_package_list () { - #TODO: sensible list of packages. maybe just 'base' - true + var_TARGET_GROUPS=base } worker_install_packages () { target_prepare_pacman core #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 } diff --git a/examples/deployconfig-dieter b/unofficial/dieter-desktop-a7n8x.automaticprofile index a866d54..2e63a78 100644 --- a/examples/deployconfig-dieter +++ b/unofficial/dieter-desktop-a7n8x.automaticprofile @@ -103,28 +103,13 @@ worker_configure_home () #} -# Check if we have all needed settings loaded from the profile -post_worker_configure () -{ - if check_is_in svn $var_RUNTIME_PACKAGES - then - [ -z "$SVN_USERNAME" ] && ask_string "Please enter your svn username" && SVN_USERNAME=$ANSWER_STRING - [ -z "$SVN_PASSWORD" ] && ask_password svn #TODO: if user entered incorrect password, the install process will just fail.. - [ -z "$SVN_BASE" ] && ask_string "What's the base path of your svn repo? (no ending /) " && SVN_BASE=$ANSWER_STRING - [ -z "$DEPLOY_CLASS" ] && ask_string "Which hostclass are you installing? (optional)" '' 0 && DEPLOY_CLASS=$ANSWER_STRING - SVN="svn --username $SVN_USERNAME --password $SVN_PASSWORD" - elif check_is_in moo $var_RUNTIME_PACKAGES - then - # Maybe more stuff later - true - fi - [ -z "$HOSTNAME" ] && ask_string "Hostname of target system?" && HOSTNAME=$ANSWER_STRING - - return 0 -} - worker_set_clock () { #Not doing anything. hwclock is set already, configs are coming from svn anyway and we'll use ntp. true } + +worker_runtime_yaourt () +{ + _yaourt_replace_pacman +} diff --git a/unofficial/modules/dieter/procedures/dieter-automatic b/unofficial/modules/dieter/procedures/dieter-automatic new file mode 100644 index 0000000..09e8972 --- /dev/null +++ b/unofficial/modules/dieter/procedures/dieter-automatic @@ -0,0 +1,27 @@ +#!/bin/bash +# Dieters personal procedure, adds a bit on top of the official automatic procedure. +# TODO: implement this. + +depend_procedure core automatic + + +# Check if we have all needed settings loaded from the profile +worker_runtime_settings () #TODO: add to a phase +{ + if check_is_in svn $var_RUNTIME_PACKAGES + then + [ -z "$SVN_USERNAME" ] && ask_string "Please enter your svn username" && SVN_USERNAME=$ANSWER_STRING + [ -z "$SVN_PASSWORD" ] && ask_password svn #TODO: if user entered incorrect password, the install process will just fail.. + [ -z "$SVN_BASE" ] && ask_string "What's the base path of your svn repo? (no ending /) " && SVN_BASE=$ANSWER_STRING + [ -z "$DEPLOY_CLASS" ] && ask_string "Which hostclass are you installing? (optional)" '' 0 && DEPLOY_CLASS=$ANSWER_STRING + SVN="svn --username $SVN_USERNAME --password $SVN_PASSWORD" + elif check_is_in moo $var_RUNTIME_PACKAGES + then + # Maybe more stuff later + true + fi + [ -z "$HOSTNAME" ] && ask_string "Hostname of target system?" && + HOSTNAME=$ANSWER_STRING + + return 0 +} |