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(-) (limited to 'src/core') 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(-) (limited to 'src/core') 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 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 (limited to 'src/core') 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(-) (limited to 'src/core') 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 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(-) (limited to 'src/core') 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 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(-) (limited to 'src/core') 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 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(-) (limited to 'src/core') 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(-) (limited to 'src/core') 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 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(-) (limited to 'src/core') 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(+) (limited to 'src/core') 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 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(-) (limited to 'src/core') 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(-) (limited to 'src/core') 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 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(-) (limited to 'src/core') 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 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(-) (limited to 'src/core') 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(-) (limited to 'src/core') 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 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(-) (limited to 'src/core') 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 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 (limited to 'src/core') 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(-) (limited to 'src/core') 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 (limited to 'src/core') 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(+) (limited to 'src/core') 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 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(-) (limited to 'src/core') 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(-) (limited to 'src/core') 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 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(-) (limited to 'src/core') 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 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(-) (limited to 'src/core') 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 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(-) (limited to 'src/core') 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 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(-) (limited to 'src/core') 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(-) (limited to 'src/core') 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 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(-) (limited to 'src/core') 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(-) (limited to 'src/core') 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 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(-) (limited to 'src/core') 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(-) (limited to 'src/core') 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(-) (limited to 'src/core') 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(-) (limited to 'src/core') 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(-) (limited to 'src/core') 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(-) (limited to 'src/core') 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(-) (limited to 'src/core') 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 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 (limited to 'src/core') 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 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(-) (limited to 'src/core') 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 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(-) (limited to 'src/core') 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