From 839ade1073032d841a3823e0a25d0ded19cc8b71 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sun, 5 Dec 2010 18:10:00 +0100 Subject: make AIF track needed filesystem packages filesystem packages are scheduled to go out of base, hence AIF must track which ones are needed and which are not by keeping an eye open during the filesystems creation (and rollback) steps. In the interactive procedure, the appropriate packages will be preselected, in the automatic procedure, you're supposed to configure the needed packages yourself now. This is reflected in the examples. --- examples/fancy-install-on-sda | 2 +- examples/generic-install-on-sda | 4 ++-- src/aif.sh | 1 + src/core/libs/lib-blockdevices-filesystems.sh | 12 ++++++++++++ src/core/libs/lib-ui-interactive.sh | 10 +++++++--- tests/runtime/automatic-dmcrypt-lvm-install-sda/profile | 4 ++-- tests/runtime/automatic-lvm-dmcrypt-install-sda/profile | 2 +- tests/runtime/automatic-reuse-fs-sda/profile | 2 +- unofficial/dieter-desktop-a7n8x.automaticprofile | 1 + 9 files changed, 28 insertions(+), 10 deletions(-) diff --git a/examples/fancy-install-on-sda b/examples/fancy-install-on-sda index b5b316c..28c5f1b 100644 --- a/examples/fancy-install-on-sda +++ b/examples/fancy-install-on-sda @@ -10,7 +10,7 @@ RUNTIME_PACKAGES= # packages to install TARGET_GROUPS=base TARGET_PACKAGES_EXCLUDE='reiserfsprogs' -TARGET_PACKAGES=openssh +TARGET_PACKAGES='openssh e2fsprogs cryptsetup lvm2 xfsprogs' # you can optionally also override some functions... worker_intro () { diff --git a/examples/generic-install-on-sda b/examples/generic-install-on-sda index 8923fe3..44a2166 100644 --- a/examples/generic-install-on-sda +++ b/examples/generic-install-on-sda @@ -16,7 +16,7 @@ RUNTIME_PACKAGES= # packages to install TARGET_GROUPS=base # all packages in this group will be installed (defaults to base if no group and no packages are specified) TARGET_PACKAGES_EXCLUDE= # Exclude these packages if they are member of one of the groups in TARGET_GROUPS. example: 'nano reiserfsprogs' (they are in base) -TARGET_PACKAGES=openssh # you can also specify separate packages to install (this is empty by default) +TARGET_PACKAGES='openssh e2fsprogs' # you can also specify separate packages to install (this is empty by default) # you can optionally also override some functions... worker_intro () { @@ -36,4 +36,4 @@ 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 +/dev/sda3 raw no_label ext4;yes;/;target;no_opts;no_label;no_params' diff --git a/src/aif.sh b/src/aif.sh index a64bb02..6949482 100755 --- a/src/aif.sh +++ b/src/aif.sh @@ -39,6 +39,7 @@ echo "Welcome to $TITLE" mount -o remount,rw / &>/dev/null cleanup_runtime +needed_pkgs_fs= # will hold extra needed packages for blockdevices/filesystems, populated when the Fs'es are created ### Set configuration values ### # note : you're free to use or ignore these in your procedure. probably you want to use these variables to override defaults in your configure worker diff --git a/src/core/libs/lib-blockdevices-filesystems.sh b/src/core/libs/lib-blockdevices-filesystems.sh index 3ebdc75..897c97e 100644 --- a/src/core/libs/lib-blockdevices-filesystems.sh +++ b/src/core/libs/lib-blockdevices-filesystems.sh @@ -478,6 +478,17 @@ process_filesystems () then debug 'FS' "$fs_id ->Already done" else + needs_pkg= + [ $fs_type = 'lvm-pv' ] && needs_pkg=lvm2 + [ $fs_type = 'xfs' ] && needs_pkg=xfsprogs + [ $fs_type = 'jfs' ] && needs_pkg=jfsutils + [ $fs_type = 'reiserfs' ] && needs_pkg=reiserfsprogs + [[ $fs_type =~ ext.* ]] && needs_pkg=e2fsprogs + [ $fs_type = 'vfat' ] && needs_pkg=dosfstools + [ $fs_type = 'dm_crypt' ] && needs_pkg=cryptsetup + + [ -n "$needs_pkg" ] && check_is_in $needs_pkg "${needed_pkgs_fs[@]}" || needed_pkgs_fs+=($needs_pkg) + # We can't always do -b on the lvm VG. because the devicefile sometimes doesn't exist for a VG. vgdisplay to the rescue! if [ "$part_type" = lvm-vg ] && vgdisplay $part | grep -q 'VG Name' # $part is a lvm VG and it exists. note that vgdisplay exists 0 when the requested vg doesn't exist. then @@ -687,6 +698,7 @@ rollback_filesystems () [ -n "$warnings" ] && inform "Rollback failed" disks 1 && show_warning "Rollback problems" "Some problems occurred while rolling back: $warnings.\n Thisk needs to be fixed before retrying disk/filesystem creation or restarting the installer" && return 1 inform "Rollback succeeded" disks 1 done_filesystems= + needed_pkgs_fs= BLOCK_ROLLBACK_USELESS=1 return 0 } diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh index 8d1acc8..4351e48 100644 --- a/src/core/libs/lib-ui-interactive.sh +++ b/src/core/libs/lib-ui-interactive.sh @@ -750,7 +750,8 @@ interactive_select_packages() { repos=`list_pacman_repos target` notify "Package selection is split into two stages. First you will select package groups that contain packages you may be interested in. Then you will be presented with a full list of packages for each group, allowing you to fine-tune.\n\n -Note that right now the packages (and groups) selection is limited to the repos available at this time ($repos). Once you have your Arch system up and running, you have access to more repositories and packages." +Note that right now the packages (and groups) selection is limited to the repos available at this time ($repos). Once you have your Arch system up and running, you have access to more repositories and packages.\n\n +If any previous configuration you've done until now (like fancy filesystems) require extra packages, we've already preselected them for your convenience" # show group listing for group selection, base is ON by default, all others are OFF local _grouplist="base ^ ON" @@ -763,14 +764,17 @@ Note that right now the packages (and groups) selection is limited to the repos # assemble a list of packages with groups, marking pre-selected ones # - local _pkgtmp="$(list_packages repo core | awk '{print $2}')" # all packages in core repository + local _pkgtmp="$(list_packages repo core | awk '{print $2}')" # all packages in core repository. TODO: we should use $repos here local _pkglist='' which_group "$_pkgtmp" + # assemble some packages which we'll definitely select by default because we figured out we'll need them: + needed_pkgs=("${needed_pkgs_fs[@]}") while read pkgname pkggroup; do # check if this package is in a selected group # slightly ugly but sorting later requires newlines in the variable - if [ "${_grouplist/"\"$pkggroup\""/XXXX}" != "${_grouplist}" ]; then + if [ "${_grouplist/"\"$pkggroup\""/XXXX}" != "${_grouplist}" ] || check_is_in $pkgname "${needed_pkgs[@]}" + then _pkglist="$(echo -e "${_pkglist}\n${pkgname} ${pkggroup} ON")" else _pkglist="$(echo -e "${_pkglist}\n${pkgname} ${pkggroup} OFF")" diff --git a/tests/runtime/automatic-dmcrypt-lvm-install-sda/profile b/tests/runtime/automatic-dmcrypt-lvm-install-sda/profile index 8828cf3..42e9a4d 100644 --- a/tests/runtime/automatic-dmcrypt-lvm-install-sda/profile +++ b/tests/runtime/automatic-dmcrypt-lvm-install-sda/profile @@ -8,7 +8,7 @@ RUNTIME_PACKAGES= # packages to install TARGET_GROUPS=base TARGET_PACKAGES_EXCLUDE='reiserfsprogs' -TARGET_PACKAGES='openssh aif' +TARGET_PACKAGES='openssh aif e2fsprogs cryptsetup lvm2 xfsprogs' # These variables are mandatory @@ -19,4 +19,4 @@ BLOCKDATA='/dev/sda1 raw no_label ext2;yes;/boot;target;no_opts;no_label;no_para /dev/sda2+ lvm-pv no_label lvm-vg;yes;no_mountpoint;target;no_opts;mypool;/dev/sda2 /dev/mapper/mypool lvm-vg mypool lvm-lv;yes;no_mountpoint;target;no_opts;root;800M /dev/mapper/mypool-root lvm-lv no_label dm_crypt;yes;no_mountpoint;target;no_opts;mypool-rootcrypt;-c__aes-xts-plain__-y__-s__512 -/dev/mapper/mypool-rootcrypt dm_crypt no_label xfs;yes;/;target;no_opts;no_label;no_params' \ No newline at end of file +/dev/mapper/mypool-rootcrypt dm_crypt no_label xfs;yes;/;target;no_opts;no_label;no_params' diff --git a/tests/runtime/automatic-lvm-dmcrypt-install-sda/profile b/tests/runtime/automatic-lvm-dmcrypt-install-sda/profile index c90b1ec..b8688eb 100644 --- a/tests/runtime/automatic-lvm-dmcrypt-install-sda/profile +++ b/tests/runtime/automatic-lvm-dmcrypt-install-sda/profile @@ -8,7 +8,7 @@ RUNTIME_PACKAGES= # packages to install TARGET_GROUPS=base TARGET_PACKAGES_EXCLUDE='reiserfsprogs' -TARGET_PACKAGES='openssh aif' +TARGET_PACKAGES='openssh aif e2fsprogs cryptsetup lvm2 xfsprogs' # These variables are mandatory diff --git a/tests/runtime/automatic-reuse-fs-sda/profile b/tests/runtime/automatic-reuse-fs-sda/profile index 115cb15..c3eebd3 100644 --- a/tests/runtime/automatic-reuse-fs-sda/profile +++ b/tests/runtime/automatic-reuse-fs-sda/profile @@ -1,4 +1,4 @@ -TARGET_PACKAGES='aif' +TARGET_PACKAGES='aif e2fsprogs' RUNTIME_REPOSITORIES=(testing "Server = ftp://mir1.archlinuxfr.org/archlinux/testing/os/$var_ARCH") GRUB_DEVICE=/dev/sda diff --git a/unofficial/dieter-desktop-a7n8x.automaticprofile b/unofficial/dieter-desktop-a7n8x.automaticprofile index 73d1a36..4938339 100644 --- a/unofficial/dieter-desktop-a7n8x.automaticprofile +++ b/unofficial/dieter-desktop-a7n8x.automaticprofile @@ -30,6 +30,7 @@ var_BLOCKDATA='/dev/sda1 raw no_label ext2;yes;/boot;target;no_opts;no_label;no_ /dev/mapper/cryptpool-crypthome lvm-lv no_label xfs;yes;/home;target;no_opts;no_label;no_params' +TARGET_PACKAGES='openssh e2fsprogs cryptsetup lvm2 xfsprogs' phase_preparation=(accept_ssl_cert "${phase_preparation[@]}") # make accept_ssl_cert the very first thing. it needs to go before fetch_configs and it's not easy to put it somewhere in the middle, so... phase_system+=(configure_home) -- cgit v1.2.3-54-g00ecf