summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HOWTO48
-rw-r--r--README18
-rw-r--r--TODO57
-rw-r--r--examples/deployconfig-dieter87
-rwxr-xr-xsrc/aif.sh116
-rw-r--r--src/core/libs/lib-blockdevices-filesystems.sh13
-rw-r--r--src/core/libs/lib-misc.sh13
-rw-r--r--src/core/libs/lib-network.sh16
-rw-r--r--src/core/libs/lib-pacman.sh8
-rw-r--r--src/core/libs/lib-software.sh4
-rw-r--r--src/core/libs/lib-ui-interactive.sh38
-rw-r--r--src/core/libs/lib-ui.sh2
-rw-r--r--src/core/procedures/automatic135
-rw-r--r--src/core/procedures/base26
-rw-r--r--src/core/procedures/interactive20
-rw-r--r--src/core/procedures/partial-configure-network7
-rw-r--r--src/core/procedures/partial-disks32
-rw-r--r--src/core/procedures/quickinst106
-rw-r--r--src/runtime/whatsthis.txt1
-rw-r--r--unofficial/HOWTO9
-rw-r--r--unofficial/modules/TODO3
-rw-r--r--unofficial/modules/dieter/libs/lib-deployment.sh21
-rw-r--r--unofficial/modules/dieter/procedures/automatic152
-rw-r--r--unofficial/modules/dieter/whatsthis.txt2
-rw-r--r--unofficial/modules/yaourt/libs/lib-yaourt-sh23
-rw-r--r--unofficial/modules/yaourt/whatsthis.txt4
-rw-r--r--unofficial/whatsthis.txt5
27 files changed, 591 insertions, 375 deletions
diff --git a/HOWTO b/HOWTO
index 297ce3a..4b446fe 100644
--- a/HOWTO
+++ b/HOWTO
@@ -1,46 +1,44 @@
-### This howto explains how to install aif on an installcd that does not have the aif package installed yet ###
-### You can also use this if you want to use another version than what's available on the installcd) ###
-### TODO: someday, have an iso that comes with aif by default) ###
+### This howto explains how to install/upgrade aif on an arch system / arch installation cd ###
+* 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.
+
+* 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!!
+
+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) Decide on a package. See http://aur.archlinux.org/packages.php?K=aif for available packages
-- 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.
+3) Copy paste the code below.
# root shell:
/arch/setup. # fake ftp install so it lets you run the network configure script
+
+Alternatively, if you have a recent version of AIF installed and it comes with the partial-network procedure, you can execute that to set up your network.
+
# when network works, quit installer
pacman -Sy git fakeroot # You need about 192MB ram for this! 128MB is not enough.
# arch shell
-wget http://aur.archlinux.org/packages/aif-git/aif-git.tar.gz
-tar -xzf
-cd aif-git
+wget http://aur.archlinux.org/packages/aif-experimental-git/aif-experimental-git.tar.gz
+tar -xzf aif-experimental-git.tar.gz
+cd aif-experimental-git
makepkg
# root shell:
-pacman -U /home/arch/aif-git/aif*.pkg.tar.gz
-
+pacman -R aif # pacman can't replace with -U yet..
+pacman -U /home/arch/aif-experimental-git/aif*.pkg.tar.gz
4) Fire it up! (as root)
-/arch/aif -p <procedurename> #you can skip networking.
-
-For more info see README or /arch/aif -h.
-
-
-
-
-
-
-
-
+aif -p <procedurename> #you can skip networking.
+Notes:
+* For more info see README or aif -h.
+* Since you configured the network before starting aif, you need to reconfigure it in aif if you want the 'auto-update rc.conf' functionality. \ No newline at end of file
diff --git a/README b/README
index 92ebc10..fbffaa4 100644
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
AIF is the Arch Linux Installation Framework.
---- Alpha software. Use at own risk!! ---
+--- Beta software. Use at own risk!! ---
License: GPL3. See COPYING.
@@ -10,12 +10,13 @@ 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:
- interactive: A port of /arch/setup. Should work okay if you don't try too hard to break it ;-)
- quickinst: A port of /arch/quickinst. Work in progress. Don't use this yet.
+- automatic: An automated, deploy-tool-alike procedure. Work in progress. Don't use this yet.
AIF may or may not bring much additional value for you when compared with the previous
installer, it depends on what you want to do:
@@ -63,13 +64,13 @@ The goal of AIF is not (yet):
** File locations (on the install CD): **
-Basically aif.sh is put in /arch (together with the default installer scripts), while all other aif-related files belong in /home/arch/aif
-* aif.sh -> /arch/aif
-* docs -> /home/arch/aif/docs/
-* core module -> /home/arch/aif/core
-* user modules -> /home/arch/aif/user/<module name> (put your own modules here)
-* runtime files -> /home/arch/aif/runtime (package list etc go here)
+* aif.sh -> /sbin/aif
+* docs -> /usr/share/aif/docs
+* core module -> /usr/lib/aif/core
+* user modules -> /usr/lib/aif/user/<module name> (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.
@@ -79,6 +80,7 @@ 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
diff --git a/TODO b/TODO
index e884a03..f46ae0f 100644
--- a/TODO
+++ b/TODO
@@ -1,40 +1,60 @@
See also the FIXME's and TODO's in the code.
-ALPHA PHASE: get some people to test and suggest ideas, while fixing bugs and refactoring
-* setup bugtracker/roadmap thingie
+CURRENT ISSUES:
+* when invoking /arch/aif -p interactive on a "normal" pc, it always wants to abort
* check everywhere that if users cancels something, we return 1, empty string behavior etc
* core/interactive: fix workaround needed for installpkg exitcode
-* core/interactive: keymap and timezone settings from installer dan't not go in $target/etc/rc.conf
+* core/interactive: keymap from installer don't not go in $target/etc/rc.conf
* dm_crypt unlock at boot is in qwerty.
* after unlocking dm_crypt, FS check fails (reiserfs, must try other)
-* core/quickinst: figure out what needs to be done and do it.
* find a way to make _cli_ask_checklist still userfriendly for long lists.. maybe we should just propose/ask to use dia if the list is too long
* lib things sometimes call die_error but we go back to the menu.. or something.. i think
* automatically configure grub for dm_crypt and lvm
* move "/tmp/pacman.conf" to runtime directory and variablize everywhere
-* test ext4. i'm not sure if it works perfectly
-
-BETA PHASE: try to get aif on the (beta) installcd as an experimental, alternative installer.
+* hmm wasn't there a hwdetect/hwd or something in /arch/setup? this seems to have disappeared.
+* a nice way to be able to "inject" functions/logic without:
+ * needing to redefine phases with only 1 entry different (duplicate code is not nice, less maintainable etc)
+ * override worker functions which are 90% copy-pasted because the parent functionality is mostly okay, but not exactly what we want
+ useful for: profiles for the automatic procedures, or all other procedures
+ -> optional pre/post callbacks (for workers and phases)?
+ -> disadvantages?
+ * ended_ok must comprise callbacks too.. or if callback didn't exit cleanly, maybe we should update the exit code of the worker/phase
+ * we lose semantics: a function usually has a better suited name then 'pre_<something else>'.
+ -> maybe we should in the callback do an execute call for another worker, then we also can check it's exitcode in a good way
+ -> too. although that's only good for separate functions, not the 'copypaste 90% and add 10% to the same worker scenario'
+ -> phases are arrays.. adding elements at the back is easy. for in the middle, we could maybe write some functions to add a worker before/after another in a phase
+* mirrorlist config doesn't change after selecting mirror
+* 'keep in mind trottled' not on separate screen
+* in usage, procedure specific opts points to parent profile when using inheritance
+* we may have an issue with ftp based installation where package installation works fine, however it tries to die instead of 'package installation complete' but it can't die because the --textbox fails in show_warning
+* ( only in experimental?) grub sedding sometimes does, and sometimes doesn't work. default config remains (eg /dev/hda3)
+* 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!
+* 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
+* 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
-* involve broader community
-* fix everything
-* if dhcpd already runs for $reason, the installer will try again @ configure network and
-fail. i tried killall dhcpd, killall -9 dhcpd first but that didn't help:
-it can't kill the process or something...
+* if dhcpd already runs for $reason, the installer will try again @ configure network and fail.
+ i tried killall dhcpd, killall -9 dhcpd first but that didn't help: it can't kill the process or something...
+ I can also add something like for iface in `moo` (or only the one selected iface); do ifconfig $iface down;
+ ifconfig $iface up; done, and then dhcpd again
* core/interactive: do not check hard for the dependencies. a user could really know what he's doing or need to reboot after partitioning a disk and
skip that check or something. Alternatively, maybe just show which steps are done successfully in the main menu
* support maybe ntp to set clock
* auto-configure mkinitcpio.conf for dm_crypt and lvm
+* core/quickinst: figure out what needs to be done and do it.
+
-PRODUCTION PHASE: be the primary installer. deprecate /arch/setup and /arch/quickinst
-* fix everything even more
-* bribe devs
+
+SOMEDAY/MAYBE/RANDOM THOUGHTS:
* core/interactive: do pacman -Sy in the background during early phases, to lessen the wait period before selecting packages
* write bash completion thing for aif modules/procedures
* add dmraid/mdadm support -> patches welcome. i don't care about this.
-
-SOMEDAY/MAYBE/RANDOM THOUGHTS:
+* 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
* the quickinst assumes the user did some stuff by himself and does some
after-processing. Would it be useful to have a procedure that always tells
the user what to do (manually) ? -> ASKDEV
@@ -48,8 +68,7 @@ whereas for interactive procedures it could provide some other defaults.
* all dialog windows are equally sized. noone cares, right?
* we run mkinitcpio twice: one while installing kernel packages, once after configuring system (mkinitcpio.conf)
configuring the system (mkinitcpio.conf). can we optimize this?
-* core/interactive -> install packages -> dependency cycles with glibc. not
-a problem? -> ASKDEV
+* split up lib-ui as sep project, make a generic 'LIF' project, set $DISTRO somewhere and use that everywhere...
WORRIES FOR MAYBE NO GOOD REASON
diff --git a/examples/deployconfig-dieter b/examples/deployconfig-dieter
new file mode 100644
index 0000000..396de45
--- /dev/null
+++ b/examples/deployconfig-dieter
@@ -0,0 +1,87 @@
+#!/bin/bash
+# An example config for the deployment procedure
+
+# 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.
+
+
+var_RUNTIME_REPOSITORIES=(archlinuxfr "Server = http://repo.archlinux.fr/$var_ARCH")
+var_RUNTIME_PACKAGES="svn yaourt"
+
+DEPLOY_CLASS=desktop-a7n8x
+HOSTNAME=dieter-ws
+SVN_USERNAME=dieter
+SVN_PASSWORD=
+SVN_BASE=https://192.168.1.2/svn/repos
+
+phase_preparation=(accept_ssl_cert "${phase_preparation[@]}") # make accept_ssl_cert the very first thing. it needs to go before fetch_configs and it's not easy to put it somewhere in the middle, so...
+phase_system+=(configure_home)
+
+
+
+worker_fetch_configs ()
+{
+ $SVN export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/trunk/disks/.blockdata $RUNTIME_DIR/.blockdata || die_error "Could not svn export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/trunk/disks/.blockdata to $RUNTIME_DIR/.blockdata"
+ $SVN export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/trunk/disks/.partitions $RUNTIME_DIR/.partitions || die_error "Could not svn export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/trunk/disks/.partitions to $RUNTIME_DIR/.partitions"
+}
+
+
+worker_package_list ()
+{
+ $SVN export $SVN_BASE/ddm-configs/$DEPLOY_CLASS/trunk/package-list $var_PKG_FILE || die_error "Could not export package list!"
+ # cat -> there are newlines in it -> var=`echo $var` -> not anymore :)
+ TARGET_PACKAGES=`cat $var_PKG_FILE` && TARGET_PACKAGES=`echo $TARGET_PACKAGES` || die_error "Could not cat package list. THIS SHOULD NEVER HAPPEN."
+ # Strip away all packages not known by pacman. To get all packages, you'll need to do that when the system is installed TODO: don't do this. WAITINGFOR: --config support in yaourt + 'list of md5s of trusted pkgbuilds' support in yaourt
+ # NOTE: maybe chrooting could be an option too (to avoid --config support, but problem 2 stays)
+ TARGET_PACKAGES=`$PACMAN_TARGET -Si $TARGET_PACKAGES 2>/dev/null | awk '/Name/ {print $3}'`
+ TARGET_PACKAGES=`echo $TARGET_PACKAGES` #TODO: some stuff goes wrong here
+}
+
+
+worker_accept_ssl_cert ()
+{
+ mkdir -p /root/.subversion/auth/svn.ssl.server
+ cat > /root/.subversion/auth/svn.ssl.server/1123d3c8b27895efee3848cc779e526a << EOF
+K 10
+ascii_cert
+V 716
+MIICFTCCAX6gAwIBAgIBAjANBgkqhkiG9w0BAQQFADBVMRswGQYDVQQKExJBcGFjaGUgSFRUUCBTZXJ2ZXIxIjAgBgNVBAsTGUZvciB0ZXN0aW5nIHB1cnBvc2VzIG9ubHkxEjAQBgNVBAMTCWxvY2FsaG9zdDAeFw0wNjA3MjQxMjUwMzdaFw0wNzA3MjQxMjUwMzdaMEwxGzAZBgNVBAoTEkFwYWNoZSBIVFRQIFNlcnZlcjEZMBcGA1UECxMQVGVzdCBDZXJ0aWZpY2F0ZTESMBAGA1UEAxMJbG9jYWxob3N0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDF5PB1NnUve2jkisDTGsxKC9qzpnl+eX8UIR/1s+yX2ZIPNnIryeqTc6sS3cBHz2/AufIr0xbpXkTa4V5Es5bXA7W1D7+ZzuFHjjyi4E2eqYVkhkv1sRL5TpAovfjAA+96iaFHp3yKYiuw/nWwQTSW9M1VrDEym4ODxyJOtNdgQQIDAQABMA0GCSqGSIb3DQEBBAUAA4GBABY0bnBf9tL1WMC1sLxB1eDXvs5qNY96mny+EKGAbyQROPaXwsRQB0HrAkuWfHzQlgIdD6AfGsd+YMcEuqSPzIz6t6mA45jl++WvI6we9t3eYChtdPD2xjgHti0aSiDyVLTJbXPnkdgzKvIjYZcXBwbmbQSrg0STO5m+cSYt3chx
+K 8
+failures
+V 2
+14
+K 15
+svn:realmstring
+V 23
+https://192.168.1.2:443
+END
+EOF
+}
+
+
+worker_configure_home ()
+{
+ #TODO checkout from svn
+ true
+}
+
+
+
+# See http://wiki.archlinux.org/index.php/Yaourt
+
+# Not needed yet...
+#worker_install_packages () #pre_ / post_ callbacks would be useful here
+#{
+# PACMAN_BACKUP=$PACMAN
+# PACMAN_TARGET_BACKUP=$PACMAN_TARGET
+# PACMAN=${PACMAN//pacman/yaourt}
+# PACMAN_TARGET=${PACMAN_TARGET//pacman/yaourt}
+
+# target_prepare_pacman core
+# [ -z "$TARGET_PACKAGES" ] && die_error "No packages listed to be installed!"
+# installpkg
+
+# PACMAN=$PACMAN_BACKUP
+# PACMAN_TARGET=$PACMAN_TARGET_BACKUP
+#}
diff --git a/src/aif.sh b/src/aif.sh
index 534a899..b2662eb 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 ######
@@ -12,17 +16,21 @@ LOGFILE=$RUNTIME_DIR/aif.log
usage ()
{
#NOTE: you can't use dia mode here yet because lib-ui isn't sourced yet. But cli is ok for this anyway.
- msg="aif -p <procedurename> Select a procedure
+ msg="aif -p <procedurename> Select a procedure # If given, this *must* be the first option
-i <dia/cli> Override interface type (optional)
-d Explicitly enable debugging (optional)
-l Explicitly enable logging to file (optional)
-h Help: show usage (optional)\n
If the procedurename starts with 'http://' it will be wget'ed. Otherwise it's assumed to be a procedure in the VFS tree
If the procedurename is prefixed with '<modulename>/' it will be loaded from user module <modulename>.\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:
+==core==
+`find $LIB_CORE/procedures -type f | sed \"s#$LIB_CORE/procedures/##\"`
+==user==
+`find $LIB_USER/*/procedures -type f 2>/dev/null | sed \"s#$LIB_USER/\(.*\)/procedures/#\1/#\"`"
+ [ -n "$procedure" ] && msg="$msg\nProcedure ($procedure) specific options:\n$var_ARGS_USAGE"
+
echo -e "$msg"
}
@@ -38,6 +46,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
@@ -46,6 +55,7 @@ log ()
debug ()
{
+ mkdir -p $LOG_DIR || die_error "Cannot create log directory"
str="[DEBUG] $@"
if [ "$DEBUG" = "1" ]
then
@@ -63,8 +73,8 @@ load_module ()
{
[ -z "$1" ] && die_error "load_module needs a module argument"
log "Loading module $1 ..."
- path=/home/arch/aif/user/"$1"
- [ "$1" = core ] && path=/home/arch/aif/core
+ path=$LIB_USER/"$1"
+ [ "$1" = core ] && path=$LIB_CORE
for submodule in lib #procedure don't load procedures automatically!
do
@@ -97,8 +107,8 @@ load_procedure()
wget "$2" -q -O $procedure >/dev/null || die_error "Could not download procedure $2"
else
log "Loading procedure $1/procedures/$2 ..."
- procedure=/home/arch/aif/user/"$1"/procedures/"$2"
- [ "$1" = core ] && procedure=/home/arch/aif/core/procedures/"$2"
+ procedure=$LIB_USER/"$1"/procedures/"$2"
+ [ "$1" = core ] && procedure=$LIB_CORE/procedures/"$2"
fi
[ -f "$procedure" ] && source "$procedure" || die_error "Something went wrong while sourcing procedure $procedure"
}
@@ -111,8 +121,8 @@ load_lib ()
[ -z "$1" ] && die_error "load_library needs a module als \$1 and library as \$2"
[ -z "$2" ] && die_error "load_library needs a library as \$2"
log "Loading library $1/libs/$2 ..."
- lib=/home/arch/aif/user/"$1"/libs/"$2"
- [ "$1" = core ] && lib=/home/arch/aif/core/libs/"$2"
+ lib=$LIB_USER/"$1"/libs/"$2"
+ [ "$1" = core ] && lib=$LIB_CORE/libs/"$2"
source $lib || die_error "Something went wrong while sourcing library $lib"
}
@@ -272,14 +282,57 @@ module=
procedure=
-# TODO: you cannot override $var_OPTS_STRING, nor process_args. because profile not sourced yet
-# we will hit '?)' and exit 5
-# solutions? don't make $var_OPTS_STRING overridable, source correct profile as early as possible so process_args gets known. remove the '?)' catchall (eg put it in the default process_args) so we don't hit it accidentially
+
# in that case -p needs to be the first option, but that's doable imho
# an alternative would be to provide an argumentstring for the profile. eg aif -p profile -a "-a a -b b -c c"
-var_OPTS_STRING=":i:dlp:" # you can override this variable in your procedure.
-while getopts $var_OPTS_STRING OPTION
+# 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 ()
+{
+ # known options: we don't know any yet
+ # return 0
+
+ # if we are still here, we didn't return 0 for a known option. hence this is an unknown option
+ usage
+ exit 5
+}
+
+
+# Check if the first args are -p <procedurename>. If so, we can load the procedure, and hence $var_OPTS_STRING and process_args can be overridden
+if [ "$1" = '-p' ]
+then
+ [ -z "$2" ] && usage && exit 1
+ # note that we allow procedures like http://foo/bar. module -> http:, procedure -> http://foo/bar.
+ if [[ $2 =~ ^http:// ]]
+ then
+ module=http
+ procedure="$2"
+ elif grep -q '\/' <<< "$2"
+ then
+ #user specified module/procedure
+ module=`dirname "$2"`
+ procedure=`basename "$2"`
+ else
+ module=core
+ procedure="$2"
+ fi
+
+ shift 2
+fi
+
+# If no procedure given, bail out
+[ -z "$procedure" ] && usage && exit 5
+
+load_module core
+[ "$module" != core -a "$module" != http ] && load_module "$module"
+
+load_procedure "$module" "$procedure"
+
+while getopts ":i:dlp:$var_OPTS_STRING" OPTION
do
case $OPTION in
i)
@@ -295,41 +348,20 @@ do
LOG_TO_FILE=1
;;
p)
- [ -z "$OPTARG" ] && usage && exit 1
- # note that we allow procedures like http://foo/bar. module -> http:, procedure -> http://foo/bar.
- if [[ $OPTARG =~ ^http:// ]]
- then
- module=http
- procedure="$OPTARG"
- elif grep -q '\/' <<< "$OPTARG"
- then
- #user specified module/procedure
- module=`dirname "$OPTARG"`
- procedure=`basename "$OPTARG"`
- else
- module=core
- procedure="$OPTARG"
- fi
+ die_error "If you pass -p <procedurename>, it must be the FIRST option"
;;
h)
usage
exit
;;
?)
- usage
- exit 5
+ # If we hit something elso, call process_args
+ process_args -$OPTION $OPTARG # you can override this function in your profile to parse additional arguments and/or override the behavior above
;;
esac
- process_args $OPTION $OPTARG # you can override this function in your profile to parse additional arguments and/or override the behavior above
done
-[ -z "$procedure" ] && usage && exit 5
-
-load_module core
-[ "$module" != core -a "$module" != http ] && load_module "$module"
-
-load_procedure "$module" "$procedure"
# Set pacman vars. allow procedures to have set $var_TARGET_DIR (TODO: look up how delayed variable substitution works. then we can put this at the top again)
# flags like --noconfirm should not be specified here. it's up to the procedure to decide the interactivity
diff --git a/src/core/libs/lib-blockdevices-filesystems.sh b/src/core/libs/lib-blockdevices-filesystems.sh
index 5fa0815..3b43541 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:
@@ -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';
@@ -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
}
diff --git a/src/core/libs/lib-misc.sh b/src/core/libs/lib-misc.sh
index 29e4c2e..01c291f 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
@@ -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
@@ -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
-} \ No newline at end of file
+}
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
diff --git a/src/core/libs/lib-pacman.sh b/src/core/libs/lib-pacman.sh
index f318aa8..4497074 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.
@@ -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
@@ -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
}
@@ -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'
}
diff --git a/src/core/libs/lib-software.sh b/src/core/libs/lib-software.sh
index 6b4a1a8..726d20f 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
@@ -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
diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh
index 70ef739..8fdc5dc 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!!
@@ -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."
@@ -867,29 +864,32 @@ 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
- var_SYNC_URL=$ANSWER_STRING
+ ask_string "Enter the full URL to core repo." "ftp://ftp.archlinux.org/core/os/$var_ARCH" || return 1
+ 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
}
-# 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
}
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/automatic b/src/core/procedures/automatic
new file mode 100644
index 0000000..3c93167
--- /dev/null
+++ b/src/core/procedures/automatic
@@ -0,0 +1,135 @@
+#!/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 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_procedure core base
+
+var_OPTS_STRING="c:"
+var_ARGS_USAGE="-c <config>: 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..
+phase_preparation+=(fetch_configs)
+process_args ()
+{
+ if [ "$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
+}
+
+
+worker_intro ()
+{
+ notify "Automatic procedure running..."
+}
+
+
+worker_configure ()
+{
+ var_UI_TYPE=${arg_ui_type:-cli}
+}
+
+
+# not used
+worker_msg_manual ()
+{
+ 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_fetch_configs ()
+{
+ true
+}
+
+
+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
+}
+
+
+# Check if we have all needed settings loaded from the profile
+worker_runtime_settings ()
+{
+ 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
+ then
+ # Maybe more stuff later
+ true
+ fi
+ [ -z "$HOSTNAME" ] && ask_string "Hostname of target system?" && HOSTNAME=$ANSWER_STRING
+
+ return 0
+}
+
+
+worker_prepare_disks ()
+{
+ process_disks || die_error "Could not process_disks"
+ 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
+}
+
+
+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_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/src/core/procedures/base b/src/core/procedures/base
index fa88210..c22a01c 100644
--- a/src/core/procedures/base
+++ b/src/core/procedures/base
@@ -3,10 +3,13 @@
#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
+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. 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) ######
phase_preparation=(\
@@ -15,6 +18,7 @@ phase_preparation=(\
sysprep \
select_source \
runtime_network \
+ runtime_repositories \
runtime_packages)
phase_basics=(\
@@ -32,7 +36,6 @@ phase_system=(\
locales \
install_bootloader)
-
phase_finish=(msg_report)
@@ -64,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
}
@@ -76,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
@@ -152,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 dc1bf2b..051d187 100644
--- a/src/core/procedures/interactive
+++ b/src/core/procedures/interactive
@@ -1,11 +1,9 @@
-#!/bin/sh
+#!/bin/bash
depend_procedure core base # esp for auto_{network,locale,fstab}, intro and set_clock workers
# 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
@@ -21,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)'
@@ -83,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")
@@ -97,7 +96,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"
@@ -114,15 +113,16 @@ 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
# /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
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-disks b/src/core/procedures/partial-disks
new file mode 100644
index 0000000..8f17e33
--- /dev/null
+++ b/src/core/procedures/partial-disks
@@ -0,0 +1,32 @@
+#!/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 ()
+{
+ [ -z "$OPERATION" ] && usage && exit 5
+
+ 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/quickinst b/src/core/procedures/quickinst
index 9e92c03..b95bfa4 100644
--- a/src/core/procedures/quickinst
+++ b/src/core/procedures/quickinst
@@ -1,7 +1,107 @@
-#!/bin/sh
+#!/bin/bash
+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 <install_mode> <destdir> <package_directory|server_url>"
+ 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 <destdir>."
+ 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 <destdir>."
+ echo
+ if [ -e /usr/bin/wget ]; then
+ echo "<install_mode> must be either 'ftp' or 'cd'"
+ else
+ echo "<install_mode> must be 'cd'"
+ fi
+ echo
+ echo "Examples:"
+ if [ -e /usr/bin/wget ]; then
+ echo " quickinst ftp /mnt ftp://ftp.archlinux.org/core/os/$var_ARCH"
+ 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 +137,4 @@ echo
echo "Then exit your chroot shell, edit $DESTDIR/etc/fstab and"
echo "$DESTDIR/etc/rc.conf, and reboot!"
echo
-}
+exit 0
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
diff --git a/unofficial/HOWTO b/unofficial/HOWTO
deleted file mode 100644
index 4dc6384..0000000
--- a/unofficial/HOWTO
+++ /dev/null
@@ -1,9 +0,0 @@
-# to install these unofficial modules onto the arch install cd:
-
-
-
-# install aif from package
-
-git clone git://github.com/Dieterbe/aif.git /home/arch/tmp
-
-cp -ax /home/arch/tmp/unofficial/modules/* /home/arch/aif/user/
diff --git a/unofficial/modules/TODO b/unofficial/modules/TODO
deleted file mode 100644
index 3f19b66..0000000
--- a/unofficial/modules/TODO
+++ /dev/null
@@ -1,3 +0,0 @@
-See also the FIXME's and TODO's in the code.
-* dieter/automatic: wait for yaourt --config fix ( http://forums.archlinux.fr/post23171.html#23171 )
-* dieter/automatic: put config files from svn in place first, so that if a package has an update, it can do it's thing.
diff --git a/unofficial/modules/dieter/libs/lib-deployment.sh b/unofficial/modules/dieter/libs/lib-deployment.sh
deleted file mode 100644
index da63f3f..0000000
--- a/unofficial/modules/dieter/libs/lib-deployment.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-
-_accept_ssl_cert ()
-{
- mkdir -p /root/.subversion/auth/svn.ssl.server
- cat > /root/.subversion/auth/svn.ssl.server/1123d3c8b27895efee3848cc779e526a << EOF
-K 10
-ascii_cert
-V 716
-MIICFTCCAX6gAwIBAgIBAjANBgkqhkiG9w0BAQQFADBVMRswGQYDVQQKExJBcGFjaGUgSFRUUCBTZXJ2ZXIxIjAgBgNVBAsTGUZvciB0ZXN0aW5nIHB1cnBvc2VzIG9ubHkxEjAQBgNVBAMTCWxvY2FsaG9zdDAeFw0wNjA3MjQxMjUwMzdaFw0wNzA3MjQxMjUwMzdaMEwxGzAZBgNVBAoTEkFwYWNoZSBIVFRQIFNlcnZlcjEZMBcGA1UECxMQVGVzdCBDZXJ0aWZpY2F0ZTESMBAGA1UEAxMJbG9jYWxob3N0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDF5PB1NnUve2jkisDTGsxKC9qzpnl+eX8UIR/1s+yX2ZIPNnIryeqTc6sS3cBHz2/AufIr0xbpXkTa4V5Es5bXA7W1D7+ZzuFHjjyi4E2eqYVkhkv1sRL5TpAovfjAA+96iaFHp3yKYiuw/nWwQTSW9M1VrDEym4ODxyJOtNdgQQIDAQABMA0GCSqGSIb3DQEBBAUAA4GBABY0bnBf9tL1WMC1sLxB1eDXvs5qNY96mny+EKGAbyQROPaXwsRQB0HrAkuWfHzQlgIdD6AfGsd+YMcEuqSPzIz6t6mA45jl++WvI6we9t3eYChtdPD2xjgHti0aSiDyVLTJbXPnkdgzKvIjYZcXBwbmbQSrg0STO5m+cSYt3chx
-K 8
-failures
-V 2
-14
-K 15
-svn:realmstring
-V 23
-https://192.168.1.2:443
-END
-EOF
-}
diff --git a/unofficial/modules/dieter/procedures/automatic b/unofficial/modules/dieter/procedures/automatic
deleted file mode 100644
index 3907fa2..0000000
--- a/unofficial/modules/dieter/procedures/automatic
+++ /dev/null
@@ -1,152 +0,0 @@
-#!/bin/bash
-depend_module yaourt
-depend_procedure core base
-
-var_RUNTIME_PACKAGES="svn"
-
-phase_preparation=(\
- configure \
- intro \
- sysprep \
- msg_manual \
- runtime_network \
- runtime_svn \
- msg_automatic \
- select_source \
- runtime_packages \
- runtime_yaourt)
-
-phase_finish=(configure_home msg_report)
-
-
-worker_intro ()
-{
- notify "Dieter::automatic procedure running..."
-}
-
-
-worker_configure ()
-{
- var_UI_TYPE=${arg_ui_type:-cli}
-}
-
-
-worker_msg_manual ()
-{
- # All things that need to be done manually first
- notify "A few manual things need to happen first..."
-}
-
-
-worker_msg_automatic ()
-{
- notify "**** From now on. everything will be automatic. Enjoy the show!" # not true: you need pass for dm_crypt
-}
-
-
-worker_runtime_network ()
-{
- if ask_yesno "Do you want to (re)-configure your networking?"
- then
- #TODO: which function do i need here?
- donetwork #configure network by using library
- else
- notify "Ok. skipping network config"
- fi
-}
-
-
-worker_runtime_svn ()
-{
- SVN_USERNAME=dieter
- ask_password svn #TODO: if user entered incorrect password, the install process will just fail..
- SVN="svn --username $SVN_USERNAME --password $SVN_PASSWORD"
- SVN_BASE=https://192.168.1.2/svn/repos
- TARGET_HOST=desktop-a7n8x #TODO: prompt user for this, or let him pass it as cmdline argument (and check with svn info)
- _accept_ssl_cert
-}
-
-
-worker_prepare_disks ()
-{
- modprobe dm-crypt || die_error "Cannot modprobe dm-crypt"
- modprobe -q aes-x86-64 || modprobe aes-i586 || die_error "Cannot modprobe aes-x86-64 or aes-i586"
-
- # Cleanup whatever state the disk is in (that includes previous, failed runs of this script)
- umount /dev/mapper/cryptpool-* 2>/dev/null
- vgremove -f cryptpool 2>/dev/null
- pvremove /dev/mapper/sda2_crypt 2>/dev/null
- cryptsetup luksClose sda2_crypt 2>/dev/null
- dd if=/dev/urandom of=/dev/sda bs=512 count=1
-
- #TODO: integrate this stuff into the functions in the libs (process_partitions and filesystems, rollback and bailout if needed) + do error checking and handling
- #NOTE: i don't think i should quote to prevent globbing, but it does seem to help i think (hard to check as resource is busy and you can't reload kernel partition tables)
- sfdisk /dev/sda 2>&1 | grep -v 'not have an msdos signature' << EOF
-,10,L,'*'
-,,L
-EOF
- [ $? -gt 0 ] && die_error "Could not sfdisk /dev/sda. Return code is $?"
- #TODO: when sfdisk is done, i still have an invalid partition table?
- cryptsetup --batch-mode -c aes-xts-plain -y -s 512 luksFormat /dev/sda2 || die_error "Cannot cryptsetup luksFormat /dev/sda2"
- cryptsetup luksOpen /dev/sda2 sda2_crypt || die_error "Cannot cryptsetup luksOpen /dev/sda2"
- pvcreate /dev/mapper/sda2_crypt || die_error "Cannot pvcreate the PV on the encrypted blockdevice"
- vgcreate cryptpool /dev/mapper/sda2_crypt || die_error "Cannot create the VG an the PV on the encrypted blockdevice"
- lvcreate -L 2G -n swap cryptpool && \
- lvcreate -L 500M -n tmp cryptpool && \
- lvcreate -L 10G -n home cryptpool && \
- lvcreate -L 10G -n root cryptpool && \
- lvcreate -L 3G -n var cryptpool || die_error "Could not create at least one of the LV's"
- for i in home root tmp var
- do
- mkdir -p $var_TARGET_DIR/$i
- mke2fs -j /dev/cryptpool/$i && mount /dev/cryptpool/$i $var_TARGET_DIR/$i || die_error "Could not format or mount $var_TARGET_DIR/$i"
- done
-
- # TODO: swapon the thing and don't forget to swapoff it in the cleanup part above
- # TODO: fstab? auto-add to fstab with libs? auto mkdir's on target_dir?
- true
-}
-
-worker_package_list ()
-{
- $SVN export $SVN_BASE/ddm-configs/$TARGET_HOST/trunk/package-list $var_PKG_FILE || die_error "Could not export package list!"
- # cat -> there are newlines in it -> var=`echo $var` -> not anymore :)
- TARGET_PACKAGES=`cat $var_PKG_FILE` && TARGET_PACKAGES=`echo $TARGET_PACKAGES` || die_error "Could not cat package list. THIS SHOULD NEVER HAPPEN."
- true
-}
-
-
-worker_install_packages ()
-{
- target_prepare_pacman core extra community #TODO: it would be better if this was a separate worker, i think
- [ -z "$TARGET_PACKAGES" ] && die_error "No packages listed to be installed!"
- installpkg
-}
-
-
-worker_configure_home ()
-{
- #checkout from svn
- true
-}
-
-
-worker_set_clock ()
-{
- #timezone="Europe/Brussels"
- #Not doing anything. hwclock is set already and configs are coming from svn anyway..
- true
-}
-
-
-worker_install_bootloader ()
-{
- install-grub /dev/sda
-}
-
-
-worker_runtime_yaourt ()
-{
- _yaourt_replace_pacman
-}
-
diff --git a/unofficial/modules/dieter/whatsthis.txt b/unofficial/modules/dieter/whatsthis.txt
deleted file mode 100644
index 5c55ca8..0000000
--- a/unofficial/modules/dieter/whatsthis.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-module with stuff for my (Dieter) own environment. Customized for my needs
-(my data and settings are in svn/ddm repositories) \ No newline at end of file
diff --git a/unofficial/modules/yaourt/libs/lib-yaourt-sh b/unofficial/modules/yaourt/libs/lib-yaourt-sh
deleted file mode 100644
index fd9c4d0..0000000
--- a/unofficial/modules/yaourt/libs/lib-yaourt-sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-
-# See http://wiki.archlinux.org/index.php/Yaourt
-
-_runtime_yaourt ()
-{
- if ! list_pacman_repos runtime | grep -q archlinuxfr
- then
- add_pacman_repo runtime archlinuxfr 'Server = http://repo.archlinux.fr/i686'
- 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`
-}
-
-
-_yaourt_replace_pacman ()
-{
- _runtime_yaourt
- PACMAN=$YAOURT
- PACMAN_TARGET=$YAOURT_TARGET
-}
-
diff --git a/unofficial/modules/yaourt/whatsthis.txt b/unofficial/modules/yaourt/whatsthis.txt
deleted file mode 100644
index 66a393f..0000000
--- a/unofficial/modules/yaourt/whatsthis.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-I plan to someday write a module that will make yaourt available during
-installation, so you can imediately install packages from AUR on your system
-during installation. This is something that does not belong in core, it's
-for power users only ;-)
diff --git a/unofficial/whatsthis.txt b/unofficial/whatsthis.txt
deleted file mode 100644
index a3bfa0d..0000000
--- a/unofficial/whatsthis.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-This directory contains unofficial additions (modules) to/for AIF that I (Dieter)
-am writing.
-
-They are _not_ intended to be part of the "official" aif. it's just in the same repo for
-my own convenience. \ No newline at end of file