diff options
author | Dieter Plaetinck <dieter@plaetinck.be> | 2008-11-02 22:04:36 +0100 |
---|---|---|
committer | Dieter Plaetinck <dieter@plaetinck.be> | 2008-11-02 22:04:36 +0100 |
commit | 4019db7a540d6dfcef6431cfc11ca748595e2ca1 (patch) | |
tree | fc47df27708360c71699609f80d0b732b28412d8 /src | |
parent | c8a41a8f2afdb46e9da3bc9a677210b74b82eaab (diff) |
file hierarchy overhaul. now a structure that makes more sense: user and core separated. we now differentiate between procedures and libraries - no more "profiles" - + some bug fixed + probably quite a few introduced + runtime directory + separated my own stuff more
Diffstat (limited to 'src')
-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-x | src/fifa.sh | 120 | ||||
-rw-r--r-- | src/lib/whatsthis.txt | 15 | ||||
-rwxr-xr-x | src/patch-install-cd.sh | 7 | ||||
-rw-r--r-- | src/profiles/profile-automatic-dieter | 101 | ||||
-rw-r--r-- | src/runtime/whatsthis.txt | 1 | ||||
-rw-r--r-- | src/user/whatsthis.txt | 1 |
15 files changed, 98 insertions, 153 deletions
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/profiles/profile-automatic-dieter b/src/profiles/profile-automatic-dieter deleted file mode 100644 index 397231d..0000000 --- a/src/profiles/profile-automatic-dieter +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/bash -var_RUNTIME_PACKAGES="svn" - -phase_preparation () -{ - # All things that need to be done manually first - notify "A few manual things need to happen first..." - 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 - SVN_USERNAME=dieter - ask_password svn - SVN="svn --username $SVN_USERNAME --password $SVN_PASSWORD" - SVN_BASE=https://192.168.1.2/svn/repos - TARGET_HOST=mbp-santa-rosa #TODO: prompt user for this, or let him pass it as cmdline argument - - #TODO: find something against svn's interactive ssl cert checking. http://www.7php.net/svn-client-certificate-authentication-cache/ might help. also the timeout on the 'accept cert' is frustrating - _accept_ssl_cert - notify "**** From now on. everything will be automatic. Enjoy the show!" # not true: svn will complain about ssl cert + you need pass for dm_crypt - - execute worker runtime_packages - #TODO: i should have extra,community,.. (actually even yaourt/aur) available -} - -phase_finish () -{ - execute worker configure_home -} - - -worker_prepare_disks () -{ - #TODO: integrate this stuff into the functions in the libs + do error checking and handling - sfdisk /dev/sda 2>&1 | grep -v 'not have an msdos signature' << EOF -,10,L,* -,,L -EOF - 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" - cryptsetup -c aes-xts-plain -y -s 512 luksFormat /dev/sda2 - cryptsetup luksOpen /dev/sda2 sda2_crypt - pvcreate /dev/mapper/sda2_crypt - vgcreate cryptpool /dev/mapper/sda2_crypt - 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 - 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 - done - - #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 /home/arch/fifa/package-list || die_error "Could not export package list!" -} - - -worker_configure_home () -{ - #checkout from svn - true -} - - -worker_install_bootloader () -{ - install-grub /dev/sda -} - - -_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 - -}
\ No newline at end of file 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 |