From 4fe068cf41149b5eb52f12fb1c063cab8ecb1169 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Thu, 18 Dec 2008 16:39:45 +0100 Subject: fix for badly placed var_TARGET_DIR assignment --- src/core/procedures/interactive | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive index 6ee7023..d4c3cf6 100644 --- a/src/core/procedures/interactive +++ b/src/core/procedures/interactive @@ -4,8 +4,6 @@ depend_procedure core base # esp for auto_{network,locale,fstab}, intro and set_ # This is a port of the original /arch/setup script. It doesn't use aif phases but uses it's own menu-based flow (phase) control - -var_TARGET_DIR="/mnt" EDITOR= BLOCK_ROLLBACK_USELESS=1 @@ -115,7 +113,9 @@ worker_configure_system() # /etc/pacman.d/mirrorlist # add installer-selected mirror to the top of the mirrorlist if [ "$var_PKG_SOURCE_TYPE" = "ftp" -a "${SYNC_URL}" != "" ]; then - awk "BEGIN { printf(\"# Mirror used during installation\nServer = "${SYNC_URL}"\n\n\") } 1 " "${var_TARGET_DIR}/etc/pacman.d/mirrorlist" + debug "Adding choosen mirror (${SYNC_URL}) to ${var_TARGET_DIR}/$var_MIRRORLIST" + mirrorlist=`awk "BEGIN { printf(\"# Mirror used during installation\nServer = "${SYNC_URL}"\n\n\") } 1 " "${var_TARGET_DIR}/$var_MIRRORLIST"` + echo "$mirrorlist" > "${var_TARGET_DIR}/$var_MIRRORLIST" #TODO: test this, this may not work fi # /etc/rc.conf -- cgit v1.2.3-54-g00ecf From aa963b8ddb844383346aaa70bf49f4417896d693 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Thu, 18 Dec 2008 16:43:07 +0100 Subject: quickinst very early WIP --- src/core/procedures/quickinst | 108 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 106 insertions(+), 2 deletions(-) diff --git a/src/core/procedures/quickinst b/src/core/procedures/quickinst index 9e92c03..314569c 100644 --- a/src/core/procedures/quickinst +++ b/src/core/procedures/quickinst @@ -1,7 +1,111 @@ #!/bin/sh +depend_procedure core base -quickinst_finished () +# This is a port of the original /arch/quickinst script. + +# TODO: nowhere rely on /tmp + + +# TODO: find a way to make profilespecific arguments and usage function work (see src/aif.sh) +usage() { + echo "quickinst " + echo + echo "This script is for users who would rather partition/mkfs/mount their target" + echo "media manually than go through the routines in the setup script." + echo + echo "First make sure you have all your filesystems mounted under ." + echo "e.g. mount -t iso9660 /dev/sdc or /dev/sr0 (for new naming sheme) /src " + echo "Then run this script to install all base packages to ." + echo + if [ -e /usr/bin/wget ]; then + echo " must be either 'ftp' or 'cd'" + else + echo " must be 'cd'" + fi + echo + echo "Examples:" + if [ -e /usr/bin/wget ]; then + if [ "$(uname -m)" = "x86_64" ]; then + echo " quickinst ftp /mnt ftp://ftp.archlinux.org/core/os/x86_64" + else + echo " quickinst ftp /mnt ftp://ftp.archlinux.org/core/os/i686" + fi + fi + + echo " quickinst cd /mnt /src/core/pkg" + echo "" + exit 0 +} + + +# TODO: implement correctly +worker_configure () { +# var_PKG_SOURCE_TYPE +# var_TARGET_DIR +# var_FILE_URL or var_SYNC_URL +} + +# TODO: clean up everything below this + +PACMAN= +[ -f /tmp/usr/bin/pacman.static ] && PACMAN=/tmp/usr/bin/pacman.static +[ -f /usr/bin/pacman.static ] && PACMAN=/usr/bin/pacman.static +if [ "$PACMAN" = "" ]; then + cd /tmp + if [ "$INSTMODE" = "ftp" ]; then + echo "Downloading pacman..." + wget $PKGARG/pacman*.pkg.tar.gz + if [ $? -gt 0 ]; then + echo "error: Download failed" + exit 1 + fi + tar -xzf pacman*.pkg.tar.gz + elif [ "$INSTMODE" = "cd" ]; then + echo "Unpacking pacman..." + tar -xzf $PKGARG/pacman*.pkg.tar.gz + fi +fi +[ -f /tmp/usr/bin/pacman.static ] && PACMAN=/tmp/usr/bin/pacman.static +if [ "$PACMAN" = "" ]; then + echo "error: Cannot find the pacman.static binary!" + exit 1 +fi + +if [ "$INSTMODE" = "ftp" ]; then + echo "[core]" >/tmp/pacman.conf + echo "Server = $PKGARG" >>/tmp/pacman.conf + mkdir -p $DESTDIR/var/cache/pacman/pkg /var/cache/pacman >/dev/null 2>&1 + rm -f /var/cache/pacman/pkg >/dev/null 2>&1 + ln -sf $DESTDIR/var/cache/pacman/pkg /var/cache/pacman/pkg >/dev/null 2>&1 +fi + +if [ "$INSTMODE" = "cd" ]; then + echo "[core]" >/tmp/pacman.conf + echo "Server = file://$PKGARG" >>/tmp/pacman.conf + mkdir -p $DESTDIR/var/cache/pacman/pkg /var/cache/pacman >/dev/null 2>&1 + rm -f /var/cache/pacman/pkg >/dev/null 2>&1 + ln -sf $PKGARG /var/cache/pacman/pkg >/dev/null 2>&1 +fi + +! [ -d $DESTDIR/var/lib/pacman ] && mkdir -p $DESTDIR/var/lib/pacman +! [ -d /var/lib/pacman ] && mkdir -p /var/lib/pacman +# mount proc/sysfs first, so mkinitrd can use auto-detection if it wants +! [ -d $DESTDIR/proc ] && mkdir $DESTDIR/proc +! [ -d $DESTDIR/sys ] && mkdir $DESTDIR/sys +! [ -d $DESTDIR/dev ] && mkdir $DESTDIR/dev +mount -t proc none $DESTDIR/proc +mount -t sysfs none $DESTDIR/sys +mount -o bind /dev $DESTDIR/dev +$PACMAN -r $DESTDIR --config /tmp/pacman.conf -Sy base +umount $DESTDIR/proc $DESTDIR/sys $DESTDIR/dev +if [ $? -gt 0 ]; then + echo + echo "Package installation FAILED." + echo + exit 1 +fi + echo echo "Package installation complete." echo @@ -37,4 +141,4 @@ echo echo "Then exit your chroot shell, edit $DESTDIR/etc/fstab and" echo "$DESTDIR/etc/rc.conf, and reboot!" echo -} +exit 0 -- cgit v1.2.3-54-g00ecf From 6287241224d0097989ecfe523f61616c3b706d73 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Thu, 18 Dec 2008 19:33:01 +0100 Subject: todo updates --- TODO | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TODO b/TODO index ead4ef5..530e07f 100644 --- a/TODO +++ b/TODO @@ -13,7 +13,8 @@ ALPHA PHASE: get some people to test and suggest ideas, while fixing bugs and re * lib things sometimes call die_error but we go back to the menu.. or something.. i think * automatically configure grub for dm_crypt and lvm * move "/tmp/pacman.conf" to runtime directory and variablize everywhere - +* hmm wasn't there a hwdetect/hwd or something in /arch/setup? this seems to have disappeared. +* shouldn't we put /etc/hostname in 'configure system' ? BETA PHASE: try to get aif on the (beta) installcd as an experimental, alternative installer. * find a way to not have to preload libs and stuff, only load them when needed. -> faster start of install program -- cgit v1.2.3-54-g00ecf From fc9c98d9c348daa0f082fa59f47516993a70d794 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Thu, 18 Dec 2008 19:33:16 +0100 Subject: network + svn fixes --- unofficial/modules/dieter/procedures/automatic | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/unofficial/modules/dieter/procedures/automatic b/unofficial/modules/dieter/procedures/automatic index 3907fa2..2887e1d 100644 --- a/unofficial/modules/dieter/procedures/automatic +++ b/unofficial/modules/dieter/procedures/automatic @@ -48,10 +48,9 @@ worker_runtime_network () { if ask_yesno "Do you want to (re)-configure your networking?" then - #TODO: which function do i need here? - donetwork #configure network by using library + interactive_runtime_network else - notify "Ok. skipping network config" + infofy "Ok. skipping network config" fi } @@ -62,7 +61,8 @@ worker_runtime_svn () 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 - TARGET_HOST=desktop-a7n8x #TODO: prompt user for this, or let him pass it as cmdline argument (and check with svn info) + ask_string "Which host are you installing?" desktop-a7nx8 + TARGET_HOST=$ANSWER_STRING #TODO: allow passing cmdline argument (and check with svn info). handle -z $ANSWER_STRING _accept_ssl_cert } -- cgit v1.2.3-54-g00ecf From 442e804b78716c9f9bd5a50076b76af608cf74f2 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Thu, 18 Dec 2008 19:43:12 +0100 Subject: 'dieter' is now project 'ddeploy' that aims to be usable to many people --- unofficial/modules/ddeploy/libs/lib-deployment.sh | 21 +++ unofficial/modules/ddeploy/procedures/automatic | 152 ++++++++++++++++++++++ unofficial/modules/ddeploy/whatsthis.txt | 9 ++ unofficial/modules/dieter/libs/lib-deployment.sh | 21 --- unofficial/modules/dieter/procedures/automatic | 152 ---------------------- unofficial/modules/dieter/whatsthis.txt | 2 - 6 files changed, 182 insertions(+), 175 deletions(-) create mode 100644 unofficial/modules/ddeploy/libs/lib-deployment.sh create mode 100644 unofficial/modules/ddeploy/procedures/automatic create mode 100644 unofficial/modules/ddeploy/whatsthis.txt delete mode 100644 unofficial/modules/dieter/libs/lib-deployment.sh delete mode 100644 unofficial/modules/dieter/procedures/automatic delete mode 100644 unofficial/modules/dieter/whatsthis.txt diff --git a/unofficial/modules/ddeploy/libs/lib-deployment.sh b/unofficial/modules/ddeploy/libs/lib-deployment.sh new file mode 100644 index 0000000..da63f3f --- /dev/null +++ b/unofficial/modules/ddeploy/libs/lib-deployment.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +_accept_ssl_cert () +{ + mkdir -p /root/.subversion/auth/svn.ssl.server + cat > /root/.subversion/auth/svn.ssl.server/1123d3c8b27895efee3848cc779e526a << EOF +K 10 +ascii_cert +V 716 +MIICFTCCAX6gAwIBAgIBAjANBgkqhkiG9w0BAQQFADBVMRswGQYDVQQKExJBcGFjaGUgSFRUUCBTZXJ2ZXIxIjAgBgNVBAsTGUZvciB0ZXN0aW5nIHB1cnBvc2VzIG9ubHkxEjAQBgNVBAMTCWxvY2FsaG9zdDAeFw0wNjA3MjQxMjUwMzdaFw0wNzA3MjQxMjUwMzdaMEwxGzAZBgNVBAoTEkFwYWNoZSBIVFRQIFNlcnZlcjEZMBcGA1UECxMQVGVzdCBDZXJ0aWZpY2F0ZTESMBAGA1UEAxMJbG9jYWxob3N0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDF5PB1NnUve2jkisDTGsxKC9qzpnl+eX8UIR/1s+yX2ZIPNnIryeqTc6sS3cBHz2/AufIr0xbpXkTa4V5Es5bXA7W1D7+ZzuFHjjyi4E2eqYVkhkv1sRL5TpAovfjAA+96iaFHp3yKYiuw/nWwQTSW9M1VrDEym4ODxyJOtNdgQQIDAQABMA0GCSqGSIb3DQEBBAUAA4GBABY0bnBf9tL1WMC1sLxB1eDXvs5qNY96mny+EKGAbyQROPaXwsRQB0HrAkuWfHzQlgIdD6AfGsd+YMcEuqSPzIz6t6mA45jl++WvI6we9t3eYChtdPD2xjgHti0aSiDyVLTJbXPnkdgzKvIjYZcXBwbmbQSrg0STO5m+cSYt3chx +K 8 +failures +V 2 +14 +K 15 +svn:realmstring +V 23 +https://192.168.1.2:443 +END +EOF +} diff --git a/unofficial/modules/ddeploy/procedures/automatic b/unofficial/modules/ddeploy/procedures/automatic new file mode 100644 index 0000000..2887e1d --- /dev/null +++ b/unofficial/modules/ddeploy/procedures/automatic @@ -0,0 +1,152 @@ +#!/bin/bash +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 "Dieter::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 + 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 cmdline argument (and check with svn info). handle -z $ANSWER_STRING + _accept_ssl_cert +} + + +worker_prepare_disks () +{ + modprobe dm-crypt || die_error "Cannot modprobe dm-crypt" + modprobe -q aes-x86-64 || modprobe aes-i586 || die_error "Cannot modprobe aes-x86-64 or aes-i586" + + # Cleanup whatever state the disk is in (that includes previous, failed runs of this script) + umount /dev/mapper/cryptpool-* 2>/dev/null + vgremove -f cryptpool 2>/dev/null + pvremove /dev/mapper/sda2_crypt 2>/dev/null + cryptsetup luksClose sda2_crypt 2>/dev/null + dd if=/dev/urandom of=/dev/sda bs=512 count=1 + + #TODO: integrate this stuff into the functions in the libs (process_partitions and filesystems, rollback and bailout if needed) + do error checking and handling + #NOTE: i don't think i should quote to prevent globbing, but it does seem to help i think (hard to check as resource is busy and you can't reload kernel partition tables) + sfdisk /dev/sda 2>&1 | grep -v 'not have an msdos signature' << EOF +,10,L,'*' +,,L +EOF + [ $? -gt 0 ] && die_error "Could not sfdisk /dev/sda. Return code is $?" + #TODO: when sfdisk is done, i still have an invalid partition table? + cryptsetup --batch-mode -c aes-xts-plain -y -s 512 luksFormat /dev/sda2 || die_error "Cannot cryptsetup luksFormat /dev/sda2" + cryptsetup luksOpen /dev/sda2 sda2_crypt || die_error "Cannot cryptsetup luksOpen /dev/sda2" + pvcreate /dev/mapper/sda2_crypt || die_error "Cannot pvcreate the PV on the encrypted blockdevice" + vgcreate cryptpool /dev/mapper/sda2_crypt || die_error "Cannot create the VG an the PV on the encrypted blockdevice" + lvcreate -L 2G -n swap cryptpool && \ + lvcreate -L 500M -n tmp cryptpool && \ + lvcreate -L 10G -n home cryptpool && \ + lvcreate -L 10G -n root cryptpool && \ + lvcreate -L 3G -n var cryptpool || die_error "Could not create at least one of the LV's" + for i in home root tmp var + do + mkdir -p $var_TARGET_DIR/$i + mke2fs -j /dev/cryptpool/$i && mount /dev/cryptpool/$i $var_TARGET_DIR/$i || die_error "Could not format or mount $var_TARGET_DIR/$i" + done + + # TODO: swapon the thing and don't forget to swapoff it in the cleanup part above + # 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/whatsthis.txt b/unofficial/modules/ddeploy/whatsthis.txt new file mode 100644 index 0000000..eb7b810 --- /dev/null +++ b/unofficial/modules/ddeploy/whatsthis.txt @@ -0,0 +1,9 @@ +ddeploy is a module for deploying a system automatically. + +Right now I use convention over configuration. +Your disk layout, package list, /etc/, ~ etc are expected to be in certain places inside svn/ddm/git repositories. +(although I'll probably make this more configurable in the future to allow more choice in vcs technology etc.) + +Right now I (Dieter) am probably the only one using this, but everyone can have a similar setup! +For now the conventions are not documented yet. +Just look at the source of the procedures to see what is expected where. \ No newline at end of file diff --git a/unofficial/modules/dieter/libs/lib-deployment.sh b/unofficial/modules/dieter/libs/lib-deployment.sh deleted file mode 100644 index da63f3f..0000000 --- a/unofficial/modules/dieter/libs/lib-deployment.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -_accept_ssl_cert () -{ - mkdir -p /root/.subversion/auth/svn.ssl.server - cat > /root/.subversion/auth/svn.ssl.server/1123d3c8b27895efee3848cc779e526a << EOF -K 10 -ascii_cert -V 716 -MIICFTCCAX6gAwIBAgIBAjANBgkqhkiG9w0BAQQFADBVMRswGQYDVQQKExJBcGFjaGUgSFRUUCBTZXJ2ZXIxIjAgBgNVBAsTGUZvciB0ZXN0aW5nIHB1cnBvc2VzIG9ubHkxEjAQBgNVBAMTCWxvY2FsaG9zdDAeFw0wNjA3MjQxMjUwMzdaFw0wNzA3MjQxMjUwMzdaMEwxGzAZBgNVBAoTEkFwYWNoZSBIVFRQIFNlcnZlcjEZMBcGA1UECxMQVGVzdCBDZXJ0aWZpY2F0ZTESMBAGA1UEAxMJbG9jYWxob3N0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDF5PB1NnUve2jkisDTGsxKC9qzpnl+eX8UIR/1s+yX2ZIPNnIryeqTc6sS3cBHz2/AufIr0xbpXkTa4V5Es5bXA7W1D7+ZzuFHjjyi4E2eqYVkhkv1sRL5TpAovfjAA+96iaFHp3yKYiuw/nWwQTSW9M1VrDEym4ODxyJOtNdgQQIDAQABMA0GCSqGSIb3DQEBBAUAA4GBABY0bnBf9tL1WMC1sLxB1eDXvs5qNY96mny+EKGAbyQROPaXwsRQB0HrAkuWfHzQlgIdD6AfGsd+YMcEuqSPzIz6t6mA45jl++WvI6we9t3eYChtdPD2xjgHti0aSiDyVLTJbXPnkdgzKvIjYZcXBwbmbQSrg0STO5m+cSYt3chx -K 8 -failures -V 2 -14 -K 15 -svn:realmstring -V 23 -https://192.168.1.2:443 -END -EOF -} diff --git a/unofficial/modules/dieter/procedures/automatic b/unofficial/modules/dieter/procedures/automatic deleted file mode 100644 index 2887e1d..0000000 --- a/unofficial/modules/dieter/procedures/automatic +++ /dev/null @@ -1,152 +0,0 @@ -#!/bin/bash -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 "Dieter::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 - 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 cmdline argument (and check with svn info). handle -z $ANSWER_STRING - _accept_ssl_cert -} - - -worker_prepare_disks () -{ - modprobe dm-crypt || die_error "Cannot modprobe dm-crypt" - modprobe -q aes-x86-64 || modprobe aes-i586 || die_error "Cannot modprobe aes-x86-64 or aes-i586" - - # Cleanup whatever state the disk is in (that includes previous, failed runs of this script) - umount /dev/mapper/cryptpool-* 2>/dev/null - vgremove -f cryptpool 2>/dev/null - pvremove /dev/mapper/sda2_crypt 2>/dev/null - cryptsetup luksClose sda2_crypt 2>/dev/null - dd if=/dev/urandom of=/dev/sda bs=512 count=1 - - #TODO: integrate this stuff into the functions in the libs (process_partitions and filesystems, rollback and bailout if needed) + do error checking and handling - #NOTE: i don't think i should quote to prevent globbing, but it does seem to help i think (hard to check as resource is busy and you can't reload kernel partition tables) - sfdisk /dev/sda 2>&1 | grep -v 'not have an msdos signature' << EOF -,10,L,'*' -,,L -EOF - [ $? -gt 0 ] && die_error "Could not sfdisk /dev/sda. Return code is $?" - #TODO: when sfdisk is done, i still have an invalid partition table? - cryptsetup --batch-mode -c aes-xts-plain -y -s 512 luksFormat /dev/sda2 || die_error "Cannot cryptsetup luksFormat /dev/sda2" - cryptsetup luksOpen /dev/sda2 sda2_crypt || die_error "Cannot cryptsetup luksOpen /dev/sda2" - pvcreate /dev/mapper/sda2_crypt || die_error "Cannot pvcreate the PV on the encrypted blockdevice" - vgcreate cryptpool /dev/mapper/sda2_crypt || die_error "Cannot create the VG an the PV on the encrypted blockdevice" - lvcreate -L 2G -n swap cryptpool && \ - lvcreate -L 500M -n tmp cryptpool && \ - lvcreate -L 10G -n home cryptpool && \ - lvcreate -L 10G -n root cryptpool && \ - lvcreate -L 3G -n var cryptpool || die_error "Could not create at least one of the LV's" - for i in home root tmp var - do - mkdir -p $var_TARGET_DIR/$i - mke2fs -j /dev/cryptpool/$i && mount /dev/cryptpool/$i $var_TARGET_DIR/$i || die_error "Could not format or mount $var_TARGET_DIR/$i" - done - - # TODO: swapon the thing and don't forget to swapoff it in the cleanup part above - # 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/dieter/whatsthis.txt b/unofficial/modules/dieter/whatsthis.txt deleted file mode 100644 index 5c55ca8..0000000 --- a/unofficial/modules/dieter/whatsthis.txt +++ /dev/null @@ -1,2 +0,0 @@ -module with stuff for my (Dieter) own environment. Customized for my needs -(my data and settings are in svn/ddm repositories) \ No newline at end of file -- cgit v1.2.3-54-g00ecf From e70c69d7e5628fd5ebaf1836206113ceaf9b7354 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Thu, 18 Dec 2008 19:54:54 +0100 Subject: use libs now for blockdevice stuff + some smallish shit --- unofficial/modules/ddeploy/procedures/automatic | 50 +++++++------------------ 1 file changed, 13 insertions(+), 37 deletions(-) diff --git a/unofficial/modules/ddeploy/procedures/automatic b/unofficial/modules/ddeploy/procedures/automatic index 2887e1d..1756ce8 100644 --- a/unofficial/modules/ddeploy/procedures/automatic +++ b/unofficial/modules/ddeploy/procedures/automatic @@ -1,4 +1,5 @@ #!/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 @@ -21,7 +22,7 @@ phase_finish=(configure_home msg_report) worker_intro () { - notify "Dieter::automatic procedure running..." + notify "DDeploy::automatic procedure running..." } @@ -57,52 +58,27 @@ worker_runtime_network () worker_runtime_svn () { - SVN_USERNAME=dieter + 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 cmdline argument (and check with svn info). handle -z $ANSWER_STRING + 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 () { - modprobe dm-crypt || die_error "Cannot modprobe dm-crypt" - modprobe -q aes-x86-64 || modprobe aes-i586 || die_error "Cannot modprobe aes-x86-64 or aes-i586" - - # Cleanup whatever state the disk is in (that includes previous, failed runs of this script) - umount /dev/mapper/cryptpool-* 2>/dev/null - vgremove -f cryptpool 2>/dev/null - pvremove /dev/mapper/sda2_crypt 2>/dev/null - cryptsetup luksClose sda2_crypt 2>/dev/null - dd if=/dev/urandom of=/dev/sda bs=512 count=1 - - #TODO: integrate this stuff into the functions in the libs (process_partitions and filesystems, rollback and bailout if needed) + do error checking and handling - #NOTE: i don't think i should quote to prevent globbing, but it does seem to help i think (hard to check as resource is busy and you can't reload kernel partition tables) - sfdisk /dev/sda 2>&1 | grep -v 'not have an msdos signature' << EOF -,10,L,'*' -,,L -EOF - [ $? -gt 0 ] && die_error "Could not sfdisk /dev/sda. Return code is $?" - #TODO: when sfdisk is done, i still have an invalid partition table? - cryptsetup --batch-mode -c aes-xts-plain -y -s 512 luksFormat /dev/sda2 || die_error "Cannot cryptsetup luksFormat /dev/sda2" - cryptsetup luksOpen /dev/sda2 sda2_crypt || die_error "Cannot cryptsetup luksOpen /dev/sda2" - pvcreate /dev/mapper/sda2_crypt || die_error "Cannot pvcreate the PV on the encrypted blockdevice" - vgcreate cryptpool /dev/mapper/sda2_crypt || die_error "Cannot create the VG an the PV on the encrypted blockdevice" - lvcreate -L 2G -n swap cryptpool && \ - lvcreate -L 500M -n tmp cryptpool && \ - lvcreate -L 10G -n home cryptpool && \ - lvcreate -L 10G -n root cryptpool && \ - lvcreate -L 3G -n var cryptpool || die_error "Could not create at least one of the LV's" - for i in home root tmp var - do - mkdir -p $var_TARGET_DIR/$i - mke2fs -j /dev/cryptpool/$i && mount /dev/cryptpool/$i $var_TARGET_DIR/$i || die_error "Could not format or mount $var_TARGET_DIR/$i" - done - - # TODO: swapon the thing and don't forget to swapoff it in the cleanup part above + 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 } -- cgit v1.2.3-54-g00ecf 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 From ce3afefeb9728619a06989a67e7ffd5ed299ecf8 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 11:47:18 +0100 Subject: softcode architecture + some small misc stuff in yaourt lib --- src/core/libs/lib-ui-interactive.sh | 2 +- src/core/procedures/base | 2 ++ src/core/procedures/quickinst | 6 +----- unofficial/modules/yaourt/libs/lib-yaourt-sh | 9 +++++---- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh index f7f4ecb..543495a 100644 --- a/src/core/libs/lib-ui-interactive.sh +++ b/src/core/libs/lib-ui-interactive.sh @@ -864,7 +864,7 @@ interactive_select_mirror() { ask_option no "Mirror selection" "Select an FTP/HTTP mirror" $MIRRORS "Custom" "_" || return 1 local _server=$ANSWER_OPTION if [ "${_server}" = "Custom" ]; then - ask_string "Enter the full URL to core repo." "ftp://ftp.archlinux.org/core/os/i686" || return 1 + ask_string "Enter the full URL to core repo." "ftp://ftp.archlinux.org/core/os/$var_ARCH" || return 1 var_SYNC_URL=$ANSWER_STRING else # Form the full URL for our mirror by grepping for the server name in diff --git a/src/core/procedures/base b/src/core/procedures/base index fa88210..94a9d1e 100644 --- a/src/core/procedures/base +++ b/src/core/procedures/base @@ -7,6 +7,8 @@ var_RUNTIME_PACKAGES= var_PKG_FILE=$RUNTIME_DIR/package-list var_MIRRORLIST="/etc/pacman.d/mirrorlist" var_UI_TYPE="cli" # set to cli or dia for dialog +var_ARCH=`uname -m` #works for i686 TODO: check if it works for x86_64 +[ -z "$var_ARCH" ] && die_error "Could not determine your architecture" ###### Phases ( can be overridden by more specific procedures) ###### phase_preparation=(\ diff --git a/src/core/procedures/quickinst b/src/core/procedures/quickinst index 314569c..73c1f46 100644 --- a/src/core/procedures/quickinst +++ b/src/core/procedures/quickinst @@ -25,11 +25,7 @@ usage() { echo echo "Examples:" if [ -e /usr/bin/wget ]; then - if [ "$(uname -m)" = "x86_64" ]; then - echo " quickinst ftp /mnt ftp://ftp.archlinux.org/core/os/x86_64" - else - echo " quickinst ftp /mnt ftp://ftp.archlinux.org/core/os/i686" - fi + echo " quickinst ftp /mnt ftp://ftp.archlinux.org/core/os/$var_ARCH" fi echo " quickinst cd /mnt /src/core/pkg" diff --git a/unofficial/modules/yaourt/libs/lib-yaourt-sh b/unofficial/modules/yaourt/libs/lib-yaourt-sh index fd9c4d0..56e03df 100644 --- a/unofficial/modules/yaourt/libs/lib-yaourt-sh +++ b/unofficial/modules/yaourt/libs/lib-yaourt-sh @@ -6,16 +6,17 @@ _runtime_yaourt () { if ! list_pacman_repos runtime | grep -q archlinuxfr then - add_pacman_repo runtime archlinuxfr 'Server = http://repo.archlinux.fr/i686' + add_pacman_repo runtime archlinuxfr "Server = http://repo.archlinux.fr/$var_ARCH" fi - $PACMAN -Sy yaourt || die_error "_runtime_yaourt Cannot install yaourt" - YAOURT=`sed 's/pacman/yaourt/' <<< $PACMAN` - YAOURT_TARGET=`sed 's/pacman/yaourt/' <<< $PACMAN_TARGET` + $PACMAN -Sy yaourt || die_error "_runtime_yaourt Cannot install yaourt" #TODO: library-ize package installation + YAOURT=${PACMAN//pacman/yaourt} + YAOURT_TARGET=${PACMAN_TARGET//pacman/yaourt} } _yaourt_replace_pacman () { + show_warning "Security warning!" "Keep in mind that packages on AUR are untrusted! Install them on your own risk" _runtime_yaourt PACMAN=$YAOURT PACMAN_TARGET=$YAOURT_TARGET -- cgit v1.2.3-54-g00ecf From 95f3f3afda165a64e1b4c96e9c1ee1fb86350df0 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 11:47:31 +0100 Subject: todo updates --- TODO | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/TODO b/TODO index 530e07f..b019c30 100644 --- a/TODO +++ b/TODO @@ -15,6 +15,13 @@ ALPHA PHASE: get some people to test and suggest ideas, while fixing bugs and re * move "/tmp/pacman.conf" to runtime directory and variablize everywhere * hmm wasn't there a hwdetect/hwd or something in /arch/setup? this seems to have disappeared. * shouldn't we put /etc/hostname in 'configure system' ? +* a nice way to be able to "inject" functions without: + * needing to redefine phases with only 1 entry different + * override worker functions which are 90% copy-pasted because the parent functionality is mostly okay, but not exactly what we want + useful for: profiles for the automatic procedures, or all other procedures + -> optional pre/post callbacks (for workers and phases)? + -> disadvantages? + BETA PHASE: try to get aif on the (beta) installcd as an experimental, alternative installer. * find a way to not have to preload libs and stuff, only load them when needed. -> faster start of install program -- cgit v1.2.3-54-g00ecf From 94f9fb4dd5fd4a9427de5aeb47a2276b139a98bf Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 12:24:25 +0100 Subject: first version of new argument parsing where we load module/procedure first so we can override the arg parsing behavior --- src/aif.sh | 77 +++++++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 49 insertions(+), 28 deletions(-) diff --git a/src/aif.sh b/src/aif.sh index 9bdea2d..4ef130e 100755 --- a/src/aif.sh +++ b/src/aif.sh @@ -12,7 +12,7 @@ LOGFILE=$RUNTIME_DIR/aif.log usage () { #NOTE: you can't use dia mode here yet because lib-ui isn't sourced yet. But cli is ok for this anyway. - msg="aif -p Select a procedure + msg="aif -p Select a procedure # If given, this *must* be the first option -i Override interface type (optional) -d Explicitly enable debugging (optional) -l Explicitly enable logging to file (optional) @@ -271,13 +271,55 @@ module= procedure= -# TODO: you cannot override $var_OPTS_STRING, nor process_args. because profile not sourced yet -# we will hit '?)' and exit 5 -# solutions? don't make $var_OPTS_STRING overridable, source correct profile as early as possible so process_args gets known. remove the '?)' catchall (eg put it in the default process_args) so we don't hit it accidentially + # in that case -p needs to be the first option, but that's doable imho # an alternative would be to provide an argumentstring for the profile. eg aif -p profile -a "-a a -b b -c c" var_OPTS_STRING=":i:dlp:" # you can override this variable in your procedure. + + +# Processes args that were not already matched by the basic rules. +process_args () +{ + # known options: we don't know any yet + # return 0 + + # if we are still here, we didn't return 0 for a known option. hence this is an unknown option + usage + exit 5 +} + + +# Check if the first args are -p . If so, we can load the procedure, and hence $var_OPTS_STRING and process_args can be overridden +if [ "$1" = '-p' ] +then + [ -z "$2" ] && usage && exit 1 + # note that we allow procedures like http://foo/bar. module -> http:, procedure -> http://foo/bar. + if [[ $2 =~ ^http:// ]] + then + module=http + procedure="$2" + elif grep -q '\/' <<< "$2" + then + #user specified module/procedure + module=`dirname "$2"` + procedure=`basename "$2"` + else + module=core + procedure="$2" + fi + + shift 2 +fi + +# If no procedure given, bail out +[ -z "$procedure" ] && usage && exit 5 + +load_module core +[ "$module" != core -a "$module" != http ] && load_module "$module" + +load_procedure "$module" "$procedure" + while getopts $var_OPTS_STRING OPTION do case $OPTION in @@ -294,41 +336,20 @@ do LOG_TO_FILE=1 ;; p) - [ -z "$OPTARG" ] && usage && exit 1 - # note that we allow procedures like http://foo/bar. module -> http:, procedure -> http://foo/bar. - if [[ $OPTARG =~ ^http:// ]] - then - module=http - procedure="$OPTARG" - elif grep -q '\/' <<< "$OPTARG" - then - #user specified module/procedure - module=`dirname "$OPTARG"` - procedure=`basename "$OPTARG"` - else - module=core - procedure="$OPTARG" - fi + die_error "If you pass -p , it must be the FIRST option" ;; h) usage exit ;; ?) - usage - exit 5 + # If we hit something elso, call process_args + process_args $OPTION $OPTARG # you can override this function in your profile to parse additional arguments and/or override the behavior above ;; esac - process_args $OPTION $OPTARG # you can override this function in your profile to parse additional arguments and/or override the behavior above done -[ -z "$procedure" ] && usage && exit 5 - -load_module core -[ "$module" != core -a "$module" != http ] && load_module "$module" - -load_procedure "$module" "$procedure" # Set pacman vars. allow procedures to have set $var_TARGET_DIR (TODO: look up how delayed variable substitution works. then we can put this at the top again) # flags like --noconfirm should not be specified here. it's up to the procedure to decide the interactivity -- cgit v1.2.3-54-g00ecf From e52b89a11e513584df6bae59c38b8336c79c93bf Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 12:26:27 +0100 Subject: todo updates --- TODO | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TODO b/TODO index b019c30..cdc009d 100644 --- a/TODO +++ b/TODO @@ -20,7 +20,7 @@ ALPHA PHASE: get some people to test and suggest ideas, while fixing bugs and re * override worker functions which are 90% copy-pasted because the parent functionality is mostly okay, but not exactly what we want useful for: profiles for the automatic procedures, or all other procedures -> optional pre/post callbacks (for workers and phases)? - -> disadvantages? + -> disadvantages? ended_ok must comprise callbacks too.. or if callback didn't exit cleanly, maybe we should update the exit code of the worker/phase BETA PHASE: try to get aif on the (beta) installcd as an experimental, alternative installer. -- cgit v1.2.3-54-g00ecf From 7e52204f8bb45e45fbeb9020fda0b7b86a28094f Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 12:28:24 +0100 Subject: todo updates --- TODO | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TODO b/TODO index cdc009d..a1bfcd3 100644 --- a/TODO +++ b/TODO @@ -14,7 +14,7 @@ ALPHA PHASE: get some people to test and suggest ideas, while fixing bugs and re * automatically configure grub for dm_crypt and lvm * move "/tmp/pacman.conf" to runtime directory and variablize everywhere * hmm wasn't there a hwdetect/hwd or something in /arch/setup? this seems to have disappeared. -* shouldn't we put /etc/hostname in 'configure system' ? +* shouldn't we put /etc/hostname in 'configure system' ? ASKDEV * a nice way to be able to "inject" functions without: * needing to redefine phases with only 1 entry different * override worker functions which are 90% copy-pasted because the parent functionality is mostly okay, but not exactly what we want -- cgit v1.2.3-54-g00ecf From 440e64fc28c4bb22782bc9eb2842c773707ab49a Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 12:45:15 +0100 Subject: enhanced arg parsing + automatic procedure can read configs now --- src/aif.sh | 4 ++-- src/core/procedures/automatic | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/aif.sh b/src/aif.sh index 4ef130e..2386992 100755 --- a/src/aif.sh +++ b/src/aif.sh @@ -275,7 +275,7 @@ procedure= # in that case -p needs to be the first option, but that's doable imho # an alternative would be to provide an argumentstring for the profile. eg aif -p profile -a "-a a -b b -c c" -var_OPTS_STRING=":i:dlp:" # you can override this variable in your procedure. +var_OPTS_STRING="" # you can override this variable in your procedure. # Processes args that were not already matched by the basic rules. @@ -320,7 +320,7 @@ load_module core load_procedure "$module" "$procedure" -while getopts $var_OPTS_STRING OPTION +while getopts ":i:dlp:$var_OPTS_STRING" OPTION do case $OPTION in i) diff --git a/src/core/procedures/automatic b/src/core/procedures/automatic index 0e47f7b..cdda847 100644 --- a/src/core/procedures/automatic +++ b/src/core/procedures/automatic @@ -3,12 +3,24 @@ # 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 +var_OPTS_STRING="c:" +process_args () +{ + [ "$1" = '-c' ] + then + [ -z "$2" ] && die_error "You must specify a config" + source $2 || die_error "Could not source config $2" + else + usage + exit 5 + fi +} + phase_preparation=(\ configure \ intro \ -- cgit v1.2.3-54-g00ecf From a598e6f48d740619da60d59a10d7c3945f312563 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 12:58:19 +0100 Subject: cleaned up ddeploy and start making example config --- examples/deployconfig-dieter | 29 +++++++++++++++++++++++ unofficial/modules/ddeploy/libs/lib-deployment.sh | 21 ---------------- unofficial/modules/ddeploy/whatsthis.txt | 9 ------- 3 files changed, 29 insertions(+), 30 deletions(-) create mode 100644 examples/deployconfig-dieter delete mode 100644 unofficial/modules/ddeploy/libs/lib-deployment.sh delete mode 100644 unofficial/modules/ddeploy/whatsthis.txt diff --git a/examples/deployconfig-dieter b/examples/deployconfig-dieter new file mode 100644 index 0000000..c59bcc2 --- /dev/null +++ b/examples/deployconfig-dieter @@ -0,0 +1,29 @@ +#!/bin/bash +# An example config for the deployment procedure + +var_RUNTIME_PACKAGES="svn" + +DEPLOY_CLASS=desktop-a7n8x +SVN_USER=dieter +SVN_PASSWORD= + + +_accept_ssl_cert () +{ + mkdir -p /root/.subversion/auth/svn.ssl.server + cat > /root/.subversion/auth/svn.ssl.server/1123d3c8b27895efee3848cc779e526a << EOF +K 10 +ascii_cert +V 716 +MIICFTCCAX6gAwIBAgIBAjANBgkqhkiG9w0BAQQFADBVMRswGQYDVQQKExJBcGFjaGUgSFRUUCBTZXJ2ZXIxIjAgBgNVBAsTGUZvciB0ZXN0aW5nIHB1cnBvc2VzIG9ubHkxEjAQBgNVBAMTCWxvY2FsaG9zdDAeFw0wNjA3MjQxMjUwMzdaFw0wNzA3MjQxMjUwMzdaMEwxGzAZBgNVBAoTEkFwYWNoZSBIVFRQIFNlcnZlcjEZMBcGA1UECxMQVGVzdCBDZXJ0aWZpY2F0ZTESMBAGA1UEAxMJbG9jYWxob3N0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDF5PB1NnUve2jkisDTGsxKC9qzpnl+eX8UIR/1s+yX2ZIPNnIryeqTc6sS3cBHz2/AufIr0xbpXkTa4V5Es5bXA7W1D7+ZzuFHjjyi4E2eqYVkhkv1sRL5TpAovfjAA+96iaFHp3yKYiuw/nWwQTSW9M1VrDEym4ODxyJOtNdgQQIDAQABMA0GCSqGSIb3DQEBBAUAA4GBABY0bnBf9tL1WMC1sLxB1eDXvs5qNY96mny+EKGAbyQROPaXwsRQB0HrAkuWfHzQlgIdD6AfGsd+YMcEuqSPzIz6t6mA45jl++WvI6we9t3eYChtdPD2xjgHti0aSiDyVLTJbXPnkdgzKvIjYZcXBwbmbQSrg0STO5m+cSYt3chx +K 8 +failures +V 2 +14 +K 15 +svn:realmstring +V 23 +https://192.168.1.2:443 +END +EOF +} diff --git a/unofficial/modules/ddeploy/libs/lib-deployment.sh b/unofficial/modules/ddeploy/libs/lib-deployment.sh deleted file mode 100644 index da63f3f..0000000 --- a/unofficial/modules/ddeploy/libs/lib-deployment.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -_accept_ssl_cert () -{ - mkdir -p /root/.subversion/auth/svn.ssl.server - cat > /root/.subversion/auth/svn.ssl.server/1123d3c8b27895efee3848cc779e526a << EOF -K 10 -ascii_cert -V 716 -MIICFTCCAX6gAwIBAgIBAjANBgkqhkiG9w0BAQQFADBVMRswGQYDVQQKExJBcGFjaGUgSFRUUCBTZXJ2ZXIxIjAgBgNVBAsTGUZvciB0ZXN0aW5nIHB1cnBvc2VzIG9ubHkxEjAQBgNVBAMTCWxvY2FsaG9zdDAeFw0wNjA3MjQxMjUwMzdaFw0wNzA3MjQxMjUwMzdaMEwxGzAZBgNVBAoTEkFwYWNoZSBIVFRQIFNlcnZlcjEZMBcGA1UECxMQVGVzdCBDZXJ0aWZpY2F0ZTESMBAGA1UEAxMJbG9jYWxob3N0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDF5PB1NnUve2jkisDTGsxKC9qzpnl+eX8UIR/1s+yX2ZIPNnIryeqTc6sS3cBHz2/AufIr0xbpXkTa4V5Es5bXA7W1D7+ZzuFHjjyi4E2eqYVkhkv1sRL5TpAovfjAA+96iaFHp3yKYiuw/nWwQTSW9M1VrDEym4ODxyJOtNdgQQIDAQABMA0GCSqGSIb3DQEBBAUAA4GBABY0bnBf9tL1WMC1sLxB1eDXvs5qNY96mny+EKGAbyQROPaXwsRQB0HrAkuWfHzQlgIdD6AfGsd+YMcEuqSPzIz6t6mA45jl++WvI6we9t3eYChtdPD2xjgHti0aSiDyVLTJbXPnkdgzKvIjYZcXBwbmbQSrg0STO5m+cSYt3chx -K 8 -failures -V 2 -14 -K 15 -svn:realmstring -V 23 -https://192.168.1.2:443 -END -EOF -} diff --git a/unofficial/modules/ddeploy/whatsthis.txt b/unofficial/modules/ddeploy/whatsthis.txt deleted file mode 100644 index eb7b810..0000000 --- a/unofficial/modules/ddeploy/whatsthis.txt +++ /dev/null @@ -1,9 +0,0 @@ -ddeploy is a module for deploying a system automatically. - -Right now I use convention over configuration. -Your disk layout, package list, /etc/, ~ etc are expected to be in certain places inside svn/ddm/git repositories. -(although I'll probably make this more configurable in the future to allow more choice in vcs technology etc.) - -Right now I (Dieter) am probably the only one using this, but everyone can have a similar setup! -For now the conventions are not documented yet. -Just look at the source of the procedures to see what is expected where. \ No newline at end of file -- cgit v1.2.3-54-g00ecf From 12cdf2d55775ee671968977d890f9a4d7ba95f1f Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 13:45:47 +0100 Subject: allow procedures to add stuff to usage output --- src/aif.sh | 7 +++++-- src/core/procedures/automatic | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/aif.sh b/src/aif.sh index 2386992..3a20e2e 100755 --- a/src/aif.sh +++ b/src/aif.sh @@ -22,6 +22,8 @@ If the procedurename is prefixed with '/' it will be loaded from use Available procedures on the filesystem: `find /home/arch/aif/core/procedures -type f`\n `find /home/arch/aif/user/*/procedures -type f 2>/dev/null`" + [ -z "$procedure" ] && msg="$msg\nProcedure ($procedure) specific options:\n$var_ARGS_USAGE" + echo -e "$msg" } @@ -275,8 +277,9 @@ procedure= # in that case -p needs to be the first option, but that's doable imho # an alternative would be to provide an argumentstring for the profile. eg aif -p profile -a "-a a -b b -c c" -var_OPTS_STRING="" # you can override this variable in your procedure. - +# you can override these variables in your procedures +var_OPTS_STRING="" +var_ARGS_USAGE="" # Processes args that were not already matched by the basic rules. process_args () diff --git a/src/core/procedures/automatic b/src/core/procedures/automatic index cdda847..ad279ce 100644 --- a/src/core/procedures/automatic +++ b/src/core/procedures/automatic @@ -4,11 +4,14 @@ # In theory, the only manual thing should maybe be configuring the runtime network # TODO: I don't know if you can do non-interactive dm_crypt stuff.. maybe by pulling luks keyfiles from svn/git/..? +# TODO: check_is_in runtime packages and check needed args, if not known ask (eg svn password) depend_module yaourt depend_procedure core base var_OPTS_STRING="c:" +var_ARGS_USAGE="-c : Specify a configfile (profile) to be used (Mandatory)" # TODO: don't check if the option is specified, but do checking on all variables that we need + process_args () { [ "$1" = '-c' ] -- cgit v1.2.3-54-g00ecf From 13908139f66dfc63258f16e22453e375f0a4ad06 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 14:08:37 +0100 Subject: todo updates --- TODO | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index a1bfcd3..6245a5d 100644 --- a/TODO +++ b/TODO @@ -16,11 +16,16 @@ ALPHA PHASE: get some people to test and suggest ideas, while fixing bugs and re * hmm wasn't there a hwdetect/hwd or something in /arch/setup? this seems to have disappeared. * shouldn't we put /etc/hostname in 'configure system' ? ASKDEV * a nice way to be able to "inject" functions without: - * needing to redefine phases with only 1 entry different + * needing to redefine phases with only 1 entry different (duplicate code is not nice, less maintainable etc) * override worker functions which are 90% copy-pasted because the parent functionality is mostly okay, but not exactly what we want useful for: profiles for the automatic procedures, or all other procedures -> optional pre/post callbacks (for workers and phases)? - -> disadvantages? ended_ok must comprise callbacks too.. or if callback didn't exit cleanly, maybe we should update the exit code of the worker/phase + -> disadvantages? + * ended_ok must comprise callbacks too.. or if callback didn't exit cleanly, maybe we should update the exit code of the worker/phase + * we lose semantics: a function usually has a better suited name then 'pre_'. + -> maybe we should in the callback do an execute call for another worker, then we also can check it's exitcode in a good way + -> too. although that's only good for separate functions, not the 'copypaste 90% and add 10% to the same worker scenario' + -> phases are arrays.. adding elements at the back is easy. for in the middle, we could maybe write some functions to add a worker before/after another in a phase BETA PHASE: try to get aif on the (beta) installcd as an experimental, alternative installer. -- cgit v1.2.3-54-g00ecf From bb8deddcdcbda2b7687c6e2ef31d443bd487c899 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 14:37:21 +0100 Subject: moo --- src/core/procedures/base | 1 - 1 file changed, 1 deletion(-) diff --git a/src/core/procedures/base b/src/core/procedures/base index 94a9d1e..632dda7 100644 --- a/src/core/procedures/base +++ b/src/core/procedures/base @@ -34,7 +34,6 @@ phase_system=(\ locales \ install_bootloader) - phase_finish=(msg_report) -- cgit v1.2.3-54-g00ecf From d3907f6e1ce359d83d72b8b45d735c7ee134c2b0 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 14:38:08 +0100 Subject: cleanup automatic deployment stuff --- examples/deployconfig-dieter | 16 +++++++++++- src/core/procedures/automatic | 60 ++++++++++++++++++++----------------------- 2 files changed, 43 insertions(+), 33 deletions(-) diff --git a/examples/deployconfig-dieter b/examples/deployconfig-dieter index c59bcc2..b7af73a 100644 --- a/examples/deployconfig-dieter +++ b/examples/deployconfig-dieter @@ -4,11 +4,25 @@ var_RUNTIME_PACKAGES="svn" DEPLOY_CLASS=desktop-a7n8x +HOSTNAME=dieter-ws SVN_USER=dieter SVN_PASSWORD= +SVN_BASE=https://192.168.1.2/svn/repos +phase_preparation+=(accept_ssl_cert) +phase_system+=(configure_home) -_accept_ssl_cert () + + +worker_configure () +{ + var_UI_TYPE=${arg_ui_type:-cli} + 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" +} + + +worker_accept_ssl_cert () { mkdir -p /root/.subversion/auth/svn.ssl.server cat > /root/.subversion/auth/svn.ssl.server/1123d3c8b27895efee3848cc779e526a << EOF diff --git a/src/core/procedures/automatic b/src/core/procedures/automatic index ad279ce..7e852b9 100644 --- a/src/core/procedures/automatic +++ b/src/core/procedures/automatic @@ -2,15 +2,17 @@ # 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 +# 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: check_is_in runtime packages and check needed args, if not known ask (eg svn password) depend_module yaourt depend_procedure core base var_OPTS_STRING="c:" -var_ARGS_USAGE="-c : Specify a configfile (profile) to be used (Mandatory)" # TODO: don't check if the option is specified, but do checking on all variables that we need +var_ARGS_USAGE="-c : Specify a configfile (profile) to be used (optional)" #if we need some settings that we're missing, we'll ask for them + +phase_preparation+=(runtime_settings) +phase_preparation+=(msg_automatic) # this can happen probably a bit earlier.. process_args () { @@ -24,19 +26,6 @@ process_args () fi } -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 () { @@ -50,9 +39,9 @@ worker_configure () } +# not used worker_msg_manual () { - # All things that need to be done manually first notify "A few manual things need to happen first..." } @@ -74,28 +63,35 @@ worker_runtime_network () } -worker_runtime_svn () +# Check if we have all needed settings loaded from the profile +worker_runtime_settings () { - 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 + if check_is_in svn "$var_RUNTIME_PACKAGES" + then + [ -n "$SVN_USERNAME" ] || ask_string "Please enter your svn username" && SVN_USERNAME=$ANSWER_STRING + [ -n "$SVN_PASSWORD" ] || ask_password svn #TODO: if user entered incorrect password, the install process will just fail.. + [ -n "$SVN_BASE" ] || ask_string "What's the base path of your svn repo? (no ending /) " && SVN_BASE=$ANSWER_STRING + [ -n "$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" + # Maybe more stuff later + true + fi + [ -n "$HOSTNAME" ] || ask_string "Hostname of target system?" && HOSTNAME=$ANSWER_STRING } 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 - + if ! process_filesystems + then + show_warning "Could not process_filesystems" + txt='also failed to execute properly' + rollback_filesystems && txt='ended successfully' + die_error "Something failed while processing the filesystem. A rollback was executed, which $txt" + fi + infofy "Partitions and filesystems made successfully" # TODO: fstab? auto-add to fstab with libs? auto mkdir's on target_dir? true -- cgit v1.2.3-54-g00ecf From f9568a5c862de5b313b44725752d62db72d25e61 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 14:40:17 +0100 Subject: output fix --- src/aif.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aif.sh b/src/aif.sh index 3a20e2e..ac82664 100755 --- a/src/aif.sh +++ b/src/aif.sh @@ -22,7 +22,7 @@ If the procedurename is prefixed with '/' it will be loaded from use Available procedures on the filesystem: `find /home/arch/aif/core/procedures -type f`\n `find /home/arch/aif/user/*/procedures -type f 2>/dev/null`" - [ -z "$procedure" ] && msg="$msg\nProcedure ($procedure) specific options:\n$var_ARGS_USAGE" + [ -n "$procedure" ] && msg="$msg\nProcedure ($procedure) specific options:\n$var_ARGS_USAGE" echo -e "$msg" -- cgit v1.2.3-54-g00ecf From 2fae9af8e549dbe9269ae4bde1b2269c99c17a35 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 14:41:23 +0100 Subject: syntax fix --- src/core/procedures/automatic | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/procedures/automatic b/src/core/procedures/automatic index 7e852b9..a776004 100644 --- a/src/core/procedures/automatic +++ b/src/core/procedures/automatic @@ -16,7 +16,7 @@ phase_preparation+=(msg_automatic) # this can happen probably a bit earlier.. process_args () { - [ "$1" = '-c' ] + if [ "$1" = '-c' ] then [ -z "$2" ] && die_error "You must specify a config" source $2 || die_error "Could not source config $2" -- cgit v1.2.3-54-g00ecf From 37103ea8afa907966062b94fc1708ca1bf5d8351 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 14:43:12 +0100 Subject: syntax fix --- src/core/procedures/automatic | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/procedures/automatic b/src/core/procedures/automatic index a776004..e2e4b00 100644 --- a/src/core/procedures/automatic +++ b/src/core/procedures/automatic @@ -74,6 +74,7 @@ worker_runtime_settings () [ -n "$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 -- cgit v1.2.3-54-g00ecf From ed462dc0f0ec6b4e60b5d1299dc858fa6b19978c Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 15:22:27 +0100 Subject: arg passing fix --- src/aif.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aif.sh b/src/aif.sh index ac82664..0db3d6c 100755 --- a/src/aif.sh +++ b/src/aif.sh @@ -347,7 +347,7 @@ do ;; ?) # If we hit something elso, call process_args - process_args $OPTION $OPTARG # you can override this function in your profile to parse additional arguments and/or override the behavior above + process_args -$OPTION $OPTARG # you can override this function in your profile to parse additional arguments and/or override the behavior above ;; esac -- cgit v1.2.3-54-g00ecf From 0111fdd1d6dbf6c988eb9a742f4934ead887d2d6 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 15:27:25 +0100 Subject: probably its better to only use svn after we installed it --- examples/deployconfig-dieter | 3 +-- src/core/procedures/automatic | 8 +++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/examples/deployconfig-dieter b/examples/deployconfig-dieter index b7af73a..1c334a2 100644 --- a/examples/deployconfig-dieter +++ b/examples/deployconfig-dieter @@ -14,9 +14,8 @@ phase_system+=(configure_home) -worker_configure () +worker_fetch_configs () { - var_UI_TYPE=${arg_ui_type:-cli} 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" } diff --git a/src/core/procedures/automatic b/src/core/procedures/automatic index e2e4b00..3f02832 100644 --- a/src/core/procedures/automatic +++ b/src/core/procedures/automatic @@ -13,7 +13,7 @@ var_ARGS_USAGE="-c : Specify a configfile (profile) to be used (optional phase_preparation+=(runtime_settings) phase_preparation+=(msg_automatic) # this can happen probably a bit earlier.. - +phase_preparation+=(fetch_configs) process_args () { if [ "$1" = '-c' ] @@ -52,6 +52,12 @@ worker_msg_automatic () } +worker_fetch_configs () +{ + true +} + + worker_runtime_network () { if ask_yesno "Do you want to (re)-configure your networking?" -- cgit v1.2.3-54-g00ecf From e8291396bf3879140fd7032414a5d417975152c9 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 15:34:47 +0100 Subject: variable name & logic fixes --- examples/deployconfig-dieter | 6 +++--- src/core/procedures/automatic | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/deployconfig-dieter b/examples/deployconfig-dieter index 1c334a2..6c9a909 100644 --- a/examples/deployconfig-dieter +++ b/examples/deployconfig-dieter @@ -5,7 +5,7 @@ var_RUNTIME_PACKAGES="svn" DEPLOY_CLASS=desktop-a7n8x HOSTNAME=dieter-ws -SVN_USER=dieter +SVN_USERNAME=dieter SVN_PASSWORD= SVN_BASE=https://192.168.1.2/svn/repos @@ -16,8 +16,8 @@ phase_system+=(configure_home) worker_fetch_configs () { - 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" + svn export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/trunk/disks/.blockdata $RUNTIME_DIR || die_error "Could not svn export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/trunk/disks/.blockdata into $RUNTIME_DIR" + svn export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/trunk/disks/.partitions $RUNTIME_DIR || die_error "Could not svn export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/trunk/disks/.partitions into $RUNTIME_DIR" } diff --git a/src/core/procedures/automatic b/src/core/procedures/automatic index 3f02832..f41d5a9 100644 --- a/src/core/procedures/automatic +++ b/src/core/procedures/automatic @@ -74,17 +74,17 @@ worker_runtime_settings () { if check_is_in svn "$var_RUNTIME_PACKAGES" then - [ -n "$SVN_USERNAME" ] || ask_string "Please enter your svn username" && SVN_USERNAME=$ANSWER_STRING - [ -n "$SVN_PASSWORD" ] || ask_password svn #TODO: if user entered incorrect password, the install process will just fail.. - [ -n "$SVN_BASE" ] || ask_string "What's the base path of your svn repo? (no ending /) " && SVN_BASE=$ANSWER_STRING - [ -n "$DEPLOY_CLASS" ] || ask_string "Which hostclass are you installing? (optional)" '' 0 && DEPLOY_CLASS=$ANSWER_STRING + [ -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 - [ -n "$HOSTNAME" ] || ask_string "Hostname of target system?" && HOSTNAME=$ANSWER_STRING + [ -z "$HOSTNAME" ] && ask_string "Hostname of target system?" && HOSTNAME=$ANSWER_STRING } -- cgit v1.2.3-54-g00ecf From 1a0f8514992b455be9c4bb2137a8d7dde4c8fac9 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 15:41:32 +0100 Subject: phase worker order fix --- examples/deployconfig-dieter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/deployconfig-dieter b/examples/deployconfig-dieter index 6c9a909..a3d9440 100644 --- a/examples/deployconfig-dieter +++ b/examples/deployconfig-dieter @@ -9,7 +9,7 @@ SVN_USERNAME=dieter SVN_PASSWORD= SVN_BASE=https://192.168.1.2/svn/repos -phase_preparation+=(accept_ssl_cert) +phase_preparation=("${phase_preparation[@]}" accept_ssl_cert) # 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 From 39d39c0870b9f0f02cdb10096d64a29fc3b74683 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 15:44:31 +0100 Subject: fix for ask svn password --- examples/deployconfig-dieter | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/deployconfig-dieter b/examples/deployconfig-dieter index a3d9440..ce9fa6e 100644 --- a/examples/deployconfig-dieter +++ b/examples/deployconfig-dieter @@ -16,8 +16,8 @@ phase_system+=(configure_home) worker_fetch_configs () { - svn export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/trunk/disks/.blockdata $RUNTIME_DIR || die_error "Could not svn export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/trunk/disks/.blockdata into $RUNTIME_DIR" - svn export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/trunk/disks/.partitions $RUNTIME_DIR || die_error "Could not svn export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/trunk/disks/.partitions into $RUNTIME_DIR" + $SVN export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/trunk/disks/.blockdata $RUNTIME_DIR || die_error "Could not svn export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/trunk/disks/.blockdata into $RUNTIME_DIR" + $SVN export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/trunk/disks/.partitions $RUNTIME_DIR || die_error "Could not svn export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/trunk/disks/.partitions into $RUNTIME_DIR" } -- cgit v1.2.3-54-g00ecf From d6d8452fbbbe2114ea917a3b52fde0784273a9ba Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 15:52:22 +0100 Subject: fix for svn export --- examples/deployconfig-dieter | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/deployconfig-dieter b/examples/deployconfig-dieter index ce9fa6e..00a3396 100644 --- a/examples/deployconfig-dieter +++ b/examples/deployconfig-dieter @@ -16,8 +16,8 @@ phase_system+=(configure_home) worker_fetch_configs () { - $SVN export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/trunk/disks/.blockdata $RUNTIME_DIR || die_error "Could not svn export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/trunk/disks/.blockdata into $RUNTIME_DIR" - $SVN export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/trunk/disks/.partitions $RUNTIME_DIR || die_error "Could not svn export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/trunk/disks/.partitions into $RUNTIME_DIR" + $SVN export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/trunk/disks/.blockdata $RUNTIME_DIR/.blockdata || die_error "Could not svn export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/trunk/disks/.blockdata to $RUNTIME_DIR/.blockdata" + $SVN export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/trunk/disks/.partitions $RUNTIME_DIR/.partitions || die_error "Could not svn export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/trunk/disks/.partitions to $RUNTIME_DIR/.partitions" } -- cgit v1.2.3-54-g00ecf From 7f9c5b317eb33ffc4be183b50dd636de15f01ae2 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 16:03:38 +0100 Subject: cleanup automatic deployment stuff --- examples/deployconfig-dieter | 16 ++++++++++++++++ src/core/procedures/automatic | 15 --------------- src/core/procedures/base | 2 +- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/examples/deployconfig-dieter b/examples/deployconfig-dieter index 00a3396..c626a64 100644 --- a/examples/deployconfig-dieter +++ b/examples/deployconfig-dieter @@ -1,6 +1,8 @@ #!/bin/bash # An example config for the deployment procedure +#TODO: install ruby-gems too + var_RUNTIME_PACKAGES="svn" DEPLOY_CLASS=desktop-a7n8x @@ -21,6 +23,13 @@ worker_fetch_configs () } +worker_package_list () +{ + $SVN export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/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." +} + worker_accept_ssl_cert () { mkdir -p /root/.subversion/auth/svn.ssl.server @@ -40,3 +49,10 @@ https://192.168.1.2:443 END EOF } + + +worker_configure_home () +{ + #TODO checkout from svn + true +} \ No newline at end of file diff --git a/src/core/procedures/automatic b/src/core/procedures/automatic index f41d5a9..dc879ee 100644 --- a/src/core/procedures/automatic +++ b/src/core/procedures/automatic @@ -104,14 +104,6 @@ worker_prepare_disks () 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 () { @@ -121,13 +113,6 @@ worker_install_packages () } -worker_configure_home () -{ - #checkout from svn - true -} - - worker_set_clock () { #timezone="Europe/Brussels" diff --git a/src/core/procedures/base b/src/core/procedures/base index 632dda7..1c1d640 100644 --- a/src/core/procedures/base +++ b/src/core/procedures/base @@ -4,7 +4,7 @@ var_DEFAULTFS="/boot:32:ext2:+ swap:256:swap /:7500:ext3 /home:*:ext3" var_TARGET_DIR="/mnt" # When overriding this, do _not_ add a trailing /. It's not needed and maybe you could even break something var_RUNTIME_PACKAGES= -var_PKG_FILE=$RUNTIME_DIR/package-list +var_PKG_FILE=$RUNTIME_DIR/package-list # not used by default in base/interactive. can be used by custom procedures or profiles for the automatic procedure var_MIRRORLIST="/etc/pacman.d/mirrorlist" var_UI_TYPE="cli" # set to cli or dia for dialog var_ARCH=`uname -m` #works for i686 TODO: check if it works for x86_64 -- cgit v1.2.3-54-g00ecf From 11810c0a4a8ae5782611076539cfff4b7431048f Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 17:29:28 +0100 Subject: todo updates --- TODO | 2 +- unofficial/modules/TODO | 3 --- unofficial/modules/yaourt/libs/lib-yaourt-sh | 24 ------------------------ unofficial/modules/yaourt/whatsthis.txt | 4 ---- 4 files changed, 1 insertion(+), 32 deletions(-) delete mode 100644 unofficial/modules/TODO delete mode 100644 unofficial/modules/yaourt/libs/lib-yaourt-sh delete mode 100644 unofficial/modules/yaourt/whatsthis.txt diff --git a/TODO b/TODO index 6245a5d..0e6a3d2 100644 --- a/TODO +++ b/TODO @@ -15,7 +15,7 @@ ALPHA PHASE: get some people to test and suggest ideas, while fixing bugs and re * move "/tmp/pacman.conf" to runtime directory and variablize everywhere * hmm wasn't there a hwdetect/hwd or something in /arch/setup? this seems to have disappeared. * shouldn't we put /etc/hostname in 'configure system' ? ASKDEV -* a nice way to be able to "inject" functions without: +* a nice way to be able to "inject" functions/logic without: * needing to redefine phases with only 1 entry different (duplicate code is not nice, less maintainable etc) * override worker functions which are 90% copy-pasted because the parent functionality is mostly okay, but not exactly what we want useful for: profiles for the automatic procedures, or all other procedures diff --git a/unofficial/modules/TODO b/unofficial/modules/TODO deleted file mode 100644 index 3f19b66..0000000 --- a/unofficial/modules/TODO +++ /dev/null @@ -1,3 +0,0 @@ -See also the FIXME's and TODO's in the code. -* dieter/automatic: wait for yaourt --config fix ( http://forums.archlinux.fr/post23171.html#23171 ) -* dieter/automatic: put config files from svn in place first, so that if a package has an update, it can do it's thing. diff --git a/unofficial/modules/yaourt/libs/lib-yaourt-sh b/unofficial/modules/yaourt/libs/lib-yaourt-sh deleted file mode 100644 index 56e03df..0000000 --- a/unofficial/modules/yaourt/libs/lib-yaourt-sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -# See http://wiki.archlinux.org/index.php/Yaourt - -_runtime_yaourt () -{ - if ! list_pacman_repos runtime | grep -q archlinuxfr - then - add_pacman_repo runtime archlinuxfr "Server = http://repo.archlinux.fr/$var_ARCH" - fi - $PACMAN -Sy yaourt || die_error "_runtime_yaourt Cannot install yaourt" #TODO: library-ize package installation - YAOURT=${PACMAN//pacman/yaourt} - YAOURT_TARGET=${PACMAN_TARGET//pacman/yaourt} -} - - -_yaourt_replace_pacman () -{ - show_warning "Security warning!" "Keep in mind that packages on AUR are untrusted! Install them on your own risk" - _runtime_yaourt - PACMAN=$YAOURT - PACMAN_TARGET=$YAOURT_TARGET -} - diff --git a/unofficial/modules/yaourt/whatsthis.txt b/unofficial/modules/yaourt/whatsthis.txt deleted file mode 100644 index 66a393f..0000000 --- a/unofficial/modules/yaourt/whatsthis.txt +++ /dev/null @@ -1,4 +0,0 @@ -I plan to someday write a module that will make yaourt available during -installation, so you can imediately install packages from AUR on your system -during installation. This is something that does not belong in core, it's -for power users only ;-) -- cgit v1.2.3-54-g00ecf From 2423504e4e99c3be0403655f2461e58daef38af3 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 17:30:23 +0100 Subject: support comments --- src/core/libs/lib-pacman.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/libs/lib-pacman.sh b/src/core/libs/lib-pacman.sh index f318aa8..26fb90e 100644 --- a/src/core/libs/lib-pacman.sh +++ b/src/core/libs/lib-pacman.sh @@ -97,7 +97,7 @@ list_pacman_repos () [ "$1" != runtime -a "$1" != target ] && die_error "list_pacman_repos needs target/runtime argument" [ "$1" = target ] && conf=/tmp/pacman.conf [ "$1" = runtime ] && conf=/etc/pacman.conf - grep '\[.*\]' $conf | grep -v options | sed 's/\[//g' | sed 's/\]//g' + grep '\[.*\]' $conf | grep -v options | grep -v '^#' | sed 's/\[//g' | sed 's/\]//g' } -- cgit v1.2.3-54-g00ecf From cd6c7c01579bc37c458eac1a649ef74f17def3cb Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 17:31:25 +0100 Subject: fixes/cleanups for runtime packages and repositories. Not much use in making yauort a module, its integrated now --- examples/deployconfig-dieter | 42 ++++++++++++++++++++++++++++++++++++++++-- src/core/procedures/automatic | 1 - src/core/procedures/base | 13 +++++++++++++ 3 files changed, 53 insertions(+), 3 deletions(-) diff --git a/examples/deployconfig-dieter b/examples/deployconfig-dieter index c626a64..9e80dc4 100644 --- a/examples/deployconfig-dieter +++ b/examples/deployconfig-dieter @@ -1,8 +1,13 @@ #!/bin/bash # An example config for the deployment procedure -#TODO: install ruby-gems too +# TODO: install ruby-gems too +# TODO * dieter/automatic: wait for yaourt --config fix ( http://forums.archlinux.fr/post23171.html#23171 ) +# TODO:* dieter/automatic: put config files from svn in place first, so that if a package has an update, it can do it's thing. +depend_module yaourt + +var_RUNTIME_REPOSITORIES=(archlinuxfr "Server = http://repo.archlinux.fr/$var_ARCH") var_RUNTIME_PACKAGES="svn" DEPLOY_CLASS=desktop-a7n8x @@ -23,6 +28,19 @@ worker_fetch_configs () } +worker_runtime_packages () +{ + for pkg in $var_RUNTIME_PACKAGES + do + $PACMAN -Sy --noconfirm --needed $pkg + done + + # We'll install packages on the target system, for that we need yaourt + _runtime_yaourt + _yaourt_replace_pacman +} + + worker_package_list () { $SVN export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/trunk/package-list $var_PKG_FILE || die_error "Could not export package list!" @@ -55,4 +73,24 @@ worker_configure_home () { #TODO checkout from svn true -} \ No newline at end of file +} + + + +# See http://wiki.archlinux.org/index.php/Yaourt + +worker_install_packages () #pre_ / post_ callbacks would be useful here +{ + PACMAN_BACKUP=$PACMAN + PACMAN_TARGET_BACKUP=$PACMAN_TARGET + PACMAN=${PACMAN//pacman/yaourt} + PACMAN_TARGET=${PACMAN_TARGET//pacman/yaourt} + + target_prepare_pacman core + [ -z "$TARGET_PACKAGES" ] && die_error "No packages listed to be installed!" + installpkg + + PACMAN=$PACMAN_BACKUP + PACMAN_TARGET=$PACMAN_TARGET_BACKUP + +} diff --git a/src/core/procedures/automatic b/src/core/procedures/automatic index dc879ee..bb78437 100644 --- a/src/core/procedures/automatic +++ b/src/core/procedures/automatic @@ -5,7 +5,6 @@ # 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/..? -depend_module yaourt depend_procedure core base var_OPTS_STRING="c:" diff --git a/src/core/procedures/base b/src/core/procedures/base index 1c1d640..4fd32c8 100644 --- a/src/core/procedures/base +++ b/src/core/procedures/base @@ -3,6 +3,7 @@ #TODO: make this profile work on itself, eg some stuff from inheriting profiles should be moved in, stuff implemented etc var_DEFAULTFS="/boot:32:ext2:+ swap:256:swap /:7500:ext3 /home:*:ext3" var_TARGET_DIR="/mnt" # When overriding this, do _not_ add a trailing /. It's not needed and maybe you could even break something +var_RUNTIME_REPOSITORIES= # array like this ('name1' 'location of repo 1' ['name2' 'location of repo2',..]) var_RUNTIME_PACKAGES= var_PKG_FILE=$RUNTIME_DIR/package-list # not used by default in base/interactive. can be used by custom procedures or profiles for the automatic procedure var_MIRRORLIST="/etc/pacman.d/mirrorlist" @@ -17,6 +18,7 @@ phase_preparation=(\ sysprep \ select_source \ runtime_network \ + runtime_repositories \ runtime_packages) phase_basics=(\ @@ -77,6 +79,17 @@ worker_runtime_network () } +worker_runtime_repositories () +{ + for i in `seq 0 $((${#var_RUNTIME_REPOSITORIES[@]}/2-1))` + do + repo=${var_RUNTIME_REPOSITORIES[$(($i*2))]} + location=${var_RUNTIME_REPOSITORIES[$(($i*2+1))]} + list_pacman_repos runtime | grep -q $repo || add_pacman_repo runtime $repo $location + done +} + + worker_runtime_packages () { for pkg in $var_RUNTIME_PACKAGES -- cgit v1.2.3-54-g00ecf From 9ce46d3493f447eba7a8e35e82be853deb894d99 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 17:35:55 +0100 Subject: fixes/cleanups for runtime packages and repositories. Not much use in making yauort a module, its integrated now --- examples/deployconfig-dieter | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/examples/deployconfig-dieter b/examples/deployconfig-dieter index 9e80dc4..3b98993 100644 --- a/examples/deployconfig-dieter +++ b/examples/deployconfig-dieter @@ -5,7 +5,6 @@ # TODO * dieter/automatic: wait for yaourt --config fix ( http://forums.archlinux.fr/post23171.html#23171 ) # TODO:* dieter/automatic: put config files from svn in place first, so that if a package has an update, it can do it's thing. -depend_module yaourt var_RUNTIME_REPOSITORIES=(archlinuxfr "Server = http://repo.archlinux.fr/$var_ARCH") var_RUNTIME_PACKAGES="svn" @@ -28,19 +27,6 @@ worker_fetch_configs () } -worker_runtime_packages () -{ - for pkg in $var_RUNTIME_PACKAGES - do - $PACMAN -Sy --noconfirm --needed $pkg - done - - # We'll install packages on the target system, for that we need yaourt - _runtime_yaourt - _yaourt_replace_pacman -} - - worker_package_list () { $SVN export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/trunk/package-list $var_PKG_FILE || die_error "Could not export package list!" -- cgit v1.2.3-54-g00ecf From 8d125d8781d43f5fc3522e30dd1fe617386118b4 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 17:38:28 +0100 Subject: fix for incomplete repo location string, making pacman segfault *oops* --- src/core/procedures/base | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/procedures/base b/src/core/procedures/base index 4fd32c8..b0e9c9a 100644 --- a/src/core/procedures/base +++ b/src/core/procedures/base @@ -85,7 +85,7 @@ worker_runtime_repositories () do repo=${var_RUNTIME_REPOSITORIES[$(($i*2))]} location=${var_RUNTIME_REPOSITORIES[$(($i*2+1))]} - list_pacman_repos runtime | grep -q $repo || add_pacman_repo runtime $repo $location + list_pacman_repos runtime | grep -q $repo || add_pacman_repo runtime $repo "$location" done } -- cgit v1.2.3-54-g00ecf From fcbe47dfba9a64f98f6596d23f4f2efb78480101 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 18:00:35 +0100 Subject: maybe it would be useful if i want to use yaourt, that i could maybe install it first. just a thought --- examples/deployconfig-dieter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/deployconfig-dieter b/examples/deployconfig-dieter index 3b98993..b95baff 100644 --- a/examples/deployconfig-dieter +++ b/examples/deployconfig-dieter @@ -7,7 +7,7 @@ var_RUNTIME_REPOSITORIES=(archlinuxfr "Server = http://repo.archlinux.fr/$var_ARCH") -var_RUNTIME_PACKAGES="svn" +var_RUNTIME_PACKAGES="svn yaourt" DEPLOY_CLASS=desktop-a7n8x HOSTNAME=dieter-ws -- cgit v1.2.3-54-g00ecf From 78bbe06321a9724311449a38ea9134d227d95a98 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 18:43:47 +0100 Subject: new concept: partial procedures, 2 implementations + documentation + added automatic procedure docs to README --- README | 8 +++++++ src/core/procedures/partial-configure-network.sh | 7 ++++++ src/core/procedures/partial-disks.sh | 30 ++++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 src/core/procedures/partial-configure-network.sh create mode 100644 src/core/procedures/partial-disks.sh diff --git a/README b/README index ca55604..77d1b28 100644 --- a/README +++ b/README @@ -99,6 +99,14 @@ core/base: basic, little-interactivity installation with some common defa want to run this one, although it's useful for other procedures to inherit from. core/interactive: interactive, reasonably flexible/featured installer (port of /arch/setup) core/quickinst: mostly DIY. port of /arch/quickinst +core/automatic: automatic installer/deployment tool, can use config files + +** Partial Procedures ** +These procedures allow you to run a select few functions, in order to reach +a specific goal, usually not installing a system + +partial-configure-network.sh Configure network on the runtime system +partial-disks.sh Process disk subsystem or do a rollback ** Contributing ** diff --git a/src/core/procedures/partial-configure-network.sh b/src/core/procedures/partial-configure-network.sh new file mode 100644 index 0000000..a2542b6 --- /dev/null +++ b/src/core/procedures/partial-configure-network.sh @@ -0,0 +1,7 @@ +#!/bin/bash +depend_procedure core interactive + +start_process () +{ + execute worker runtime_network +} \ No newline at end of file diff --git a/src/core/procedures/partial-disks.sh b/src/core/procedures/partial-disks.sh new file mode 100644 index 0000000..c5fa5f7 --- /dev/null +++ b/src/core/procedures/partial-disks.sh @@ -0,0 +1,30 @@ +#!/bin/bash +depend_procedure core base + +var_OPTS_STRING="o:" +var_ARGS_USAGE="-o process/rollback: Operation: process the blockdevice layer or roll it back?" + +process_args () +{ + if [ "$1" = '-o' ] + then + [ "$2" != process -a "$2" != rollback ] && die_error "You must specify 'process' or 'rollback'" + OPERATION=$2 + else + usage + exit 5 + fi +} + + +start_process () +{ + if [ "$OPERATION" = process ] + then + process_disks + process_filesystems + elif [ "$OPERATION" = rollback ] + then + rollback_filesystems + else +} \ No newline at end of file -- cgit v1.2.3-54-g00ecf From 0c714356dc7f78892ca413ce1895d7d9dfa83c5c Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 18:47:34 +0100 Subject: fix for incorrect shebangs --- src/core/libs/lib-blockdevices-filesystems.sh | 2 +- src/core/libs/lib-misc.sh | 2 +- src/core/libs/lib-pacman.sh | 2 +- src/core/libs/lib-software.sh | 2 +- src/core/libs/lib-ui-interactive.sh | 2 +- src/core/libs/lib-ui.sh | 2 +- src/core/procedures/interactive | 2 +- src/core/procedures/quickinst | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/core/libs/lib-blockdevices-filesystems.sh b/src/core/libs/lib-blockdevices-filesystems.sh index fad1171..bb44295 100644 --- a/src/core/libs/lib-blockdevices-filesystems.sh +++ b/src/core/libs/lib-blockdevices-filesystems.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # FORMAT DEFINITIONS: diff --git a/src/core/libs/lib-misc.sh b/src/core/libs/lib-misc.sh index 29e4c2e..f45c5c9 100644 --- a/src/core/libs/lib-misc.sh +++ b/src/core/libs/lib-misc.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # run a process in the background, and log it's stdout and stderr to a specific logfile diff --git a/src/core/libs/lib-pacman.sh b/src/core/libs/lib-pacman.sh index 26fb90e..d613052 100644 --- a/src/core/libs/lib-pacman.sh +++ b/src/core/libs/lib-pacman.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # taken and slightly modified from the quickinst script. # don't know why one should need a static pacman because we already have a working one on the livecd. diff --git a/src/core/libs/lib-software.sh b/src/core/libs/lib-software.sh index 6b4a1a8..9cbc34d 100644 --- a/src/core/libs/lib-software.sh +++ b/src/core/libs/lib-software.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash TMP_MKINITCPIO_LOG=$RUNTIME_DIR/mkinitcpio.log TMP_PACMAN_LOG=$RUNTIME_DIR/pacman.log diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh index 543495a..5fb1aa6 100644 --- a/src/core/libs/lib-ui-interactive.sh +++ b/src/core/libs/lib-ui-interactive.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash #TODO: get backend code out of here!! diff --git a/src/core/libs/lib-ui.sh b/src/core/libs/lib-ui.sh index ac73b3e..2315394 100644 --- a/src/core/libs/lib-ui.sh +++ b/src/core/libs/lib-ui.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # TODO: implement 'retry until user does it correctly' everywhere # TODO: at some places we should check if $1 etc is only 1 word because we often depend on that # TODO: standardize. eg everything $1= question/title, $2=default diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive index d4c3cf6..1a89408 100644 --- a/src/core/procedures/interactive +++ b/src/core/procedures/interactive @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash depend_procedure core base # esp for auto_{network,locale,fstab}, intro and set_clock workers diff --git a/src/core/procedures/quickinst b/src/core/procedures/quickinst index 73c1f46..b95bfa4 100644 --- a/src/core/procedures/quickinst +++ b/src/core/procedures/quickinst @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash depend_procedure core base # This is a port of the original /arch/quickinst script. -- cgit v1.2.3-54-g00ecf From 3c310e5b38d1c3e49a5e931b4e924e6341b8311e Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 18:50:26 +0100 Subject: fix procedure naming + syntax fix for partial-disks --- src/core/procedures/partial-configure-network | 7 ++++++ src/core/procedures/partial-configure-network.sh | 7 ------ src/core/procedures/partial-disks | 30 ++++++++++++++++++++++++ src/core/procedures/partial-disks.sh | 30 ------------------------ 4 files changed, 37 insertions(+), 37 deletions(-) create mode 100644 src/core/procedures/partial-configure-network delete mode 100644 src/core/procedures/partial-configure-network.sh create mode 100644 src/core/procedures/partial-disks delete mode 100644 src/core/procedures/partial-disks.sh diff --git a/src/core/procedures/partial-configure-network b/src/core/procedures/partial-configure-network new file mode 100644 index 0000000..a2542b6 --- /dev/null +++ b/src/core/procedures/partial-configure-network @@ -0,0 +1,7 @@ +#!/bin/bash +depend_procedure core interactive + +start_process () +{ + execute worker runtime_network +} \ No newline at end of file diff --git a/src/core/procedures/partial-configure-network.sh b/src/core/procedures/partial-configure-network.sh deleted file mode 100644 index a2542b6..0000000 --- a/src/core/procedures/partial-configure-network.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -depend_procedure core interactive - -start_process () -{ - execute worker runtime_network -} \ No newline at end of file diff --git a/src/core/procedures/partial-disks b/src/core/procedures/partial-disks new file mode 100644 index 0000000..0c16c84 --- /dev/null +++ b/src/core/procedures/partial-disks @@ -0,0 +1,30 @@ +#!/bin/bash +depend_procedure core base + +var_OPTS_STRING="o:" +var_ARGS_USAGE="-o process/rollback: Operation: process the blockdevice layer or roll it back?" + +process_args () +{ + if [ "$1" = '-o' ] + then + [ "$2" != process -a "$2" != rollback ] && die_error "You must specify 'process' or 'rollback'" + OPERATION=$2 + else + usage + exit 5 + fi +} + + +start_process () +{ + if [ "$OPERATION" = process ] + then + process_disks + process_filesystems + elif [ "$OPERATION" = rollback ] + then + rollback_filesystems + fi +} \ No newline at end of file diff --git a/src/core/procedures/partial-disks.sh b/src/core/procedures/partial-disks.sh deleted file mode 100644 index c5fa5f7..0000000 --- a/src/core/procedures/partial-disks.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -depend_procedure core base - -var_OPTS_STRING="o:" -var_ARGS_USAGE="-o process/rollback: Operation: process the blockdevice layer or roll it back?" - -process_args () -{ - if [ "$1" = '-o' ] - then - [ "$2" != process -a "$2" != rollback ] && die_error "You must specify 'process' or 'rollback'" - OPERATION=$2 - else - usage - exit 5 - fi -} - - -start_process () -{ - if [ "$OPERATION" = process ] - then - process_disks - process_filesystems - elif [ "$OPERATION" = rollback ] - then - rollback_filesystems - else -} \ No newline at end of file -- cgit v1.2.3-54-g00ecf From e833ad723e21592a9dbf198789f570855f9c31b6 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 20 Dec 2008 18:53:29 +0100 Subject: args fix --- src/core/procedures/partial-disks | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/procedures/partial-disks b/src/core/procedures/partial-disks index 0c16c84..8f17e33 100644 --- a/src/core/procedures/partial-disks +++ b/src/core/procedures/partial-disks @@ -19,6 +19,8 @@ process_args () start_process () { + [ -z "$OPERATION" ] && usage && exit 5 + if [ "$OPERATION" = process ] then process_disks -- cgit v1.2.3-54-g00ecf From cbaff5ee1a800a1d4991faa94918f668cfb12bec Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sun, 21 Dec 2008 16:14:31 +0100 Subject: yaourt bugs workaround: filter away all packages unknown by pacman --- examples/deployconfig-dieter | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/deployconfig-dieter b/examples/deployconfig-dieter index b95baff..49ea374 100644 --- a/examples/deployconfig-dieter +++ b/examples/deployconfig-dieter @@ -32,8 +32,12 @@ worker_package_list () $SVN export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/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." + # Strip away all packages not known by pacman. To get all packages, you'll need to do that when the system is installed TODO: don't do this. WAITINGFOR: --config support in yaourt + 'list of md5s of trusted pkgbuilds' support in yaourt + # NOTE: maybe chrooting could be an option too (to avoid --config support, but problem 2 stays) + TARGET_PACKAGES=`pacman -Si $TARGET_PACKAGES 2>/dev/null | awk '/Name/ {print $3}'` } + worker_accept_ssl_cert () { mkdir -p /root/.subversion/auth/svn.ssl.server -- cgit v1.2.3-54-g00ecf From a0be4eb42a1d0fc93e592bff9c27cc3e74968bec Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sun, 21 Dec 2008 16:40:22 +0100 Subject: needle/haystack order + return code fixes --- src/core/procedures/automatic | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/procedures/automatic b/src/core/procedures/automatic index bb78437..4369a5a 100644 --- a/src/core/procedures/automatic +++ b/src/core/procedures/automatic @@ -71,19 +71,21 @@ 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" + if check_is_in "$var_RUNTIME_PACKAGES" svn 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" + elif check_is_in "$var_RUNTIME_PACKAGES" moo then # Maybe more stuff later true fi [ -z "$HOSTNAME" ] && ask_string "Hostname of target system?" && HOSTNAME=$ANSWER_STRING + + return 0 } -- cgit v1.2.3-54-g00ecf From a2d15c5e2b8afda0da44959f52937a6a0c48e933 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sun, 21 Dec 2008 17:02:42 +0100 Subject: bugfix mkay --- src/core/procedures/automatic | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/procedures/automatic b/src/core/procedures/automatic index 4369a5a..3c93167 100644 --- a/src/core/procedures/automatic +++ b/src/core/procedures/automatic @@ -71,14 +71,14 @@ worker_runtime_network () # Check if we have all needed settings loaded from the profile worker_runtime_settings () { - if check_is_in "$var_RUNTIME_PACKAGES" svn + if check_is_in $var_RUNTIME_PACKAGES svn 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 "$var_RUNTIME_PACKAGES" moo + elif check_is_in $var_RUNTIME_PACKAGES moo then # Maybe more stuff later true -- cgit v1.2.3-54-g00ecf From a5d5a24f1e134c7b48efbd425ccc8e180ff4fc2b Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sun, 21 Dec 2008 17:04:25 +0100 Subject: no need to use yaourt yet --- examples/deployconfig-dieter | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/examples/deployconfig-dieter b/examples/deployconfig-dieter index 49ea374..e2811db 100644 --- a/examples/deployconfig-dieter +++ b/examples/deployconfig-dieter @@ -69,18 +69,18 @@ worker_configure_home () # See http://wiki.archlinux.org/index.php/Yaourt -worker_install_packages () #pre_ / post_ callbacks would be useful here -{ - PACMAN_BACKUP=$PACMAN - PACMAN_TARGET_BACKUP=$PACMAN_TARGET - PACMAN=${PACMAN//pacman/yaourt} - PACMAN_TARGET=${PACMAN_TARGET//pacman/yaourt} - - target_prepare_pacman core - [ -z "$TARGET_PACKAGES" ] && die_error "No packages listed to be installed!" - installpkg - - PACMAN=$PACMAN_BACKUP - PACMAN_TARGET=$PACMAN_TARGET_BACKUP - -} +# Not needed yet... +#worker_install_packages () #pre_ / post_ callbacks would be useful here +#{ +# PACMAN_BACKUP=$PACMAN +# PACMAN_TARGET_BACKUP=$PACMAN_TARGET +# PACMAN=${PACMAN//pacman/yaourt} +# PACMAN_TARGET=${PACMAN_TARGET//pacman/yaourt} + +# target_prepare_pacman core +# [ -z "$TARGET_PACKAGES" ] && die_error "No packages listed to be installed!" +# installpkg + +# PACMAN=$PACMAN_BACKUP +# PACMAN_TARGET=$PACMAN_TARGET_BACKUP +#} -- cgit v1.2.3-54-g00ecf From 7dea48406c6ee9fd98c972bf73c0f026e86a7881 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sun, 21 Dec 2008 17:19:48 +0100 Subject: fixedie fix --- examples/deployconfig-dieter | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/deployconfig-dieter b/examples/deployconfig-dieter index e2811db..d96f2b0 100644 --- a/examples/deployconfig-dieter +++ b/examples/deployconfig-dieter @@ -35,6 +35,7 @@ worker_package_list () # Strip away all packages not known by pacman. To get all packages, you'll need to do that when the system is installed TODO: don't do this. WAITINGFOR: --config support in yaourt + 'list of md5s of trusted pkgbuilds' support in yaourt # NOTE: maybe chrooting could be an option too (to avoid --config support, but problem 2 stays) TARGET_PACKAGES=`pacman -Si $TARGET_PACKAGES 2>/dev/null | awk '/Name/ {print $3}'` + TARGET_PACKAGES=`echo $TARGET_PACKAGES` } -- cgit v1.2.3-54-g00ecf From 3a9971895b9dc6924d9d7abffaffbc9332763d85 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sun, 21 Dec 2008 17:42:20 +0100 Subject: use target pacman --- examples/deployconfig-dieter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/deployconfig-dieter b/examples/deployconfig-dieter index d96f2b0..0d05617 100644 --- a/examples/deployconfig-dieter +++ b/examples/deployconfig-dieter @@ -34,7 +34,7 @@ worker_package_list () TARGET_PACKAGES=`cat $var_PKG_FILE` && TARGET_PACKAGES=`echo $TARGET_PACKAGES` || die_error "Could not cat package list. THIS SHOULD NEVER HAPPEN." # Strip away all packages not known by pacman. To get all packages, you'll need to do that when the system is installed TODO: don't do this. WAITINGFOR: --config support in yaourt + 'list of md5s of trusted pkgbuilds' support in yaourt # NOTE: maybe chrooting could be an option too (to avoid --config support, but problem 2 stays) - TARGET_PACKAGES=`pacman -Si $TARGET_PACKAGES 2>/dev/null | awk '/Name/ {print $3}'` + TARGET_PACKAGES=`$PACMAN_TARGET -Si $TARGET_PACKAGES 2>/dev/null | awk '/Name/ {print $3}'` TARGET_PACKAGES=`echo $TARGET_PACKAGES` } -- cgit v1.2.3-54-g00ecf From d1bcdca68c723c5b9fa7cf10abf5fade851d9da1 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Tue, 23 Dec 2008 20:42:23 +0100 Subject: todo updates --- examples/deployconfig-dieter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/deployconfig-dieter b/examples/deployconfig-dieter index 0d05617..5a86c65 100644 --- a/examples/deployconfig-dieter +++ b/examples/deployconfig-dieter @@ -35,7 +35,7 @@ worker_package_list () # Strip away all packages not known by pacman. To get all packages, you'll need to do that when the system is installed TODO: don't do this. WAITINGFOR: --config support in yaourt + 'list of md5s of trusted pkgbuilds' support in yaourt # NOTE: maybe chrooting could be an option too (to avoid --config support, but problem 2 stays) TARGET_PACKAGES=`$PACMAN_TARGET -Si $TARGET_PACKAGES 2>/dev/null | awk '/Name/ {print $3}'` - TARGET_PACKAGES=`echo $TARGET_PACKAGES` + TARGET_PACKAGES=`echo $TARGET_PACKAGES` #TODO: some stuff goes wrong here } -- cgit v1.2.3-54-g00ecf From b50f03d833eaf898d6a5fe1dc4b4d8fe78bdb929 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Tue, 23 Dec 2008 21:44:40 +0100 Subject: readme updates and fixes and MOOOOOO --- README | 54 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 11 deletions(-) diff --git a/README b/README index 77d1b28..5462525 100644 --- a/README +++ b/README @@ -4,22 +4,53 @@ AIF is the Arch Linux Installation Framework. License: GPL3. See COPYING. -Author: Dieter Plaetinck -Homepage: http://github.com/Dieterbe/aif +Author: Dieter Plaetinck +Homepage: http://github.com/Dieterbe/aif + + +** Intro / Current state of things ** + +AIF is included on the 2008-12 Arch install CD's as an experimental alternative for the old installer (/arch/setup). +The code of the old installer has been madly refactored, reorganized and cleaned up. + +AIF comes by default with these procedures: +- interactive: A port of /arch/setup. Should work okay if you don't try too hard to break it ;-) +- quickinst: A port of /arch/quickinst. Work in progress. Don't use this yet. + +AIF may or may not bring much additional value for you when compared with the previous +installer, it depends on what you want to do: +- End users: + On the frontend, the interactive profile is very similar to /arch/setup. + The features are more or less the same, with two notable exceptions: + * Different partition/filesystem editor with support for LVM and dm_crypt + * Rollback functionality if you change your mind after having formatted filesystems +- Hackers: + The code base that AIF runs on is very usable for hacking. The code is + modular, reusable and quite complete. If you want to build your own + installation procedures, or want to modify specific aspects of the + out-of-the-box installation procedures, definitely check out how AIF + works. It is built for hacking, reusing code and making writing custom installers + as easy as possible. + +Keep in mind that AIF is still in ALPHA phase. +There are some known issues (see the TODO file and various TODO's in the source code) + +AIF is expected to become the new official installer in the not too distant +future, so go ahead and try it ! ** Goals ** The goal of this project is -1) to allow you to install Arch Linux in more flexible and powerful ways. -2) write an automated (unattended) installer -3) Apply DRY patterns to the installation procedure, making it more easy to maintain the code. +1) to make the code of the Arch Linux installer more clean, DRY, modular and maintainable. +2) providing complete, easily-reusable libraries for disk partitioning, UI, package management, etc +3) provide some sensible default installation methods (eg interative, quickinst, automatic (prescripted), ..) +4) allowing power users to easily override certain aspects of the installation procedures + or creating customized procedures, leveraging the available code. +The goal of AIF is not (yet): +1) providing an installer who detects your stuff and tries to be smart and configures all your stuff. + If you're interested in this, feel free to build it and I may incorporate it someday. -You can choose to use unattended (automatic) installation (you can write different -modules/procedures for different scenario's, and/or use autodetection) or prompt the user for whatever you want to know (you could mimic the official installer like -that). -You can also take parts from different installation procedures and combine them -together to come up with the procedure of your liking. ** File locations (on the install CD): ** @@ -68,6 +99,7 @@ ignored anyway). Don't call it http either, because you can specify 'http://some/path/to/a/procedure', aif will download that procedure and execute it (and the module will be 'http') + Note that if you load a module and a library has the same function names as the core module, it will override the functions from core. This means you can 'inject' new backend code into core procedures, but you @@ -129,7 +161,7 @@ it isn't always the case like that now, I need to do more refactoring) Much of the code in the core module is taken (and modified) from the 'real' arch linux install scripts code. (/arch/setup and /arch/quickinst). the modifications are mostly done to make the code more (re)useable and to separate backend code, user -interface and flow control. (intro libraries and procedures). (which was tightly coupled in the original scripts) +interface and flow control. (into libraries and procedures). (which was tightly coupled in the original scripts) I couldn't find what license the code is under, but I assume this is okay.. if not let me know. -- cgit v1.2.3-54-g00ecf From a8baba4deb9fb05faffb97e32c030391d44850a7 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Tue, 23 Dec 2008 22:11:04 +0100 Subject: moo --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index 5462525..d68d751 100644 --- a/README +++ b/README @@ -16,6 +16,7 @@ The code of the old installer has been madly refactored, reorganized and cleaned AIF comes by default with these procedures: - interactive: A port of /arch/setup. Should work okay if you don't try too hard to break it ;-) - quickinst: A port of /arch/quickinst. Work in progress. Don't use this yet. +- automatic: An automated, deploy-tool-alike procedure. Work in progress. Don't use this yet. AIF may or may not bring much additional value for you when compared with the previous installer, it depends on what you want to do: -- cgit v1.2.3-54-g00ecf From 6dac925e6547102c68e5b1a596e8848b079befd3 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Wed, 24 Dec 2008 16:26:14 +0100 Subject: more logical place for warning --- src/core/procedures/interactive | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive index 1a89408..dc4232a 100644 --- a/src/core/procedures/interactive +++ b/src/core/procedures/interactive @@ -19,7 +19,7 @@ PART_ROOT= DEFAULTFS="/boot:32:ext2:+ swap:256:swap /:7500:ext3 /home:*:ext3" worker_select_source_title='Select Source' -worker_runtime_network_title='Setup Network (Make sure the network is ok before continuing' +worker_runtime_network_title='Setup Network' worker_select_mirror_title='Choose Mirror' worker_set_clock_title='Set clock' worker_prepare_disks_title='Prepare Hard Drive(s)' @@ -95,7 +95,7 @@ mainmenu() select_source_extras_menu () { while true; do - ask_option no "FTP Installation" '' \ + ask_option no "FTP Installation" 'Make sure the network is ok before continuing the installer' \ "1" "$worker_runtime_network_title" \ "2" "$worker_select_mirror_title" \ "3" "Return to Main Menu" -- cgit v1.2.3-54-g00ecf From 2b749ae2e9e3750c937fccac8b71353040e00128 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sun, 28 Dec 2008 00:36:23 +0100 Subject: todo updates --- TODO | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index 0e6a3d2..22d421b 100644 --- a/TODO +++ b/TODO @@ -26,19 +26,24 @@ ALPHA PHASE: get some people to test and suggest ideas, while fixing bugs and re -> maybe we should in the callback do an execute call for another worker, then we also can check it's exitcode in a good way -> too. although that's only good for separate functions, not the 'copypaste 90% and add 10% to the same worker scenario' -> phases are arrays.. adding elements at the back is easy. for in the middle, we could maybe write some functions to add a worker before/after another in a phase - +* mirrorlist config doesn't change after selecting mirror +* 'keep in mind trottled' geen separate screen +* cool, network setting coping into target/rc.conf seems to work wih aif. at least for dhcp.. it even asks nicely +* split up lib-ui as sep project, make a generic 'LIF' project,.. BETA PHASE: try to get aif on the (beta) installcd as an experimental, alternative installer. * find a way to not have to preload libs and stuff, only load them when needed. -> faster start of install program * involve broader community * fix everything -* if dhcpd already runs for $reason, the installer will try again @ configure network and -fail. i tried killall dhcpd, killall -9 dhcpd first but that didn't help: -it can't kill the process or something... +* if dhcpd already runs for $reason, the installer will try again @ configure network and fail. + i tried killall dhcpd, killall -9 dhcpd first but that didn't help: it can't kill the process or something... + I can also add something like for iface in `moo` (or only the one selected iface); do ifconfig $iface down; + ifconfig $iface up; done, and then dhcpd again * core/interactive: do not check hard for the dependencies. a user could really know what he's doing or need to reboot after partitioning a disk and skip that check or something. Alternatively, maybe just show which steps are done successfully in the main menu * support maybe ntp to set clock * auto-configure mkinitcpio.conf for dm_crypt and lvm +* ext4 support (once we have 2.6.28 or higher on install cd) PRODUCTION PHASE: be the primary installer. deprecate /arch/setup and /arch/quickinst * fix everything even more -- cgit v1.2.3-54-g00ecf From b1ab860219eec51f9bb1cf786e6f570309f52df7 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Mon, 29 Dec 2008 18:33:57 +0100 Subject: ext4 support --- TODO | 1 - src/core/libs/lib-blockdevices-filesystems.sh | 2 ++ src/core/libs/lib-ui-interactive.sh | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/TODO b/TODO index 22d421b..d983611 100644 --- a/TODO +++ b/TODO @@ -43,7 +43,6 @@ BETA PHASE: try to get aif on the (beta) installcd as an experimental, alternati skip that check or something. Alternatively, maybe just show which steps are done successfully in the main menu * support maybe ntp to set clock * auto-configure mkinitcpio.conf for dm_crypt and lvm -* ext4 support (once we have 2.6.28 or higher on install cd) PRODUCTION PHASE: be the primary installer. deprecate /arch/setup and /arch/quickinst * fix everything even more diff --git a/src/core/libs/lib-blockdevices-filesystems.sh b/src/core/libs/lib-blockdevices-filesystems.sh index bb44295..bf5fee3 100644 --- a/src/core/libs/lib-blockdevices-filesystems.sh +++ b/src/core/libs/lib-blockdevices-filesystems.sh @@ -649,6 +649,7 @@ process_filesystem () reiserfs) yes | mkreiserfs $part $opts >$LOG 2>&1; ret=$? ;; ext2) mke2fs "$part" $opts >$LOG 2>&1; ret=$? ;; ext3) mke2fs -j $part $opts >$LOG 2>&1; ret=$? ;; + ext4) mkfs.ext4 $part $opts >$LOG 2>&1; ret=$? ;; vfat) mkfs.vfat $part $opts >$LOG 2>&1; ret=$? ;; swap) mkswap $part $opts >$LOG 2>&1; ret=$? ;; dm_crypt) [ -z "$fs_params" ] && fs_params='-c aes-xts-plain -y -s 512'; @@ -721,6 +722,7 @@ get_filesystem_program () [ $1 = swap ] && echo mkswap && return 0 [ $1 = ext2 ] && echo mkfs.ext2 && return 0 [ $1 = ext3 ] && echo mkfs.ext3 && return 0 + [ $1 = ext4 ] && echo mkfs.ext4 && return 0 [ $1 = reiserfs ] && echo mkreiserfs && return 0 [ $1 = xfs ] && echo mkfs.xfs && return 0 [ $1 = jfs ] && echo mkfs.jfs && return 0 diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh index 5fb1aa6..c013e61 100644 --- a/src/core/libs/lib-ui-interactive.sh +++ b/src/core/libs/lib-ui-interactive.sh @@ -117,6 +117,7 @@ interactive_autoprepare() FSOPTS= which `get_filesystem_program ext2` &>/dev/null && FSOPTS="$FSOPTS ext2 Ext2" which `get_filesystem_program ext3` &>/dev/null && FSOPTS="$FSOPTS ext3 Ext3" + which `get_filesystem_program ext4` &>/dev/null && FSOPTS="$FSOPTS ext4 Ext4" which `get_filesystem_program reiserfs` &>/dev/null && FSOPTS="$FSOPTS reiserfs Reiser3" which `get_filesystem_program xfs` &>/dev/null && FSOPTS="$FSOPTS xfs XFS" which `get_filesystem_program jfs` &>/dev/null && FSOPTS="$FSOPTS jfs JFS" @@ -266,6 +267,7 @@ interactive_filesystem () # swap raw/lvm-lv/dm_crypt no no no no no no # ext 2 raw/lvm-lv/dm_crypt optional optional no no optional no # ext 3 raw/lvm-lv/dm_crypt optional optional no no optional no + # ext 4 raw/lvm-lv/dm_crypt optional optional no no optional no # reiserFS raw/lvm-lv/dm_crypt optional optional no no optional no # xfs raw/lvm-lv/dm_crypt optional optional no no optional no # jfs raw/lvm-lv/dm_crypt optional optional no no optional no @@ -281,6 +283,7 @@ interactive_filesystem () [ $part_type = raw -o $part_type = lvm-lv -o $part_type = dm_crypt ] && which `get_filesystem_program swap` &>/dev/null && FSOPTS="$FSOPTS swap Swap" [ $part_type = raw -o $part_type = lvm-lv -o $part_type = dm_crypt ] && which `get_filesystem_program ext2` &>/dev/null && FSOPTS="$FSOPTS ext2 Ext2" [ $part_type = raw -o $part_type = lvm-lv -o $part_type = dm_crypt ] && which `get_filesystem_program ext3` &>/dev/null && FSOPTS="$FSOPTS ext3 Ext3" + [ $part_type = raw -o $part_type = lvm-lv -o $part_type = dm_crypt ] && which `get_filesystem_program ext4` &>/dev/null && FSOPTS="$FSOPTS ext4 Ext4" [ $part_type = raw -o $part_type = lvm-lv -o $part_type = dm_crypt ] && which `get_filesystem_program reiserfs` &>/dev/null && FSOPTS="$FSOPTS reiserfs Reiser3" [ $part_type = raw -o $part_type = lvm-lv -o $part_type = dm_crypt ] && which `get_filesystem_program xfs` &>/dev/null && FSOPTS="$FSOPTS xfs XFS" [ $part_type = raw -o $part_type = lvm-lv -o $part_type = dm_crypt ] && which `get_filesystem_program jfs` &>/dev/null && FSOPTS="$FSOPTS jfs JFS" -- cgit v1.2.3-54-g00ecf From 5e0457fa7c1a2050360946dd3416ecae208fcef9 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Tue, 30 Dec 2008 00:42:08 +0100 Subject: todo updates --- TODO | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/TODO b/TODO index d983611..4db9bfb 100644 --- a/TODO +++ b/TODO @@ -30,6 +30,10 @@ ALPHA PHASE: get some people to test and suggest ideas, while fixing bugs and re * 'keep in mind trottled' geen separate screen * cool, network setting coping into target/rc.conf seems to work wih aif. at least for dhcp.. it even asks nicely * split up lib-ui as sep project, make a generic 'LIF' project,.. +bugs in experimental: +* in usage, procedure specific opts points to parent profile when using inheritance +* -i , -d etc options not handled ? +* package installation works fine, however it tries to die instead of 'package installation complete' BETA PHASE: try to get aif on the (beta) installcd as an experimental, alternative installer. * find a way to not have to preload libs and stuff, only load them when needed. -> faster start of install program -- cgit v1.2.3-54-g00ecf From 1f4399bcc6579a964940c810373e61d70bf70255 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Tue, 30 Dec 2008 00:53:14 +0100 Subject: todo updates --- TODO | 1 + 1 file changed, 1 insertion(+) diff --git a/TODO b/TODO index 4db9bfb..efe7f42 100644 --- a/TODO +++ b/TODO @@ -34,6 +34,7 @@ bugs in experimental: * in usage, procedure specific opts points to parent profile when using inheritance * -i , -d etc options not handled ? * package installation works fine, however it tries to die instead of 'package installation complete' +* it can't die because the --textbox fails in show_warning BETA PHASE: try to get aif on the (beta) installcd as an experimental, alternative installer. * find a way to not have to preload libs and stuff, only load them when needed. -> faster start of install program -- cgit v1.2.3-54-g00ecf From 044a0eb90aae3cf1820d9f1c6154e2dfe5472a14 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Tue, 30 Dec 2008 13:07:45 +0100 Subject: small code cleanup + todo updates --- TODO | 6 ++---- src/core/libs/lib-blockdevices-filesystems.sh | 2 +- src/core/libs/lib-ui-interactive.sh | 7 ++----- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/TODO b/TODO index efe7f42..78547d4 100644 --- a/TODO +++ b/TODO @@ -30,11 +30,9 @@ ALPHA PHASE: get some people to test and suggest ideas, while fixing bugs and re * 'keep in mind trottled' geen separate screen * cool, network setting coping into target/rc.conf seems to work wih aif. at least for dhcp.. it even asks nicely * split up lib-ui as sep project, make a generic 'LIF' project,.. -bugs in experimental: * in usage, procedure specific opts points to parent profile when using inheritance -* -i , -d etc options not handled ? -* package installation works fine, however it tries to die instead of 'package installation complete' -* it can't die because the --textbox fails in show_warning +* we may have an issue with ftp based installation where package installation works fine, however it tries to die instead of 'package installation complete' but it can't die because the --textbox fails in show_warning +* ( only in experimental?) grub sedding doesn't work. default config remains BETA PHASE: try to get aif on the (beta) installcd as an experimental, alternative installer. * find a way to not have to preload libs and stuff, only load them when needed. -> faster start of install program diff --git a/src/core/libs/lib-blockdevices-filesystems.sh b/src/core/libs/lib-blockdevices-filesystems.sh index bf5fee3..29ae2ab 100644 --- a/src/core/libs/lib-blockdevices-filesystems.sh +++ b/src/core/libs/lib-blockdevices-filesystems.sh @@ -649,7 +649,7 @@ process_filesystem () reiserfs) yes | mkreiserfs $part $opts >$LOG 2>&1; ret=$? ;; ext2) mke2fs "$part" $opts >$LOG 2>&1; ret=$? ;; ext3) mke2fs -j $part $opts >$LOG 2>&1; ret=$? ;; - ext4) mkfs.ext4 $part $opts >$LOG 2>&1; ret=$? ;; + ext4) mkfs.ext4 $part $opts >$LOG 2>&1; ret=$? ;; #TODO: installer.git uses mke2fs -t ext4 -O dir_index,extent,uninit_bg , which is best? vfat) mkfs.vfat $part $opts >$LOG 2>&1; ret=$? ;; swap) mkswap $part $opts >$LOG 2>&1; ret=$? ;; dm_crypt) [ -z "$fs_params" ] && fs_params='-c aes-xts-plain -y -s 512'; diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh index c013e61..01de0cc 100644 --- a/src/core/libs/lib-ui-interactive.sh +++ b/src/core/libs/lib-ui-interactive.sh @@ -709,11 +709,8 @@ interactive_install_grub() { bootdev=$(mount | grep $var_TARGET_DIR/boot | cut -d' ' -f 1) if [ "$grubdev" != "" -o "$bootdev" != "" ]; then subdir= - if [ "$bootdev" != "" ]; then - grubdev=$(mapdev $bootdev) - else - subdir="/boot" - fi + [ -n "$bootdev" != "" ] && grubdev=$(mapdev $bootdev) || subdir="/boot" + # keep the file from being completely bogus if [ "$grubdev" = "DEVICE NOT FOUND" ]; then notify "Your root boot device could not be autodetected by setup. Ensure you adjust the 'root (hd0,0)' line in your GRUB config accordingly." -- cgit v1.2.3-54-g00ecf From 28d7ec8fdeee527d04601b15fc290556575a6849 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Tue, 30 Dec 2008 13:54:32 +0100 Subject: todo updates --- TODO | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TODO b/TODO index 78547d4..d309365 100644 --- a/TODO +++ b/TODO @@ -32,7 +32,7 @@ ALPHA PHASE: get some people to test and suggest ideas, while fixing bugs and re * split up lib-ui as sep project, make a generic 'LIF' project,.. * in usage, procedure specific opts points to parent profile when using inheritance * we may have an issue with ftp based installation where package installation works fine, however it tries to die instead of 'package installation complete' but it can't die because the --textbox fails in show_warning -* ( only in experimental?) grub sedding doesn't work. default config remains +* ( only in experimental?) grub sedding sometimes does, and sometimes doesn't work. default config remains (eg /dev/hda3), sometimes an incorrect UUID is generated BETA PHASE: try to get aif on the (beta) installcd as an experimental, alternative installer. * find a way to not have to preload libs and stuff, only load them when needed. -> faster start of install program -- cgit v1.2.3-54-g00ecf From b2090b0c5846cdfbb4216a5d3abb13127d670b27 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Tue, 30 Dec 2008 19:59:42 +0100 Subject: array insert FAIL --- examples/deployconfig-dieter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/deployconfig-dieter b/examples/deployconfig-dieter index 5a86c65..396de45 100644 --- a/examples/deployconfig-dieter +++ b/examples/deployconfig-dieter @@ -15,7 +15,7 @@ SVN_USERNAME=dieter SVN_PASSWORD= SVN_BASE=https://192.168.1.2/svn/repos -phase_preparation=("${phase_preparation[@]}" accept_ssl_cert) # 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_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 From 60737c99694d406562097eed5ede4ed7987a962f Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Tue, 30 Dec 2008 20:02:25 +0100 Subject: architecture more clarity --- src/core/procedures/base | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/procedures/base b/src/core/procedures/base index b0e9c9a..93c711c 100644 --- a/src/core/procedures/base +++ b/src/core/procedures/base @@ -8,7 +8,7 @@ var_RUNTIME_PACKAGES= var_PKG_FILE=$RUNTIME_DIR/package-list # not used by default in base/interactive. can be used by custom procedures or profiles for the automatic procedure var_MIRRORLIST="/etc/pacman.d/mirrorlist" var_UI_TYPE="cli" # set to cli or dia for dialog -var_ARCH=`uname -m` #works for i686 TODO: check if it works for x86_64 +var_ARCH=`uname -m` #i686 or x86_64 [ -z "$var_ARCH" ] && die_error "Could not determine your architecture" ###### Phases ( can be overridden by more specific procedures) ###### -- cgit v1.2.3-54-g00ecf From b86bf8691c4f0fba765a0c432c49bc94571f91f9 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Wed, 31 Dec 2008 12:15:53 +0100 Subject: runfile should be hidden --- src/core/libs/lib-misc.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/libs/lib-misc.sh b/src/core/libs/lib-misc.sh index f45c5c9..bd59ce0 100644 --- a/src/core/libs/lib-misc.sh +++ b/src/core/libs/lib-misc.sh @@ -14,7 +14,7 @@ run_background () debug "run_background called. identifier: $1, command: $2, logfile: $3" ( \ - touch $RUNTIME_DIR/$1-running + touch $RUNTIME_DIR/.$1-running debug "run_background starting $1: $2 >>$3 2>&1" [ -f $3 ] && echo -e "\n\n\n" >>$3 echo "STARTING $1 . Executing $2 >>$3 2>&1\n" >> $3; @@ -23,7 +23,7 @@ run_background () read $var_exit <<< $? #TODO: bash complains about 'not a valid identifier' debug "run_background done with $1: exitcode (\$$1_exitcode): "${!var_exit}" .Logfile $3" #TODO ${!var_exit} doesn't show anything --> maybe fixed now echo >> $3 - rm -f $RUNTIME_DIR/$1-running + rm -f $RUNTIME_DIR/.$1-running ) & sleep 2 @@ -36,7 +36,7 @@ wait_for () { [ -z "$1" ] && die_error "wait_for needs an identifier to known on which command to wait!" - while [ -f $RUNTIME_DIR/$1-running ] + while [ -f $RUNTIME_DIR/.$1-running ] do #TODO: follow_progress dialog mode = nonblocking (so check and sleep is good), cli mode (tail -f )= blocking? (so check is probably not needed as it will be done) sleep 1 @@ -66,4 +66,4 @@ check_is_in () cleanup_runtime () { rm -rf $RUNTIME_DIR/.dia* &>/dev/null -} \ No newline at end of file +} -- cgit v1.2.3-54-g00ecf From 676feb003bf4d54ada38ada31191635dc1f5e696 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 10 Jan 2009 12:50:24 +0100 Subject: todo updates --- TODO | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index d309365..7eed72d 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,7 @@ See also the FIXME's and TODO's in the code. -ALPHA PHASE: get some people to test and suggest ideas, while fixing bugs and refactoring +ALPHA PHASE: * setup bugtracker/roadmap thingie * check everywhere that if users cancels something, we return 1, empty string behavior etc * core/interactive: fix workaround needed for installpkg exitcode @@ -33,10 +33,14 @@ ALPHA PHASE: get some people to test and suggest ideas, while fixing bugs and re * in usage, procedure specific opts points to parent profile when using inheritance * we may have an issue with ftp based installation where package installation works fine, however it tries to die instead of 'package installation complete' but it can't die because the --textbox fails in show_warning * ( only in experimental?) grub sedding sometimes does, and sometimes doesn't work. default config remains (eg /dev/hda3), sometimes an incorrect UUID is generated +* debug "categories" (ui, disk,flowcontrol,...) so you can grep (-v) on what you want + make sure enough+correct debugging is everywhere +* the old installer asked a lot of questions before actually configuring the system, eg like 'do you need support for booting from nfs/softraid/lvm2/encrypted, custom dst file?' etc.\ + do we still need this? why (not)?, and a select tag thingie would be nicer imho +* refactor all pacman stuff (modularize/functionize etc) -BETA PHASE: try to get aif on the (beta) installcd as an experimental, alternative installer. + +BETA PHASE: * find a way to not have to preload libs and stuff, only load them when needed. -> faster start of install program -* involve broader community * fix everything * if dhcpd already runs for $reason, the installer will try again @ configure network and fail. i tried killall dhcpd, killall -9 dhcpd first but that didn't help: it can't kill the process or something... -- cgit v1.2.3-54-g00ecf From 6ffd68efee8d43a54578bd10a12a819f30166b3e Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sun, 11 Jan 2009 12:07:50 +0100 Subject: README updates --- README | 57 ++++++++++++++++++++++++++++++--------------------------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/README b/README index d68d751..114b4ec 100644 --- a/README +++ b/README @@ -8,10 +8,10 @@ Author: Dieter Plaetinck Homepage: http://github.com/Dieterbe/aif -** Intro / Current state of things ** +** --> Intro / Current state of things <-- ** -AIF is included on the 2008-12 Arch install CD's as an experimental alternative for the old installer (/arch/setup). -The code of the old installer has been madly refactored, reorganized and cleaned up. +AIF is included on the 2009-01 Arch install CD's as an experimental alternative for the old installer (/arch/setup). +AIF is based on the old installer, but the code has been madly refactored, reorganized and cleaned up. AIF comes by default with these procedures: - interactive: A port of /arch/setup. Should work okay if you don't try too hard to break it ;-) @@ -23,8 +23,8 @@ installer, it depends on what you want to do: - End users: On the frontend, the interactive profile is very similar to /arch/setup. The features are more or less the same, with two notable exceptions: - * Different partition/filesystem editor with support for LVM and dm_crypt - * Rollback functionality if you change your mind after having formatted filesystems + * Different partition/filesystem editor offering more flexibility and options, such as support for LVM and dm_crypt + * Rollback functionality if you change your mind after having formatted filesystems or if something went wrong and you want to retry. - Hackers: The code base that AIF runs on is very usable for hacking. The code is modular, reusable and quite complete. If you want to build your own @@ -40,6 +40,8 @@ AIF is expected to become the new official installer in the not too distant future, so go ahead and try it ! + + ** Goals ** The goal of this project is 1) to make the code of the Arch Linux installer more clean, DRY, modular and maintainable. @@ -65,7 +67,23 @@ Basically aif.sh is put in /arch (together with the default installer scripts), A module can have 2 directories: libs, and procedures. -** Workflow ** + +** Procedures ** +core/base: basic, little-interactivity installation with some common defaults. You probably don't + want to run this one, although it's useful for other procedures to inherit from. +core/interactive: interactive, reasonably flexible/featured installer (port of /arch/setup) +core/quickinst: mostly DIY. port of /arch/quickinst +core/automatic: automatic installer/deployment tool, can use config files + +** Partial Procedures ** +These procedures allow you to run a select few functions, in order to reach +a specific goal, usually not installing a system + +partial-configure-network.sh Configure network on the runtime system +partial-disks.sh Process disk subsystem or do a rollback + + +** (Internal) Workflow ** There is a very basic but powerful workflow defined by variables, phases and workers. Depending on the procedure you choose (or write yourself), these will differ In the code, they are very recognizable and are named like this: @@ -127,31 +145,15 @@ usually will set defaults in the configure worker and override with arguments passed by the user (eg to use cli mode unless user wants dia) -** Procedures ** -core/base: basic, little-interactivity installation with some common defaults. You probably don't - want to run this one, although it's useful for other procedures to inherit from. -core/interactive: interactive, reasonably flexible/featured installer (port of /arch/setup) -core/quickinst: mostly DIY. port of /arch/quickinst -core/automatic: automatic installer/deployment tool, can use config files - -** Partial Procedures ** -These procedures allow you to run a select few functions, in order to reach -a specific goal, usually not installing a system - -partial-configure-network.sh Configure network on the runtime system -partial-disks.sh Process disk subsystem or do a rollback - - ** Contributing ** -Install a VM (I use virtualbox-ose, works fine), make a vm, boot the install -cd (only i686 works in vbox) and just follow the HOWTO. +Install a VM (I use virtualbox-ose, works fine), make a vm, boot the install cd and just follow the HOWTO. It's probably easiest if you set up your own git clone that you can easily -acces from the VM (You can open a github account and for my code). +acces from the VM (You can open a github account and fork my code). You can edit on the cd itself, but given the low resolution of the VM and the limited choice of editors, you'll probably edit on your pc, commit, push to github and pull from the clone on the cd. If you want to do debugging, just call the debug function and export DEBUG=1 -before calling the scripts. +before calling the scripts. (or pass -d) Keep in mind there are 3 kinds of variables. Those that affect/belong to the runtime (install cd live environment), target (affects/belongs to the target installation) and TMP (everything in between or extra). Variablenames @@ -161,8 +163,9 @@ it isn't always the case like that now, I need to do more refactoring) Much of the code in the core module is taken (and modified) from the 'real' arch linux install scripts code. (/arch/setup and /arch/quickinst). the modifications are mostly done -to make the code more (re)useable and to separate backend code, user -interface and flow control. (into libraries and procedures). (which was tightly coupled in the original scripts) +to make the code more (re)useable, to separate backend code, user +interface and flow control (into libraries and procedures) (which was tightly coupled in the original scripts) +and to provide additional features. I couldn't find what license the code is under, but I assume this is okay.. if not let me know. -- cgit v1.2.3-54-g00ecf From 1d7cd762d5e602be12f87f57429971e7960a5ac8 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 17 Jan 2009 20:46:20 +0100 Subject: last minute readme updates --- README | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/README b/README index 114b4ec..f0a4cc5 100644 --- a/README +++ b/README @@ -11,7 +11,7 @@ Homepage: http://github.com/Dieterbe/aif ** --> Intro / Current state of things <-- ** AIF is included on the 2009-01 Arch install CD's as an experimental alternative for the old installer (/arch/setup). -AIF is based on the old installer, but the code has been madly refactored, reorganized and cleaned up. +AIF is based on the old installer, but the code has been madly refactored, reorganized, cleaned up and in some places replaced. AIF comes by default with these procedures: - interactive: A port of /arch/setup. Should work okay if you don't try too hard to break it ;-) @@ -22,20 +22,25 @@ AIF may or may not bring much additional value for you when compared with the pr installer, it depends on what you want to do: - End users: On the frontend, the interactive profile is very similar to /arch/setup. - The features are more or less the same, with two notable exceptions: + The features are more or less the same, with a few exceptions: * Different partition/filesystem editor offering more flexibility and options, such as support for LVM and dm_crypt * Rollback functionality if you change your mind after having formatted filesystems or if something went wrong and you want to retry. + * Some miscellaneous features like the ability to choose between ncurses and CLI mode, debug output, and logging to a file. - Hackers: The code base that AIF runs on is very usable for hacking. The code is modular, reusable and quite complete. If you want to build your own installation procedures, or want to modify specific aspects of the out-of-the-box installation procedures, definitely check out how AIF - works. It is built for hacking, reusing code and making writing custom installers - as easy as possible. + works. It is built for hacking, reusing code, changing the behaviour in + specific places and making writing custom installers as easy as possible. Keep in mind that AIF is still in ALPHA phase. There are some known issues (see the TODO file and various TODO's in the source code) +If you encounter issues, please report them at http://bugs.archlinux.org/, +under the "Release Engineering" project. +There will also be a new mailing list, called arg-releng. + AIF is expected to become the new official installer in the not too distant future, so go ahead and try it ! @@ -159,7 +164,7 @@ the runtime (install cd live environment), target (affects/belongs to the target installation) and TMP (everything in between or extra). Variablenames should have _TARGET or _TMP suffixes or none for runtime. (Honestly though, it isn't always the case like that now, I need to do more refactoring) - +Bugs can be reported at http://bugs.archlinux.org/, project "Release Engineering" Much of the code in the core module is taken (and modified) from the 'real' arch linux install scripts code. (/arch/setup and /arch/quickinst). the modifications are mostly done -- cgit v1.2.3-54-g00ecf From b3cd45966241d82f2076e87a6d4a2bbf81cc2e90 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 17 Jan 2009 20:57:26 +0100 Subject: last second readme updates --- README | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README b/README index f0a4cc5..caaadd7 100644 --- a/README +++ b/README @@ -37,9 +37,11 @@ installer, it depends on what you want to do: Keep in mind that AIF is still in ALPHA phase. There are some known issues (see the TODO file and various TODO's in the source code) -If you encounter issues, please report them at http://bugs.archlinux.org/, -under the "Release Engineering" project. -There will also be a new mailing list, called arg-releng. +If you encounter issues, please report them at the Arch Linux bugtracker under the "Release Engineering" project. +( http://bugs.archlinux.org/toplevel/proj6 ) + +You can also get in touch with the release engineers / aif developers on the arg-releng +mailing list, http://www.archlinux.org/mailman/listinfo/arch-releng AIF is expected to become the new official installer in the not too distant future, so go ahead and try it ! -- cgit v1.2.3-54-g00ecf From de61605d525c06cbb19813d08e809994ac779728 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 24 Jan 2009 19:05:58 +0100 Subject: todo updates --- TODO | 1 + src/core/libs/lib-pacman.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/TODO b/TODO index 7eed72d..62ab451 100644 --- a/TODO +++ b/TODO @@ -57,6 +57,7 @@ PRODUCTION PHASE: be the primary installer. deprecate /arch/setup and /arch/qui * core/interactive: do pacman -Sy in the background during early phases, to lessen the wait period before selecting packages * write bash completion thing for aif modules/procedures * add dmraid/mdadm support -> patches welcome. i don't care about this. +* check if it would be useful to support kickstart config files. we can look at quickstart for that http://dev.gentoo.org/~agaffney/quickstart.php SOMEDAY/MAYBE/RANDOM THOUGHTS: * the quickinst assumes the user did some stuff by himself and does some diff --git a/src/core/libs/lib-pacman.sh b/src/core/libs/lib-pacman.sh index d613052..89c3638 100644 --- a/src/core/libs/lib-pacman.sh +++ b/src/core/libs/lib-pacman.sh @@ -86,7 +86,7 @@ done [ ! -d "${var_TARGET_DIR}/var/lib/pacman" ] && mkdir -m 755 -p "${var_TARGET_DIR}/var/lib/pacman" infofy "Refreshing package database..." - $PACMAN_TARGET -Sy >$LOG 2>&1 || return 1 + $PACMAN_TARGET -Sy >$LOG 2>&1 || return 1 #TODO: make sure this also goes into the logfile. actually we should do this for many commands. return 0 } -- cgit v1.2.3-54-g00ecf From 774e055061e9fefc362c214e19b6c5bd72a93e6d Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 24 Jan 2009 19:19:05 +0100 Subject: bugfix for broken pacman db because we sync for target, not for runtime --- src/core/libs/lib-ui-interactive.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh index 01de0cc..3e61c2a 100644 --- a/src/core/libs/lib-ui-interactive.sh +++ b/src/core/libs/lib-ui-interactive.sh @@ -579,7 +579,7 @@ interactive_select_packages() { # show group listing for group selection, base is ON by default, all others are OFF local _catlist="base ^ ON" - for i in $($PACMAN -Sg | sed "s/^base$/ /g"); do + for i in $($PACMAN_TARGET -Sg | sed "s/^base$/ /g"); do _catlist="${_catlist} ${i} - OFF" done @@ -588,10 +588,10 @@ interactive_select_packages() { # assemble a list of packages with groups, marking pre-selected ones # - local _pkgtmp="$($PACMAN -Sl core | awk '{print $2}')" # all packages in core repository + local _pkgtmp="$($PACMAN_TARGET -Sl core | awk '{print $2}')" # all packages in core repository local _pkglist='' - $PACMAN -Si $_pkgtmp | awk '/^Name/{ printf("%s ",$3) } /^Group/{ print $3 }' > $ANSWER + $PACMAN_TARGET -Si $_pkgtmp | awk '/^Name/{ printf("%s ",$3) } /^Group/{ print $3 }' > $ANSWER while read pkgname pkgcat; do # check if this package is in a selected group # slightly ugly but sorting later requires newlines in the variable -- cgit v1.2.3-54-g00ecf From 0a9f555db95bc7ade7a79e244885aa97456ddf7e Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 24 Jan 2009 20:01:37 +0100 Subject: howto update --- HOWTO | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/HOWTO b/HOWTO index 297ce3a..ed46272 100644 --- a/HOWTO +++ b/HOWTO @@ -1,7 +1,5 @@ ### This howto explains how to install aif on an installcd that does not have the aif package installed yet ### ### You can also use this if you want to use another version than what's available on the installcd) ### -### TODO: someday, have an iso that comes with aif by default) ### - 1) Boot from the installcd @@ -16,6 +14,9 @@ I assume you'll pick aif-git. # root shell: /arch/setup. # fake ftp install so it lets you run the network configure script + +Alternatively, if you have a recent version of AIF installed and it comes with the partial-network procedure, you can execute that to set up your network. + # when network works, quit installer pacman -Sy git fakeroot # You need about 192MB ram for this! 128MB is not enough. -- cgit v1.2.3-54-g00ecf From e9c113324dfa3f40206a280f99aa47e4d731debf Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 24 Jan 2009 20:07:13 +0100 Subject: tell user where to find the readme --- src/aif.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/aif.sh b/src/aif.sh index 0db3d6c..fad2e40 100755 --- a/src/aif.sh +++ b/src/aif.sh @@ -18,7 +18,8 @@ usage () -l Explicitly enable logging to file (optional) -h Help: show usage (optional)\n If the procedurename starts with 'http://' it will be wget'ed. Otherwise it's assumed to be a procedure in the VFS tree -If the procedurename is prefixed with '/' it will be loaded from user module . See README\n +If the procedurename is prefixed with '/' it will be loaded from user module .\n +For more info, see the README which you can find in /home/arch/aif/docs\n Available procedures on the filesystem: `find /home/arch/aif/core/procedures -type f`\n `find /home/arch/aif/user/*/procedures -type f 2>/dev/null`" -- cgit v1.2.3-54-g00ecf From 8bec371c9fbc6bb8c7d1efed8a8538ea2c842a3d Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 14 Feb 2009 14:14:18 +0100 Subject: slightly better way to get disk size with fdisk --- src/core/libs/lib-blockdevices-filesystems.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/core/libs/lib-blockdevices-filesystems.sh b/src/core/libs/lib-blockdevices-filesystems.sh index 29ae2ab..3b43541 100644 --- a/src/core/libs/lib-blockdevices-filesystems.sh +++ b/src/core/libs/lib-blockdevices-filesystems.sh @@ -739,6 +739,8 @@ get_filesystem_program () # $2 standard SI for 1000*n, IEC for 1024*n (optional. defaults to SI) # --> Note that if you do SI on a partition, you get the size of the entire disk, so for now you need IEC for single partitions # output will be in $BLOCKDEVICE_SIZE in MB/MiB +# WARNING: hdparm works - by design - only for ide/sata. not scsi et al +# TODO: clean up all disk size related stuff. see http://bugs.archlinux.org/task/12949 get_blockdevice_size () { [ -b "$1" ] || die_error "get_blockdevice_size needs a blockdevice as \$1 ($1 given)" @@ -749,8 +751,9 @@ get_blockdevice_size () BLOCKDEVICE_SIZE=$(hdparm -I $1 | grep -F '1000*1000' | sed "s/^.*:[ \t]*\([0-9]*\) MBytes.*$/\1/") elif [ "$standard" = IEC ] then - blocks=`fdisk -s $1` || show_warning "Fdisk problem" "Something failed when trying to do fdisk -s $1" - #NOTE: on some interwebs they say 1 block = 512B, on other internets they say 1 block = 1kiB. 1kiB seems to work for me. don't sue me if it doesn't for you - BLOCKDEVICE_SIZE=$(($blocks/1024)) + #NOTE: unreliable method: on some interwebs they say 1 block = 512B, on other internets they say 1 block = 1kiB. 1kiB seems to work for me. don't sue me if it doesn't for you + #blocks=`fdisk -s $1` || show_warning "Fdisk problem" "Something failed when trying to do fdisk -s $1" + #BLOCKDEVICE_SIZE=$(($blocks/1024)) + BLOCKDEVICE_SIZE=$((`fdisk -l $1 | sed -n '2p' | cut -d' ' -f5`/1024)) fi } -- cgit v1.2.3-54-g00ecf From d860efe097ff76c511b5fdf53dc2c90752e2b85b Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 14 Feb 2009 15:03:06 +0100 Subject: fix FS#13045 - add joe editor --- src/core/libs/lib-ui-interactive.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh index 3e61c2a..851e990 100644 --- a/src/core/libs/lib-ui-interactive.sh +++ b/src/core/libs/lib-ui-interactive.sh @@ -876,17 +876,21 @@ interactive_select_mirror() { echo "Using mirror: $var_SYNC_URL" >$LOG } -# geteditor(). taken from original setup code. +# geteditor(). # prompts the user to choose an editor # sets EDITOR global variable # interactive_get_editor() { - ask_option no "Text editor selection" "Select a Text Editor to Use" \ - "1" "nano (easier)" \ - "2" "vi" + unset EDITOR_OPTS + which nano &>/dev/null && EDITOR_OPTS+=("nano" "nano (easier)") + which joe &>/dev/null && EDITOR_OPTS+=("joe" "joe's editor") + which vi &>/dev/null && EDITOR_OPTS+=("vi" "vi (advanced)") + ask_option no "Text editor selection" "Select a Text Editor to Use" "${EDITOR_OPTS[@]}" + #TODO: this code could be a little bit cleaner. case $ANSWER_OPTION in - "1") EDITOR="nano" ;; - "2") EDITOR="vi" ;; - *) EDITOR="nano" ;; + "nano") EDITOR="nano" ;; + "joe") EDITOR="joe" ;; + "vi") EDITOR="vi" ;; + *) EDITOR="nano" ;; esac } -- cgit v1.2.3-54-g00ecf From fd77cd880518f288b2c4a8d5885b41ef829db04c Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 14 Feb 2009 15:50:23 +0100 Subject: port of FS#13101 - simple fix to setup script writing timezone to rc.conf --- src/core/procedures/interactive | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive index dc4232a..08bdf23 100644 --- a/src/core/procedures/interactive +++ b/src/core/procedures/interactive @@ -120,7 +120,8 @@ worker_configure_system() # /etc/rc.conf # Make sure timezone and utc info are what we want - sed -i -e "s/^TIMEZONE=.*/TIMEZONE=\"$TIMEZONE\"/g" \ + # NOTE: If a timezone string never contains more then 1 slash, we can use ${TIMEZONE/\//\\/} + sed -i -e "s/^TIMEZONE=.*/TIMEZONE=\"${TIMEZONE//\//\\/}\"/g" \ -e "s/^HARDWARECLOCK=.*/HARDWARECLOCK=\"$HARDWARECLOCK\"/g" \ ${var_TARGET_DIR}/etc/rc.conf -- cgit v1.2.3-54-g00ecf From 9506a6b2359e9c1ca8b3da9e6f6528e2bda97803 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 14 Feb 2009 16:14:01 +0100 Subject: port of FS#13102 - fix, need to copy initial /etc/localtime --- src/core/procedures/base | 6 ++++++ src/core/procedures/interactive | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/core/procedures/base b/src/core/procedures/base index 93c711c..6aa7767 100644 --- a/src/core/procedures/base +++ b/src/core/procedures/base @@ -166,6 +166,12 @@ worker_locales () } +worker_initialtime () +{ + cp /etc/localtime ${var_TARGET_DIR}/etc/localtime +} + + worker_install_bootlader () { #TODO: ask which disk, install grub on it diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive index 08bdf23..691652f 100644 --- a/src/core/procedures/interactive +++ b/src/core/procedures/interactive @@ -81,7 +81,8 @@ mainmenu() execute worker auto_locale ; } && NEXTITEM=6 ;; "6") check_depend worker install_packages && execute worker configure_system && { execute worker mkinitcpio ; \ - execute worker locales ; } && NEXTITEM=7 ;; #TODO: why is next item 4 if $?=0?. maybe fixed now + execute worker locales ; + execute worker initialtime ; } && NEXTITEM=7 ;; #TODO: why is next item 4 if $?=0?. maybe fixed now "7") check_depend worker configure_system && execute worker install_bootloader && NEXTITEM=8 ;; "8") -- cgit v1.2.3-54-g00ecf From 39e42a15a8e1c5ea1b4a61874de4f4834cb64e68 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 14 Feb 2009 18:06:31 +0100 Subject: port of FS#13237 - Copying manual network configuration to rc.conf --- src/core/libs/lib-network.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/core/libs/lib-network.sh b/src/core/libs/lib-network.sh index ab91069..9ed96b2 100644 --- a/src/core/libs/lib-network.sh +++ b/src/core/libs/lib-network.sh @@ -13,18 +13,18 @@ target_configure_network() PROXY_HTTP="$2" PROXY_FTP="$3" if [ "$1" = fixed ]; then - sed -i "s#eth0=\"eth0#$INTERFACE=\"$INTERFACE#g" ${var_TARGET_DIR}/etc/rc.conf - sed -i "s# 192.168.0.2 # $IPADDR #g" ${var_TARGET_DIR}/etc/rc.conf - sed -i "s# 255.255.255.0 # $SUBNET #g" ${var_TARGET_DIR}/etc/rc.conf - sed -i "s# 192.168.0.255\"# $BROADCAST\"#g" ${var_TARGET_DIR}/etc/rc.conf - sed -i "s#eth0)#$INTERFACE)#g" ${var_TARGET_DIR}/etc/rc.conf + sed -i "s#eth0=\"eth0#$INTERFACE=\"$INTERFACE#g" ${var_TARGET_DIR}/etc/rc.conf + sed -i "s#$INTERFACE 192.168.0.2#$INTERFACE $IPADDR#g" ${var_TARGET_DIR}/etc/rc.conf + sed -i "s#netmask 255.255.255.0#netmask $SUBNET#g" ${var_TARGET_DIR}/etc/rc.conf + sed -i "s#broadcast 192.168.0.255#broadcast $BROADCAST#g" ${var_TARGET_DIR}/etc/rc.conf + sed -i "s#INTERFACES=(eth0)#INTERFACES=($INTERFACE)#g" ${var_TARGET_DIR}/etc/rc.conf if [ "$GW" != "" ]; then - sed -i "s#gw 192.168.0.1#gw $GW#g" ${var_TARGET_DIR}/etc/rc.conf - sed -i "s#!gateway#gateway#g" ${var_TARGET_DIR}/etc/rc.conf + sed -i "s#gw 192.168.0.1#gw $GW#g" ${var_TARGET_DIR}/etc/rc.conf + sed -i "s#!gateway#gateway#g" ${var_TARGET_DIR}/etc/rc.conf fi echo "nameserver $DNS" >> ${var_TARGET_DIR}/etc/resolv.conf else - sed -i "s#eth0=\"eth0.*#$INTERFACE=\"dhcp\"#g" ${var_TARGET_DIR}/etc/rc.conf + sed -i "s#eth0=\"eth0.*#$INTERFACE=\"dhcp\"#g" ${var_TARGET_DIR}/etc/rc.conf fi if [ "$PROXY_HTTP" != "" ]; then -- cgit v1.2.3-54-g00ecf From 9e895707d72b600ab722337c7b26ce226675c11c Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 14 Feb 2009 18:29:24 +0100 Subject: typo fix: $SYNC_URL -> $var_SYNC_URL --- src/core/procedures/interactive | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive index 691652f..051d187 100644 --- a/src/core/procedures/interactive +++ b/src/core/procedures/interactive @@ -113,9 +113,9 @@ worker_configure_system() #TODO: only need to do this once. check 'ended_ok worker configure_system' is not good because this could be done already even if worker did not exit 0 # /etc/pacman.d/mirrorlist # add installer-selected mirror to the top of the mirrorlist - if [ "$var_PKG_SOURCE_TYPE" = "ftp" -a "${SYNC_URL}" != "" ]; then - debug "Adding choosen mirror (${SYNC_URL}) to ${var_TARGET_DIR}/$var_MIRRORLIST" - mirrorlist=`awk "BEGIN { printf(\"# Mirror used during installation\nServer = "${SYNC_URL}"\n\n\") } 1 " "${var_TARGET_DIR}/$var_MIRRORLIST"` + if [ "$var_PKG_SOURCE_TYPE" = "ftp" -a "${var_SYNC_URL}" != "" ]; then + debug "Adding choosen mirror (${var_SYNC_URL}) to ${var_TARGET_DIR}/$var_MIRRORLIST" + mirrorlist=`awk "BEGIN { printf(\"# Mirror used during installation\nServer = "${var_SYNC_URL}"\n\n\") } 1 " "${var_TARGET_DIR}/$var_MIRRORLIST"` echo "$mirrorlist" > "${var_TARGET_DIR}/$var_MIRRORLIST" #TODO: test this, this may not work fi -- cgit v1.2.3-54-g00ecf From ccc552ef115d3d7fcd5f92121ba9838e9b199361 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 14 Feb 2009 18:43:11 +0100 Subject: port of FS#12944 - Pacman mirrorlist installer edits --- src/core/libs/lib-pacman.sh | 2 +- src/core/libs/lib-ui-interactive.sh | 9 ++++----- src/core/procedures/base | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/core/libs/lib-pacman.sh b/src/core/libs/lib-pacman.sh index 89c3638..4497074 100644 --- a/src/core/libs/lib-pacman.sh +++ b/src/core/libs/lib-pacman.sh @@ -78,7 +78,7 @@ do then add_pacman_repo target ${repo} "Include = $var_MIRRORLIST" else - add_pacman_repo target ${repo} "Server = ${serverurl}" + add_pacman_repo target ${repo} "Server = ${serverurl/\/\$repo\//\/$repo\/}" # replace literal '/$repo/' in the serverurl string by "/$repo/" where $repo is our variable. fi done # Set up the necessary directories for pacman use diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh index 851e990..343ecc4 100644 --- a/src/core/libs/lib-ui-interactive.sh +++ b/src/core/libs/lib-ui-interactive.sh @@ -865,13 +865,12 @@ interactive_select_mirror() { local _server=$ANSWER_OPTION if [ "${_server}" = "Custom" ]; then ask_string "Enter the full URL to core repo." "ftp://ftp.archlinux.org/core/os/$var_ARCH" || return 1 - var_SYNC_URL=$ANSWER_STRING + var_SYNC_URL=${ANSWER_STRING/\/core\///\$repo/} #replace '/core/' by '/$repo/' else # Form the full URL for our mirror by grepping for the server name in - # our mirrorlist and pulling the full URL out. Substitute 'core' in - # for the repository name, and ensure that if it was listed twice we - # only return one line for the mirror. - var_SYNC_URL=$(egrep -o "${_server}.*" "${var_MIRRORLIST}" | sed 's/\$repo/core/g' | head -n1) + # our mirrorlist and pulling the full URL out. + # Ensure that if it was listed twice we only return one line for the mirror. + var_SYNC_URL=$(egrep -o "${_server}.*" "${var_MIRRORLIST}" | head -n1) fi echo "Using mirror: $var_SYNC_URL" >$LOG } diff --git a/src/core/procedures/base b/src/core/procedures/base index 6aa7767..c22a01c 100644 --- a/src/core/procedures/base +++ b/src/core/procedures/base @@ -8,7 +8,7 @@ var_RUNTIME_PACKAGES= var_PKG_FILE=$RUNTIME_DIR/package-list # not used by default in base/interactive. can be used by custom procedures or profiles for the automatic procedure var_MIRRORLIST="/etc/pacman.d/mirrorlist" var_UI_TYPE="cli" # set to cli or dia for dialog -var_ARCH=`uname -m` #i686 or x86_64 +var_ARCH=`uname -m` #i686 or x86_64. NOTE: this assumes you want to install the same arch as the installation environment you're using. maybe we could decouple those someday.. [ -z "$var_ARCH" ] && die_error "Could not determine your architecture" ###### Phases ( can be overridden by more specific procedures) ###### @@ -67,7 +67,7 @@ worker_select_source () { var_PKG_SOURCE_TYPE='cd' var_FILE_URL="file:///src/core/pkg" - var_SYNC_URL= + var_SYNC_URL= # optional, points to a repository string something like ftp://ftp.belnet.be/mirror/archlinux.org/$repo/os/i686 (eg the same format as what you find in /etc/pacman.conf) # if you override to use ftp (or ask user and he chooses ftp) don't forget to configure the network and to select_mirrors } -- cgit v1.2.3-54-g00ecf From e57534b6d6603a95ceda3b105ea567ac849dadd3 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 14 Feb 2009 22:38:29 +0100 Subject: todo updates --- TODO | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index 62ab451..a0526bd 100644 --- a/TODO +++ b/TODO @@ -2,7 +2,7 @@ See also the FIXME's and TODO's in the code. ALPHA PHASE: -* setup bugtracker/roadmap thingie +* when invoking /arch/aif -p interactive on a "normal" pc, it always wants to abort * check everywhere that if users cancels something, we return 1, empty string behavior etc * core/interactive: fix workaround needed for installpkg exitcode * core/interactive: keymap and timezone settings from installer dan't not go in $target/etc/rc.conf @@ -14,7 +14,6 @@ ALPHA PHASE: * automatically configure grub for dm_crypt and lvm * move "/tmp/pacman.conf" to runtime directory and variablize everywhere * hmm wasn't there a hwdetect/hwd or something in /arch/setup? this seems to have disappeared. -* shouldn't we put /etc/hostname in 'configure system' ? ASKDEV * a nice way to be able to "inject" functions/logic without: * needing to redefine phases with only 1 entry different (duplicate code is not nice, less maintainable etc) * override worker functions which are 90% copy-pasted because the parent functionality is mostly okay, but not exactly what we want @@ -29,7 +28,7 @@ ALPHA PHASE: * mirrorlist config doesn't change after selecting mirror * 'keep in mind trottled' geen separate screen * cool, network setting coping into target/rc.conf seems to work wih aif. at least for dhcp.. it even asks nicely -* split up lib-ui as sep project, make a generic 'LIF' project,.. +* split up lib-ui as sep project, make a generic 'LIF' project, set $DISTRO somewhere and use that everywhere... * in usage, procedure specific opts points to parent profile when using inheritance * we may have an issue with ftp based installation where package installation works fine, however it tries to die instead of 'package installation complete' but it can't die because the --textbox fails in show_warning * ( only in experimental?) grub sedding sometimes does, and sometimes doesn't work. default config remains (eg /dev/hda3), sometimes an incorrect UUID is generated @@ -37,6 +36,10 @@ ALPHA PHASE: * the old installer asked a lot of questions before actually configuring the system, eg like 'do you need support for booting from nfs/softraid/lvm2/encrypted, custom dst file?' etc.\ do we still need this? why (not)?, and a select tag thingie would be nicer imho * refactor all pacman stuff (modularize/functionize etc) +* in lvm VG editor you can press "cancel" (when 'new' is selected, maybe otherwise too) and create a new LV which will get a block entry, but no fs entry on the VG block! +* add noconfirm ofzo dinges when installing packages, zoda hij nie zaagt voor dep cycles +* aif : na "mijn" partitielayout: bij grub ( nog voor text editor op menu.lst) zegt iets ( op foreground van ncurses) Can't remove.. ik denk zelfs 'Grub: Can't remove..' en daarna een gewone entry, geen uuid's gewoon /dev/sda3 ro +* port from /arch/setup: grub install chroot thing (waiting for ticket), 2 patches from foutrelis @ http://bugs.archlinux.org/task/12949 BETA PHASE: -- cgit v1.2.3-54-g00ecf From 20cadeb452b15563a9e6eafe6d3bb6b760388cba Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 14 Feb 2009 22:43:20 +0100 Subject: removing unofficial dir. serves no purpose anymore --- unofficial/HOWTO | 9 --------- unofficial/whatsthis.txt | 5 ----- 2 files changed, 14 deletions(-) delete mode 100644 unofficial/HOWTO delete mode 100644 unofficial/whatsthis.txt diff --git a/unofficial/HOWTO b/unofficial/HOWTO deleted file mode 100644 index 4dc6384..0000000 --- a/unofficial/HOWTO +++ /dev/null @@ -1,9 +0,0 @@ -# to install these unofficial modules onto the arch install cd: - - - -# install aif from package - -git clone git://github.com/Dieterbe/aif.git /home/arch/tmp - -cp -ax /home/arch/tmp/unofficial/modules/* /home/arch/aif/user/ diff --git a/unofficial/whatsthis.txt b/unofficial/whatsthis.txt deleted file mode 100644 index a3bfa0d..0000000 --- a/unofficial/whatsthis.txt +++ /dev/null @@ -1,5 +0,0 @@ -This directory contains unofficial additions (modules) to/for AIF that I (Dieter) -am writing. - -They are _not_ intended to be part of the "official" aif. it's just in the same repo for -my own convenience. \ No newline at end of file -- cgit v1.2.3-54-g00ecf From 6b2a02c6099da06aeddc4a0595121943fada07c6 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 14 Feb 2009 23:20:27 +0100 Subject: tried to make aif FHS/hier compliant + updated howto/readme --- HOWTO | 25 ++++++++++++++----------- README | 11 ++++++----- TODO | 3 +-- src/aif.sh | 18 ++++++++++++------ src/core/libs/lib-misc.sh | 3 ++- src/runtime/whatsthis.txt | 1 - 6 files changed, 35 insertions(+), 26 deletions(-) delete mode 100644 src/runtime/whatsthis.txt diff --git a/HOWTO b/HOWTO index ed46272..e2c714a 100644 --- a/HOWTO +++ b/HOWTO @@ -1,16 +1,20 @@ -### This howto explains how to install aif on an installcd that does not have the aif package installed yet ### -### You can also use this if you want to use another version than what's available on the installcd) ### +### This howto explains how to install/upgrade aif on an arch system / arch installation cd ### -1) Boot from the installcd - -2) Open 2 shells, one as user root, one as regular user (arch) +* an installation cd is in essence just an arch system, it just has the aif package installed. you can install aif on any system without problems. +* install cd's from 2009.02 and up have aif on board, so probably you don't need to do anything at all. -3) Decide on a package. See http://aur.archlinux.org/packages.php?K=aif for available packages +* there is a "binary" package in extra, containing a recent release +* there are 2 source packages in AUR, one for each branch in git. ( see http://aur.archlinux.org/packages.php?K=aif ) - aif-git: latest code from the git master (stable) branch: recommended! - aif-experimental-git: latest development code. Code is tested here and if ok, merged into master. Use at own risk!! -I assume you'll pick aif-git. -4) Copy paste the code below. +So, assuming you want to upgrade the aif package on an installation cd, to say aif-experimental-git from AUR, you would: + +1) Boot from the installcd + +2) Open 2 shells, one as user root, one as regular user (arch) + +3) Copy paste the code below. # root shell: /arch/setup. # fake ftp install so it lets you run the network configure script @@ -29,12 +33,11 @@ makepkg # root shell: pacman -U /home/arch/aif-git/aif*.pkg.tar.gz - 4) Fire it up! (as root) -/arch/aif -p #you can skip networking. +aif -p #you can skip networking. -For more info see README or /arch/aif -h. +For more info see README or aif -h. diff --git a/README b/README index caaadd7..71d4064 100644 --- a/README +++ b/README @@ -10,7 +10,7 @@ Homepage: http://github.com/Dieterbe/aif ** --> Intro / Current state of things <-- ** -AIF is included on the 2009-01 Arch install CD's as an experimental alternative for the old installer (/arch/setup). +AIF is included on the 2009.02 Arch install CD's as an experimental alternative for the old installer (/arch/setup). AIF is based on the old installer, but the code has been madly refactored, reorganized, cleaned up and in some places replaced. AIF comes by default with these procedures: @@ -67,10 +67,11 @@ The goal of AIF is not (yet): Basically aif.sh is put in /arch (together with the default installer scripts), while all other aif-related files belong in /home/arch/aif * aif.sh -> /arch/aif -* docs -> /home/arch/aif/docs/ -* core module -> /home/arch/aif/core -* user modules -> /home/arch/aif/user/ (put your own modules here) -* runtime files -> /home/arch/aif/runtime (package list etc go here) +* docs -> /usr/share/aif/docs +* core module -> /usr/lib/aif/core +* user modules -> /usr/lib/aif/user/ (put your own modules here) +* runtime files -> /tmp/aif (package list etc go here) +* logs -> /var/log/aif A module can have 2 directories: libs, and procedures. diff --git a/TODO b/TODO index a0526bd..c747210 100644 --- a/TODO +++ b/TODO @@ -43,8 +43,8 @@ ALPHA PHASE: BETA PHASE: +* ext4 default options? -O dir_index,extent,uninit_bg ? * find a way to not have to preload libs and stuff, only load them when needed. -> faster start of install program -* fix everything * if dhcpd already runs for $reason, the installer will try again @ configure network and fail. i tried killall dhcpd, killall -9 dhcpd first but that didn't help: it can't kill the process or something... I can also add something like for iface in `moo` (or only the one selected iface); do ifconfig $iface down; @@ -55,7 +55,6 @@ skip that check or something. Alternatively, maybe just show which steps are do * auto-configure mkinitcpio.conf for dm_crypt and lvm PRODUCTION PHASE: be the primary installer. deprecate /arch/setup and /arch/quickinst -* fix everything even more * bribe devs * core/interactive: do pacman -Sy in the background during early phases, to lessen the wait period before selecting packages * write bash completion thing for aif modules/procedures diff --git a/src/aif.sh b/src/aif.sh index fad2e40..783e7c9 100755 --- a/src/aif.sh +++ b/src/aif.sh @@ -1,10 +1,14 @@ #!/bin/bash + ###### Set some default variables ###### TITLE="Arch Linux Installation Framework" LOG="/dev/tty7" -RUNTIME_DIR=/home/arch/aif/runtime -LOGFILE=$RUNTIME_DIR/aif.log +LIB_CORE=/usr/lib/aif/core +LIB_USER=/usr/lib/aif/user +RUNTIME_DIR=/tmp/aif +LOG_DIR=/var/log/aif +LOGFILE=$LOG_DIR/aif.log ###### Miscalleaneous functions ###### @@ -19,10 +23,10 @@ usage () -h Help: show usage (optional)\n If the procedurename starts with 'http://' it will be wget'ed. Otherwise it's assumed to be a procedure in the VFS tree If the procedurename is prefixed with '/' it will be loaded from user module .\n -For more info, see the README which you can find in /home/arch/aif/docs\n -Available procedures on the filesystem: -`find /home/arch/aif/core/procedures -type f`\n -`find /home/arch/aif/user/*/procedures -type f 2>/dev/null`" +For more info, see the README which you can find in /usr/share/aif/docs\n +Available procedures: +`find $LIB_CORE/procedures -type f | sed 's#$LIB_CORE##'`\n +`find $LIB_USER/*/procedures -type f 2>/dev/null | sed 's#$LIB_USER##'`" [ -n "$procedure" ] && msg="$msg\nProcedure ($procedure) specific options:\n$var_ARGS_USAGE" echo -e "$msg" @@ -40,6 +44,7 @@ notify () log () { + mkdir -p $LOG_DIR || die_error "Cannot create log directory" str="[LOG] `date +"%Y-%m-%d %H:%M:%S"` $@" echo -e "$str" > $LOG [ "$LOG_TO_FILE" = 1 ] && echo -e "$str" >> $LOGFILE @@ -48,6 +53,7 @@ log () debug () { + mkdir -p $LOG_DIR || die_error "Cannot create log directory" str="[DEBUG] $@" if [ "$DEBUG" = "1" ] then diff --git a/src/core/libs/lib-misc.sh b/src/core/libs/lib-misc.sh index bd59ce0..01c291f 100644 --- a/src/core/libs/lib-misc.sh +++ b/src/core/libs/lib-misc.sh @@ -62,8 +62,9 @@ check_is_in () } -# cleans up file in the runtime directory who can be deleted +# cleans up file in the runtime directory who can be deleted, make dir first if needed cleanup_runtime () { + mkdir -p $RUNTIME_DIR || die_error "Cannot create $RUNTIME_DIR" rm -rf $RUNTIME_DIR/.dia* &>/dev/null } diff --git a/src/runtime/whatsthis.txt b/src/runtime/whatsthis.txt deleted file mode 100644 index 5a22a0e..0000000 --- a/src/runtime/whatsthis.txt +++ /dev/null @@ -1 +0,0 @@ -aif will put files it uses during runtime here. (no source code goes here) \ No newline at end of file -- cgit v1.2.3-54-g00ecf From 0de5cef953a9be77bf2c48192d56a05a0e278b62 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 14 Feb 2009 23:28:24 +0100 Subject: tried to make aif FHS/hier compliant --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 71d4064..3e249e6 100644 --- a/README +++ b/README @@ -66,7 +66,7 @@ The goal of AIF is not (yet): ** File locations (on the install CD): ** Basically aif.sh is put in /arch (together with the default installer scripts), while all other aif-related files belong in /home/arch/aif -* aif.sh -> /arch/aif +* aif.sh -> /sbin/aif * docs -> /usr/share/aif/docs * core module -> /usr/lib/aif/core * user modules -> /usr/lib/aif/user/ (put your own modules here) -- cgit v1.2.3-54-g00ecf From c49126d72b7c4032af66ae7fb3810e22b130946d Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sun, 15 Feb 2009 01:12:30 +0100 Subject: howto fixes --- HOWTO | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/HOWTO b/HOWTO index e2c714a..296d12d 100644 --- a/HOWTO +++ b/HOWTO @@ -25,13 +25,13 @@ Alternatively, if you have a recent version of AIF installed and it comes with t pacman -Sy git fakeroot # You need about 192MB ram for this! 128MB is not enough. # arch shell -wget http://aur.archlinux.org/packages/aif-git/aif-git.tar.gz -tar -xzf -cd aif-git +wget http://aur.archlinux.org/packages/aif-experimental-git/aif-experimental-git.tar.gz +tar -xzf aif-experimental-git.tar.gz +cd aif-experimental-git makepkg # root shell: -pacman -U /home/arch/aif-git/aif*.pkg.tar.gz +pacman -U /home/arch/aif-experimental-git/aif*.pkg.tar.gz 4) Fire it up! (as root) -- cgit v1.2.3-54-g00ecf From 84abaf01394412521ef087756704936f459f4af0 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sun, 15 Feb 2009 01:21:16 +0100 Subject: some more changes related to FHS stuff --- README | 1 - src/aif.sh | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/README b/README index 3e249e6..6cd4f84 100644 --- a/README +++ b/README @@ -64,7 +64,6 @@ The goal of AIF is not (yet): ** File locations (on the install CD): ** -Basically aif.sh is put in /arch (together with the default installer scripts), while all other aif-related files belong in /home/arch/aif * aif.sh -> /sbin/aif * docs -> /usr/share/aif/docs diff --git a/src/aif.sh b/src/aif.sh index 783e7c9..cf52ac9 100755 --- a/src/aif.sh +++ b/src/aif.sh @@ -71,8 +71,8 @@ load_module () { [ -z "$1" ] && die_error "load_module needs a module argument" log "Loading module $1 ..." - path=/home/arch/aif/user/"$1" - [ "$1" = core ] && path=/home/arch/aif/core + path=$LIB_USER/"$1" + [ "$1" = core ] && path=$LIB_CORE for submodule in lib #procedure don't load procedures automatically! do @@ -105,8 +105,8 @@ load_procedure() wget "$2" -q -O $procedure >/dev/null || die_error "Could not download procedure $2" else log "Loading procedure $1/procedures/$2 ..." - procedure=/home/arch/aif/user/"$1"/procedures/"$2" - [ "$1" = core ] && procedure=/home/arch/aif/core/procedures/"$2" + procedure=$LIB_USER/"$1"/procedures/"$2" + [ "$1" = core ] && procedure=$LIB_CORE/procedures/"$2" fi [ -f "$procedure" ] && source "$procedure" || die_error "Something went wrong while sourcing procedure $procedure" } @@ -119,8 +119,8 @@ load_lib () [ -z "$1" ] && die_error "load_library needs a module als \$1 and library as \$2" [ -z "$2" ] && die_error "load_library needs a library as \$2" log "Loading library $1/libs/$2 ..." - lib=/home/arch/aif/user/"$1"/libs/"$2" - [ "$1" = core ] && lib=/home/arch/aif/core/libs/"$2" + lib=$LIB_USER/"$1"/libs/"$2" + [ "$1" = core ] && lib=$LIB_CORE/libs/"$2" source $lib || die_error "Something went wrong while sourcing library $lib" } -- cgit v1.2.3-54-g00ecf From d20ccc5e16ab42a64d3d9f8e39060b7ac66a4a3a Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sun, 15 Feb 2009 11:09:19 +0100 Subject: fix for procedures display --- src/aif.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aif.sh b/src/aif.sh index cf52ac9..00f71e4 100755 --- a/src/aif.sh +++ b/src/aif.sh @@ -25,8 +25,8 @@ If the procedurename starts with 'http://' it will be wget'ed. Otherwise it's a If the procedurename is prefixed with '/' it will be loaded from user module .\n For more info, see the README which you can find in /usr/share/aif/docs\n Available procedures: -`find $LIB_CORE/procedures -type f | sed 's#$LIB_CORE##'`\n -`find $LIB_USER/*/procedures -type f 2>/dev/null | sed 's#$LIB_USER##'`" +`find $LIB_CORE/procedures -type f | sed \"s#$LIB_CORE##\"`\n +`find $LIB_USER/*/procedures -type f 2>/dev/null | sed \"s#$LIB_USER##\"`" [ -n "$procedure" ] && msg="$msg\nProcedure ($procedure) specific options:\n$var_ARGS_USAGE" echo -e "$msg" -- cgit v1.2.3-54-g00ecf From 01f787976ff52b9579e97604272664627a64c53c Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sun, 15 Feb 2009 12:07:56 +0100 Subject: syntax fix for grub code causing wrong menu.lst --- src/core/libs/lib-ui-interactive.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh index 343ecc4..8fdc5dc 100644 --- a/src/core/libs/lib-ui-interactive.sh +++ b/src/core/libs/lib-ui-interactive.sh @@ -709,7 +709,7 @@ interactive_install_grub() { bootdev=$(mount | grep $var_TARGET_DIR/boot | cut -d' ' -f 1) if [ "$grubdev" != "" -o "$bootdev" != "" ]; then subdir= - [ -n "$bootdev" != "" ] && grubdev=$(mapdev $bootdev) || subdir="/boot" + [ -n "$bootdev" ] && grubdev=$(mapdev $bootdev) || subdir="/boot" # keep the file from being completely bogus if [ "$grubdev" = "DEVICE NOT FOUND" ]; then -- cgit v1.2.3-54-g00ecf From 28b9e27ea026623a97f91b21ab495117040be9c5 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sun, 15 Feb 2009 12:31:34 +0100 Subject: pacman -U inplace fix --- HOWTO | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HOWTO b/HOWTO index 296d12d..d4b94e4 100644 --- a/HOWTO +++ b/HOWTO @@ -31,6 +31,7 @@ cd aif-experimental-git makepkg # root shell: +pacman -R aif # pacman can't replace with -U yet.. pacman -U /home/arch/aif-experimental-git/aif*.pkg.tar.gz 4) Fire it up! (as root) @@ -47,4 +48,3 @@ For more info see README or aif -h. - -- cgit v1.2.3-54-g00ecf From 100d2038e4d272b7a084d55183b1b73360358248 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sun, 15 Feb 2009 12:42:31 +0100 Subject: fix for display of user procedures --- src/aif.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aif.sh b/src/aif.sh index 00f71e4..beaf30c 100755 --- a/src/aif.sh +++ b/src/aif.sh @@ -25,8 +25,8 @@ If the procedurename starts with 'http://' it will be wget'ed. Otherwise it's a If the procedurename is prefixed with '/' it will be loaded from user module .\n For more info, see the README which you can find in /usr/share/aif/docs\n Available procedures: -`find $LIB_CORE/procedures -type f | sed \"s#$LIB_CORE##\"`\n -`find $LIB_USER/*/procedures -type f 2>/dev/null | sed \"s#$LIB_USER##\"`" +`find $LIB_CORE/procedures -type f | sed \"s#$LIB_CORE/procedures/##\"`\n +`find $LIB_USER/*/procedures -type f 2>/dev/null | sed \"s#$LIB_USER/\(.*\)/procedures/#\1/#\"`" [ -n "$procedure" ] && msg="$msg\nProcedure ($procedure) specific options:\n$var_ARGS_USAGE" echo -e "$msg" -- cgit v1.2.3-54-g00ecf From e64c05d26b468b3434d558de1bbb3513e2a62bf0 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sun, 15 Feb 2009 12:45:28 +0100 Subject: even better display of procedures --- src/aif.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/aif.sh b/src/aif.sh index beaf30c..b2662eb 100755 --- a/src/aif.sh +++ b/src/aif.sh @@ -25,7 +25,9 @@ If the procedurename starts with 'http://' it will be wget'ed. Otherwise it's a If the procedurename is prefixed with '/' it will be loaded from user module .\n For more info, see the README which you can find in /usr/share/aif/docs\n Available procedures: -`find $LIB_CORE/procedures -type f | sed \"s#$LIB_CORE/procedures/##\"`\n +==core== +`find $LIB_CORE/procedures -type f | sed \"s#$LIB_CORE/procedures/##\"` +==user== `find $LIB_USER/*/procedures -type f 2>/dev/null | sed \"s#$LIB_USER/\(.*\)/procedures/#\1/#\"`" [ -n "$procedure" ] && msg="$msg\nProcedure ($procedure) specific options:\n$var_ARGS_USAGE" -- cgit v1.2.3-54-g00ecf From dc264c36fdfc6dbd076517c43034dfc44eb01b97 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sun, 15 Feb 2009 13:01:10 +0100 Subject: add --noconfirm when installing packages --- TODO | 3 +-- src/core/libs/lib-software.sh | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index c747210..8b306af 100644 --- a/TODO +++ b/TODO @@ -31,13 +31,12 @@ ALPHA PHASE: * split up lib-ui as sep project, make a generic 'LIF' project, set $DISTRO somewhere and use that everywhere... * in usage, procedure specific opts points to parent profile when using inheritance * we may have an issue with ftp based installation where package installation works fine, however it tries to die instead of 'package installation complete' but it can't die because the --textbox fails in show_warning -* ( only in experimental?) grub sedding sometimes does, and sometimes doesn't work. default config remains (eg /dev/hda3), sometimes an incorrect UUID is generated +* ( only in experimental?) grub sedding sometimes does, and sometimes doesn't work. default config remains (eg /dev/hda3) * debug "categories" (ui, disk,flowcontrol,...) so you can grep (-v) on what you want + make sure enough+correct debugging is everywhere * the old installer asked a lot of questions before actually configuring the system, eg like 'do you need support for booting from nfs/softraid/lvm2/encrypted, custom dst file?' etc.\ do we still need this? why (not)?, and a select tag thingie would be nicer imho * refactor all pacman stuff (modularize/functionize etc) * in lvm VG editor you can press "cancel" (when 'new' is selected, maybe otherwise too) and create a new LV which will get a block entry, but no fs entry on the VG block! -* add noconfirm ofzo dinges when installing packages, zoda hij nie zaagt voor dep cycles * aif : na "mijn" partitielayout: bij grub ( nog voor text editor op menu.lst) zegt iets ( op foreground van ncurses) Can't remove.. ik denk zelfs 'Grub: Can't remove..' en daarna een gewone entry, geen uuid's gewoon /dev/sda3 ro * port from /arch/setup: grub install chroot thing (waiting for ticket), 2 patches from foutrelis @ http://bugs.archlinux.org/task/12949 diff --git a/src/core/libs/lib-software.sh b/src/core/libs/lib-software.sh index 9cbc34d..726d20f 100644 --- a/src/core/libs/lib-software.sh +++ b/src/core/libs/lib-software.sh @@ -26,7 +26,7 @@ run_mkinitcpio() installpkg() { notify "Package installation will begin now. You can watch the output in the progress window. Please be patient." target_special_fs on - run_background pacman-installpkg "$PACMAN_TARGET -S $TARGET_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) + run_background pacman-installpkg "$PACMAN_TARGET --noconfirm -S $TARGET_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 wait_for pacman-installpkg -- cgit v1.2.3-54-g00ecf From 6ab3e644ebf6e821e45051eef04ef74e814fdeea Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sun, 15 Feb 2009 13:50:05 +0100 Subject: notes --- HOWTO | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/HOWTO b/HOWTO index d4b94e4..4b446fe 100644 --- a/HOWTO +++ b/HOWTO @@ -38,13 +38,7 @@ pacman -U /home/arch/aif-experimental-git/aif*.pkg.tar.gz aif -p #you can skip networking. -For more info see README or aif -h. - - - - - - - - +Notes: +* For more info see README or aif -h. +* Since you configured the network before starting aif, you need to reconfigure it in aif if you want the 'auto-update rc.conf' functionality. \ No newline at end of file -- cgit v1.2.3-54-g00ecf From f4bd7c36b44da0c9a5985868aa8b0183cd4414c8 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sun, 15 Feb 2009 13:50:25 +0100 Subject: todo cleanup + alpha -> beta --- README | 2 +- TODO | 23 ++++++++--------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/README b/README index 6cd4f84..fbffaa4 100644 --- a/README +++ b/README @@ -1,6 +1,6 @@ AIF is the Arch Linux Installation Framework. ---- Alpha software. Use at own risk!! --- +--- Beta software. Use at own risk!! --- License: GPL3. See COPYING. diff --git a/TODO b/TODO index 8b306af..f46ae0f 100644 --- a/TODO +++ b/TODO @@ -1,14 +1,13 @@ See also the FIXME's and TODO's in the code. -ALPHA PHASE: +CURRENT ISSUES: * when invoking /arch/aif -p interactive on a "normal" pc, it always wants to abort * check everywhere that if users cancels something, we return 1, empty string behavior etc * core/interactive: fix workaround needed for installpkg exitcode -* core/interactive: keymap and timezone settings from installer dan't not go in $target/etc/rc.conf +* core/interactive: keymap from installer don't not go in $target/etc/rc.conf * dm_crypt unlock at boot is in qwerty. * after unlocking dm_crypt, FS check fails (reiserfs, must try other) -* core/quickinst: figure out what needs to be done and do it. * find a way to make _cli_ask_checklist still userfriendly for long lists.. maybe we should just propose/ask to use dia if the list is too long * lib things sometimes call die_error but we go back to the menu.. or something.. i think * automatically configure grub for dm_crypt and lvm @@ -26,9 +25,7 @@ ALPHA PHASE: -> too. although that's only good for separate functions, not the 'copypaste 90% and add 10% to the same worker scenario' -> phases are arrays.. adding elements at the back is easy. for in the middle, we could maybe write some functions to add a worker before/after another in a phase * mirrorlist config doesn't change after selecting mirror -* 'keep in mind trottled' geen separate screen -* cool, network setting coping into target/rc.conf seems to work wih aif. at least for dhcp.. it even asks nicely -* split up lib-ui as sep project, make a generic 'LIF' project, set $DISTRO somewhere and use that everywhere... +* 'keep in mind trottled' not on separate screen * in usage, procedure specific opts points to parent profile when using inheritance * we may have an issue with ftp based installation where package installation works fine, however it tries to die instead of 'package installation complete' but it can't die because the --textbox fails in show_warning * ( only in experimental?) grub sedding sometimes does, and sometimes doesn't work. default config remains (eg /dev/hda3) @@ -39,9 +36,6 @@ ALPHA PHASE: * in lvm VG editor you can press "cancel" (when 'new' is selected, maybe otherwise too) and create a new LV which will get a block entry, but no fs entry on the VG block! * aif : na "mijn" partitielayout: bij grub ( nog voor text editor op menu.lst) zegt iets ( op foreground van ncurses) Can't remove.. ik denk zelfs 'Grub: Can't remove..' en daarna een gewone entry, geen uuid's gewoon /dev/sda3 ro * port from /arch/setup: grub install chroot thing (waiting for ticket), 2 patches from foutrelis @ http://bugs.archlinux.org/task/12949 - - -BETA PHASE: * ext4 default options? -O dir_index,extent,uninit_bg ? * find a way to not have to preload libs and stuff, only load them when needed. -> faster start of install program * if dhcpd already runs for $reason, the installer will try again @ configure network and fail. @@ -52,15 +46,15 @@ BETA PHASE: skip that check or something. Alternatively, maybe just show which steps are done successfully in the main menu * support maybe ntp to set clock * auto-configure mkinitcpio.conf for dm_crypt and lvm +* core/quickinst: figure out what needs to be done and do it. + -PRODUCTION PHASE: be the primary installer. deprecate /arch/setup and /arch/quickinst -* bribe devs + +SOMEDAY/MAYBE/RANDOM THOUGHTS: * core/interactive: do pacman -Sy in the background during early phases, to lessen the wait period before selecting packages * write bash completion thing for aif modules/procedures * add dmraid/mdadm support -> patches welcome. i don't care about this. * check if it would be useful to support kickstart config files. we can look at quickstart for that http://dev.gentoo.org/~agaffney/quickstart.php - -SOMEDAY/MAYBE/RANDOM THOUGHTS: * the quickinst assumes the user did some stuff by himself and does some after-processing. Would it be useful to have a procedure that always tells the user what to do (manually) ? -> ASKDEV @@ -74,8 +68,7 @@ whereas for interactive procedures it could provide some other defaults. * all dialog windows are equally sized. noone cares, right? * we run mkinitcpio twice: one while installing kernel packages, once after configuring system (mkinitcpio.conf) configuring the system (mkinitcpio.conf). can we optimize this? -* core/interactive -> install packages -> dependency cycles with glibc. not -a problem? -> ASKDEV +* split up lib-ui as sep project, make a generic 'LIF' project, set $DISTRO somewhere and use that everywhere... WORRIES FOR MAYBE NO GOOD REASON -- cgit v1.2.3-54-g00ecf