summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HOWTO2
-rw-r--r--README77
-rw-r--r--TODO37
-rw-r--r--dieter/procedures/automatic (renamed from src/profiles/profile-automatic-dieter)0
-rw-r--r--dieter/whatsthis.txt4
-rw-r--r--src/core/libs/lib-blockdevices-filesystems.sh (renamed from src/lib/lib-blockdevices-filesystems.sh)0
-rw-r--r--src/core/libs/lib-misc.sh (renamed from src/lib/lib-misc.sh)0
-rw-r--r--src/core/libs/lib-network.sh (renamed from src/lib/lib-network.sh)0
-rw-r--r--src/core/libs/lib-pacman.sh (renamed from src/lib/lib-pacman.sh)0
-rw-r--r--src/core/libs/lib-software.sh (renamed from src/lib/lib-software.sh)0
-rw-r--r--src/core/libs/lib-ui.sh (renamed from src/lib/lib-ui.sh)0
-rw-r--r--src/core/procedures/base (renamed from src/profiles/profile-base)6
-rw-r--r--src/core/procedures/interactive-DRAFT (renamed from src/profiles/profile-interactive-DRAFT.sh)0
-rw-r--r--src/core/procedures/quickinst-DRAFT (renamed from src/profiles/profile-quickinst-DRAFT.sh)0
-rwxr-xr-xsrc/fifa.sh120
-rw-r--r--src/lib/whatsthis.txt15
-rwxr-xr-xsrc/patch-install-cd.sh7
-rw-r--r--src/runtime/whatsthis.txt1
-rw-r--r--src/user/whatsthis.txt1
19 files changed, 172 insertions, 98 deletions
diff --git a/HOWTO b/HOWTO
index 4717a37..e797ba9 100644
--- a/HOWTO
+++ b/HOWTO
@@ -9,4 +9,4 @@ pacman -Sy git
git clone git://github.com/Dieterbe/fifa.git /home/arch/tmp
/home/arch/tmp/src/patch-install-cd.sh
-/arch/fifa.sh <profilename> #you can skip networking
+/arch/fifa.sh <procedurename> #you can skip networking. See readme on howto specify procedures
diff --git a/README b/README
index 3d4bed5..eb14657 100644
--- a/README
+++ b/README
@@ -15,30 +15,27 @@ The goal of this project is
3) Apply DRY patterns to the installation procedure, making it more easy to maintain the code.
-You can choose to use unattended (automatic) installation (you can write different profiles for different scenario's,
-and/or use autodetection) or prompt the user for whatever you want to know (you could mimic the official installer like
+You can choose to use unattended (automatic) installation (you can write different
+modules/procedures for different scenario's, and/or use autodetection) or prompt the user for whatever you want to know (you could mimic the official installer like
that).
-You can also take parts from different profiles (installation procedures) and combine them
-together to come up with the installation procedure of your liking.
+You can also take parts from different installation procedures and combine them
+together to come up with the procedure of your liking.
** File locations (on the install CD): **
Basically fifa.sh is put in /arch (together with the default installer scripts), while all other fifa-related files belong in /home/arch/fifa
-* fifa.sh -> /arch/fifa.sh
-* libraries -> /home/arch/fifa/lib
-* docs -> /home/arch/fifa/docs
-* profiles -> /home/arch/fifa/profiles
-* pkg list -> /home/arch/fifa/packages-list (can be overridden)
+* fifa.sh -> /arch/fifa.sh
+* docs -> /home/arch/fifa/docs/
+* core module -> /home/arch/fifa/core
+* user modules -> /home/arch/fifa/user/<module name> (put your own modules here)
+* runtime files -> /home/arch/fifa/runtime (package list etc go here)
+A module can have 2 directories: libs, and procedures.
** Workflow **
-Profiles are stored like /home/arch/fifa/profiles/profile-*
-You can put your custom profiles there too. Give them a recognizable name
-that doesn't exist yet.
-
There is a very basic but powerful workflow defined by variables, phases and workers.
-Depending on the profile you choose (or write yourself), these will differ
+Depending on the procedure you choose (or write yourself), these will differ
In the code, they are very recognizable and are named like this:
- variable -> var_<foo>
- phase -> phase_<bar> (a function that calls workers and maybe does some stuff by itself.)
@@ -46,12 +43,52 @@ In the code, they are very recognizable and are named like this:
- worker -> worker_<baz> ( a worker function, called by a phase. implements some specific logic.
eg runtime_packages, prepare_disks, package_list etc)
-If you specify a profile name other then base, the base profile will be sourced first, then the specific
-profile. This way you only need to override specific things.
+If you specify a procedure name other then base, the base procedure will be sourced first, then the specific
+procedure. This way you only need to override specific things.
Notes:
- - you _can_ override _all_ variables and functions in profiles, but you should be able to achieve your goals by
- overriding things of these 3 classes
- - you _must_ specify a profile, to avoid errors. take 'base' if unsure
- - don't edit the base profile (or any other that comes by default), rather make your own. It's easy!
- The phases are started by the start_process function. You can also override this function to take flow control in your own hands (eg iterative, menu-based installer)
+ - you _can_ override _all_ variables and functions in your modules, but you should be able to achieve your goals by
+ overriding only the 3 basic things and the start_process function, and only in procedures.
+ - you _must_ specify a procedure, to avoid errors. take 'base' if unsure
+ - don't edit the base procedure (or any other core item), rather make your own. It's easy!
+
+Modules are the building blocks in fifa. They can contain libraries (for
+user interfaces, backend logic, etc) and procedures (how an installation
+process should go).
+The core module comes by default and contains everything 99% of the users
+will need. You can easily make your own modules with in it your own
+procedures (and your own libraries, if you need that). If you build your
+own libraries, it's generally a good idea to keep
+their names in line with what core has (lib-ui.sh, lib-network.sh etc).
+Do not put stuff in the core module yourself! If it's good stuff, it might
+be merged into core someday... Also, don't name your custom module 'core' (it will be
+ignored anyway). Don't call it http either, because you can specify
+'http://some/path/to/a/procedure', fifa will download that procedure and
+execute it (and the module will be 'http')
+
+Note that if you load a module and a library has the same function names as
+the core module, it will override the functions from core.
+This means you can 'inject' new backend code into core procedures, but you
+can also write your own procedures that use your own, or the core libraries.
+
+
+If you need a library from another user contributed module, execute
+'depend_module <modulename>' for each module.
+(very basic dependencies, no version checking etc)
+
+You can specify a core procedure on the command line by specifying
+'<procedure_name>', to specify a user contriubuted procedure, specify
+'<module_name>/<procedure_name>'
+
+
+Much of the code in the core module is taken (and modified) from the 'real' arch linux install
+scripts code. (/arch/setup and /arch/quickinst). the modifications are mostly done
+to make the code more (re)useable and to separate backend code, user
+interface and flow control. (intro libraries and procedures). (which was tightly coupled in the original scripts)
+
+I couldn't find what license the code is under, but I assume this
+is okay.. if not let me know.
+The original code is at
+http://projects.archlinux.org/?p=installer.git;a=summary
+
diff --git a/TODO b/TODO
index 572a289..0db8651 100644
--- a/TODO
+++ b/TODO
@@ -1,18 +1,4 @@
-* each profile can have libs for
-- ui (most stuff goes into lib-ui however, only very specific custom things
- not)
-- backend (eg dieters automatic stuff is custom for dieter. but can have
-different installation procedures using the same custom backend code)
-- implementation (what a profile is right now) -> rename profile to
-procedure
-* the above requires now file layout: all 'core' things must be separate
-from user things
-- core: all stuff that should be on install cd for all users
-- user: specific libs (whether ui, backend,...) and procedures.
-* it should also be possible that one user creates multiple procedures, using
-the same - custom - libraries, (a very basic dependency check? eg need
-lib_dieter, which checks user/lib/lib-dieter)
-* base profile wordt implementatie van alles wat auto gaat uit setup script,
+* base procedure wordt implementatie van alles wat auto gaat uit setup script,
other steps warning 'not implemented'
* in automatic-dieter: health check using svn info /<hostname>
* in elke phase een lege worker die te overriden valt zoda we geen phases
@@ -20,17 +6,18 @@ other steps warning 'not implemented'
* process and fix libraries
* fix to use $var_UI_TYPE where needed
* write the ui functions for asking questions etc for both cli and dialog and port all code to use it.
-* instead of using the 'base' profile and letting other profiles override,
- we should have even more flexibilty to take parts from different profiles.
- eg dieter profile maybe wants to use something interactive. or base
- profile wants to do something interactive. interactive functions maybe
- dont belong in a profile?
+* instead of using the 'base' procedure and letting other procedures override,
+ we should have even more flexibilty to take parts from different procedures.
+ eg dieter procedure maybe wants to use something interactive. or base
+ procedure wants to do something interactive. interactive functions maybe
+ dont belong in a procedure?
-* base profile idea: it should just tell you what to do? -> less
- implementation work in base profile, more in other profiles...
-* fix crossconcerns: some procedures could be about _what_ (desktop,server),
- others are about _how_ (autodetection, asking user,...) (profile vs...
- 'mode' ?)
+* base procedure idea: it should just tell you what to do? -> less
+ implementation work in base procedure, more in other procedures...
+* fix crossconcerns: procedures are about _how_ (autodetection, asking user,...)
+ what about _what_ (desktop,server) --> 'mode'? 'profile'? procedures
+ define for themselves how much they care about the 'profile'. for some
+ it's a key thing, for others it could be just another list of defaults
* port classic installer so it works with fifa
* make some sensible default profiles (eg desktop, server, ...)
* make it work
diff --git a/src/profiles/profile-automatic-dieter b/dieter/procedures/automatic
index 397231d..397231d 100644
--- a/src/profiles/profile-automatic-dieter
+++ b/dieter/procedures/automatic
diff --git a/dieter/whatsthis.txt b/dieter/whatsthis.txt
new file mode 100644
index 0000000..5d32fef
--- /dev/null
+++ b/dieter/whatsthis.txt
@@ -0,0 +1,4 @@
+this directory contains the stuff I (Dieter) use with fifa for myself, and is not
+intended to be part of the "official" fifa. it's just in the same repo for
+my own convenience.
+
diff --git a/src/lib/lib-blockdevices-filesystems.sh b/src/core/libs/lib-blockdevices-filesystems.sh
index a3bc099..a3bc099 100644
--- a/src/lib/lib-blockdevices-filesystems.sh
+++ b/src/core/libs/lib-blockdevices-filesystems.sh
diff --git a/src/lib/lib-misc.sh b/src/core/libs/lib-misc.sh
index bc9b150..bc9b150 100644
--- a/src/lib/lib-misc.sh
+++ b/src/core/libs/lib-misc.sh
diff --git a/src/lib/lib-network.sh b/src/core/libs/lib-network.sh
index 93ba9cb..93ba9cb 100644
--- a/src/lib/lib-network.sh
+++ b/src/core/libs/lib-network.sh
diff --git a/src/lib/lib-pacman.sh b/src/core/libs/lib-pacman.sh
index 4f64794..4f64794 100644
--- a/src/lib/lib-pacman.sh
+++ b/src/core/libs/lib-pacman.sh
diff --git a/src/lib/lib-software.sh b/src/core/libs/lib-software.sh
index 95bc07a..95bc07a 100644
--- a/src/lib/lib-software.sh
+++ b/src/core/libs/lib-software.sh
diff --git a/src/lib/lib-ui.sh b/src/core/libs/lib-ui.sh
index 7fc611f..7fc611f 100644
--- a/src/lib/lib-ui.sh
+++ b/src/core/libs/lib-ui.sh
diff --git a/src/profiles/profile-base b/src/core/procedures/base
index 748bba0..215af0a 100644
--- a/src/profiles/profile-base
+++ b/src/core/procedures/base
@@ -3,10 +3,10 @@
var_DEFAULTFS="/boot:32:ext2:+ swap:256:swap /:7500:ext3 /home:*:ext3"
var_TARGET_DIR="/mnt"
var_RUNTIME_PACKAGES=
-var_PKG_FILE=/home/arch/fifa/package-list
+var_PKG_FILE=/home/arch/fifa/runtime/package-list
var_UI_TYPE="cli" # set to cli or dia for dialog
-###### Phases ( can be overridden by more specific profiles) ######
+###### Phases ( can be overridden by more specific procedures) ######
phase_preparation ()
{
@@ -43,7 +43,7 @@ phase_finish ()
-###### Workers ( can be overridden by more specific profiles) ######
+###### Workers ( can be overridden by more specific procedures) ######
worker_select_source ()
{
var_PKG_SOURCE_TYPE='cd'
diff --git a/src/profiles/profile-interactive-DRAFT.sh b/src/core/procedures/interactive-DRAFT
index 145b32d..145b32d 100644
--- a/src/profiles/profile-interactive-DRAFT.sh
+++ b/src/core/procedures/interactive-DRAFT
diff --git a/src/profiles/profile-quickinst-DRAFT.sh b/src/core/procedures/quickinst-DRAFT
index 9e92c03..9e92c03 100644
--- a/src/profiles/profile-quickinst-DRAFT.sh
+++ b/src/core/procedures/quickinst-DRAFT
diff --git a/src/fifa.sh b/src/fifa.sh
index 53ad10b..0209bf2 100755
--- a/src/fifa.sh
+++ b/src/fifa.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-
+# TODO: we should be able to get away with not defining the "These functions would fit more in lib-ui, but we need them immediately" functions in lib-ui, but just sourcing lib-ui very early
###### Set some default variables or get them from the setup script ######
TITLE="Flexible Installer Framework for Arch linux"
@@ -11,17 +11,17 @@ LOG="/dev/tty7"
usage ()
{
+ msg="$0 <procedurename>\n
+If the procedurename starts with 'http://' it will be wget'ed. Otherwise it's assumed to be a procedure in the VFS tree\n
+If the procedurename is prefixed with '<modulename>/' it will be loaded from user module <modulename>. See README\n
+Available procedures:\n
+`ls -l /home/arch/fifa/core/procedures`\n
+`ls -l /home/arch/fifa/user/*/procedures`"
if [ "$var_UI_TYPE" = dia ]
then
- DIALOG --msgbox "$0 <profilename>\n
- If the profilename starts with 'http://' it will be wget'ed. Otherwise it's assumed to be a profile saved on disk. See README\n
- Available profiles:\n
- `ls -l /home/arch/fifa/profile-*`" 14 65
+ DIALOG --msgbox "$msg" 14 65
else
- echo "$0 <profilename>"
- echo "If the profilename starts with 'http://' it will be wget'ed. Otherwise it's assumed to be a profile saved on disk. See README"
- echo "Available profiles:"
- ls -l /home/arch/fifa/profile-*
+ echo "$msg"
fi
}
@@ -77,29 +77,63 @@ notify ()
###### Core functions ######
-load_profile()
+
+# $1 module name
+load_module ()
+{
+ [ -z "$1" ] && die_error "load_module needs a module argument"
+ notify "Loading module $1 ..."
+ path=/home/arch/fifa/user/"$1"
+ [ "$1" = core ] && path=/home/arch/fifa/core
+
+ for submodule in lib procedure
+ do
+ if [ ! -d "$path/${submodule}s" ]
+ then
+ # ignore this problem for not-core modules
+ [ "$1" = core ] && die_error "$path/${submodule}s does not exist. something is horribly wrong with this installation"
+ else
+ shopt -s nullglob
+ for i in "$path/${submodule}s"/*
+ do
+ load_${submodule} "$1" "`basename "$i"`"
+ done
+ fi
+ done
+
+}
+
+
+# $1 module name
+# $2 procedure name
+load_procedure()
{
- [ -z "$1" ] && die_error "load_profile needs a profile argument"
- notify "Loading profile $1 ..."
- if [[ $1 =~ ^http:// ]]
+ [ -z "$1" ] && die_error "load_procedure needs a module as \$1 and procedure as \$2"
+ [ -z "$2" ] && die_error "load_procedure needs a procedure as \$2"
+ if [ "$1" = 'http:' ]
then
- profile=/home/arch/fifa/profile-downloaded-`basename $1`
- wget $1 -q -O $profile >/dev/null || die_error "Could not download profile $1"
+ notify "Loading procedure $2 ..."
+ procedure=/home/arch/fifa/runtime/procedure-downloaded-`basename $2`
+ wget "$2" -q -O $procedure >/dev/null || die_error "Could not download procedure $2"
else
- profile=/home/arch/fifa/profile-$1
+ notify "Loading procedure $1/procedures/$2 ..."
+ procedure=/home/arch/fifa/user/"$1"/procedures/"$2"
+ [ "$1" = core ] && procedure=/home/arch/fifa/core/procedures/"$2"
fi
- [ -f "$profile" ] && source "$profile" || die_error "Something went wrong while sourcing profile $profile"
+ [ -f "$procedure" ] && source "$procedure" || die_error "Something went wrong while sourcing procedure $procedure"
}
-load_library ()
+# $1 module name
+# $2 library name
+load_lib ()
{
- [ -z "$1" ] && die_error "load_library needs a library argument"
- for library in $@
- do
- notify "Loading library $library ..."
- source $library || die_error "Something went wrong while sourcing library $library"
- done
+ [ -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"
+ notify "Loading library $1/libs/$2 ..."
+ lib=/home/arch/fifa/user/"$1"/libs/"$2"
+ [ "$1" = core ] && lib=/home/arch/fifa/core/libs/"$2"
+ source $lib || die_error "Something went wrong while sourcing library $lib"
}
@@ -120,6 +154,12 @@ execute ()
}
+depend_module ()
+{
+ load_module "$1"
+}
+
+
start_process ()
{
execute phase preparation
@@ -136,16 +176,32 @@ echo "Welcome to $TITLE"
mount -o remount,rw / &>/dev/null
-load_library /home/arch/fifa/lib/lib-*.sh
-
-[ "$1" != base ] && load_profile base
-load_profile $1
-
-# Set pacman vars. allow profiles 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 profile to decide the interactivity
+# note that we allow procedures like http://foo/bar. module -> http:, procedure -> http://foo/bar.
+if [[ $1 =~ ^http:// ]]
+then
+ module=http
+ procedure="$1"
+elif grep -q '\/' <<< "$1"
+then
+ #user specified module/procedure
+ module=`dirname "$1"`
+ procedure=`basename "$1"`
+else
+ module=core
+ procedure="$1"
+fi
+
+load_module core
+[ "$module" != core -a "$module" != http ] && load_module "$module"
+
+[ "$module" != core -o "$procedure" != base ] && load_procedure core base
+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
PACMAN=pacman
PACMAN_TARGET="pacman --root $var_TARGET_DIR --config /tmp/pacman.conf"
start_process
-exit 0 \ No newline at end of file
+exit 0
diff --git a/src/lib/whatsthis.txt b/src/lib/whatsthis.txt
deleted file mode 100644
index 72e5e15..0000000
--- a/src/lib/whatsthis.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-This directory contains several useful functions and scripts, ready to be
-used by fifa and it's profiles.
-
-Most of this code is taken (and modified) from the 'real' arch linux install scripts
-code. (/arch/setup and /arch/quickinst). the modifications are mostly done
-to make the code more useable and to separate backend code from the user
-interface (which was tightly coupled in the original scripts)
-
-
-I couldn't find what license the code is under, but I assume this
-is okay.. if not let me know.
-The original code is at http://projects.archlinux.org/?p=installer.git;a=summary
-
-I also wrote a few functions myself that I didn't find in the official
-scripts (mostly separate ui functions)
diff --git a/src/patch-install-cd.sh b/src/patch-install-cd.sh
index c3016e5..5398657 100755
--- a/src/patch-install-cd.sh
+++ b/src/patch-install-cd.sh
@@ -3,7 +3,10 @@ SRC_DIR=`dirname $0` # the src directory in the git clone
GIT_DIR=`dirname $SRC_DIR` # the git clone dir itself
mkdir -p /home/arch/fifa/docs
cp -ax $SRC_DIR/fifa.sh /arch/fifa.sh
-cp -ax $SRC_DIR/profiles/* /home/arch/fifa/
-cp -ax $SRC_DIR/lib /home/arch/fifa/
+
+cp -ax $SRC_DIR/core /home/arch/fifa/
+cp -ax $SRC_DIR/user /home/arch/fifa/
+cp -ax $SRC_DIR/runtime /home/arch/fifa/
+cp -ax $GIT_DIR/dieter /home/arch/fifa/user
cp -ax $GIT_DIR/HOWTO /home/arch/fifa/docs/
cp -ax $GIT_DIR/README /home/arch/fifa/docs/
diff --git a/src/runtime/whatsthis.txt b/src/runtime/whatsthis.txt
new file mode 100644
index 0000000..4cfdb32
--- /dev/null
+++ b/src/runtime/whatsthis.txt
@@ -0,0 +1 @@
+fifa will put files it uses during runtime here. (no source code goes here) \ No newline at end of file
diff --git a/src/user/whatsthis.txt b/src/user/whatsthis.txt
new file mode 100644
index 0000000..60f4255
--- /dev/null
+++ b/src/user/whatsthis.txt
@@ -0,0 +1 @@
+put user-specific modules here. should be empty in the 'official' version \ No newline at end of file