summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2008-11-01 19:36:05 +0100
committerDieter Plaetinck <dieter@plaetinck.be>2008-11-01 19:36:05 +0100
commita95bfb1aaa4cf05dbb92a409f9a5ea8db720c98d (patch)
tree208593a33fd1546e79daeac65e8feaa032852aa1 /src
parentad4447e651202c1e3ba0b665e40269fe345e9bc0 (diff)
var_TARGET_DIR and various other fixes
Diffstat (limited to 'src')
-rwxr-xr-xsrc/fifa.sh8
-rw-r--r--src/lib/lib-blockdevices-filesystems.sh28
-rw-r--r--src/lib/lib-network.sh26
-rw-r--r--src/lib/lib-pacman.sh12
-rw-r--r--src/lib/lib-software.sh46
-rw-r--r--src/profiles/profile-dieter10
-rw-r--r--src/profiles/profile-interactive-DRAFT.sh12
7 files changed, 75 insertions, 67 deletions
diff --git a/src/fifa.sh b/src/fifa.sh
index d0b1d75..7fbfa63 100755
--- a/src/fifa.sh
+++ b/src/fifa.sh
@@ -4,9 +4,6 @@
###### Set some default variables or get them from the setup script ######
TITLE="Flexible Installer Framework for Arch linux"
LOG="/dev/tty7"
-# flags like --noconfirm should not be specified here. it's up to the profile to decide the interactivity
-PACMAN=pacman
-PACMAN_TARGET="pacman --root $TARGET_DIR --config /tmp/pacman.conf"
@@ -135,6 +132,11 @@ 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
+PACMAN=pacman
+PACMAN_TARGET="pacman --root $var_TARGET_DIR --config /tmp/pacman.conf"
+
execute phase preparation
execute phase basics
execute phase system
diff --git a/src/lib/lib-blockdevices-filesystems.sh b/src/lib/lib-blockdevices-filesystems.sh
index 6c3921a..a3bc099 100644
--- a/src/lib/lib-blockdevices-filesystems.sh
+++ b/src/lib/lib-blockdevices-filesystems.sh
@@ -9,18 +9,18 @@ target_special_fs ()
if [ "$1" = on ]
then
# mount proc/sysfs first, so mkinitrd can use auto-detection if it wants
- ! [ -d $TARGET_DIR/proc ] && mkdir $TARGET_DIR/proc
- ! [ -d $TARGET_DIR/sys ] && mkdir $TARGET_DIR/sys
- ! [ -d $TARGET_DIR/dev ] && mkdir $TARGET_DIR/dev
+ ! [ -d $var_TARGET_DIR/proc ] && mkdir $var_TARGET_DIR/proc
+ ! [ -d $var_TARGET_DIR/sys ] && mkdir $var_TARGET_DIR/sys
+ ! [ -d $var_TARGET_DIR/dev ] && mkdir $var_TARGET_DIR/dev
#mount, if not mounted yet
- mount | grep -q "$TARGET_DIR/proc" || mount -t proc none $TARGET_DIR/proc || die_error "Could not mount $TARGET_DIR/proc" #NOTE: setup script uses mount -t proc proc ? what's best?
- mount | grep -q "$TARGET_DIR/sys" || mount -t sysfs none $TARGET_DIR/sys || die_error "Could not mount $TARGET_DIR/sys" # NOTE: setup script uses mount -t sysfs sysfs ? what's best?
- mount | grep -q "$TARGET_DIR/dev" || mount -o bind /dev $TARGET_DIR/dev || die_error "Could not mount $TARGET_DIR/dev"
+ mount | grep -q "$var_TARGET_DIR/proc" || mount -t proc none $var_TARGET_DIR/proc || die_error "Could not mount $var_TARGET_DIR/proc" #NOTE: setup script uses mount -t proc proc ? what's best?
+ mount | grep -q "$var_TARGET_DIR/sys" || mount -t sysfs none $var_TARGET_DIR/sys || die_error "Could not mount $var_TARGET_DIR/sys" # NOTE: setup script uses mount -t sysfs sysfs ? what's best?
+ mount | grep -q "$var_TARGET_DIR/dev" || mount -o bind /dev $var_TARGET_DIR/dev || die_error "Could not mount $var_TARGET_DIR/dev"
elif [ "$1" = off ]
then
- umount $TARGET_DIR/proc || die_error "Could not umount $TARGET_DIR/proc"
- umount $TARGET_DIR/sys || die_error "Could not umount $TARGET_DIR/sys"
- umount $TARGET_DIR/dev || die_error "Could not umount $TARGET_DIR/dev"
+ umount $var_TARGET_DIR/proc || die_error "Could not umount $var_TARGET_DIR/proc"
+ umount $var_TARGET_DIR/sys || die_error "Could not umount $var_TARGET_DIR/sys"
+ umount $var_TARGET_DIR/dev || die_error "Could not umount $var_TARGET_DIR/dev"
fi
}
@@ -32,8 +32,8 @@ target_umountall()
{
notify "Disabling swapspace, unmounting already mounted disk devices..."
swapoff -a >/dev/null 2>&1
- umount $(mount | grep -v "${TARGET_DIR} " | grep "${TARGET_DIR}" | sed 's|\ .*||g') >/dev/null 2>&1
- umount $(mount | grep "${TARGET_DIR} " | sed 's|\ .*||g') >/dev/null 2>&1
+ umount $(mount | grep -v "${var_TARGET_DIR} " | grep "${var_TARGET_DIR}" | sed 's|\ .*||g') >/dev/null 2>&1
+ umount $(mount | grep "${var_TARGET_DIR} " | sed 's|\ .*||g') >/dev/null 2>&1
}
@@ -153,7 +153,7 @@ findpartitions() {
# taken from setup
get_grub_map() {
rm /tmp/dev.map
- $TARGET_DIR/sbin/grub --no-floppy --device-map /tmp/dev.map >/tmp/grub.log 2>&1 <<EOF
+ $var_TARGET_DIR/sbin/grub --no-floppy --device-map /tmp/dev.map >/tmp/grub.log 2>&1 <<EOF
quit
EOF
}
@@ -277,9 +277,9 @@ auto_fstab()
if [ "$S_MKFS" = "1" -o "$S_MKFSAUTO" = "1" ]; then
if [ -f /tmp/.fstab ]; then
# comment out stray /dev entries
- sed -i 's/^\/dev/#\/dev/g' $TARGET_DIR/etc/fstab
+ sed -i 's/^\/dev/#\/dev/g' $var_TARGET_DIR/etc/fstab
# append entries from new configuration
- sort /tmp/.fstab >>$TARGET_DIR/etc/fstab
+ sort /tmp/.fstab >>$var_TARGET_DIR/etc/fstab
fi
fi
}
diff --git a/src/lib/lib-network.sh b/src/lib/lib-network.sh
index 249b37c..93ba9cb 100644
--- a/src/lib/lib-network.sh
+++ b/src/lib/lib-network.sh
@@ -7,27 +7,27 @@
auto_network()
{
if [ $S_DHCP -ne 1 ]; then
- sed -i "s#eth0=\"eth0#$INTERFACE=\"$INTERFACE#g" ${TARGET_DIR}/etc/rc.conf
- sed -i "s# 192.168.0.2 # $IPADDR #g" ${TARGET_DIR}/etc/rc.conf
- sed -i "s# 255.255.255.0 # $SUBNET #g" ${TARGET_DIR}/etc/rc.conf
- sed -i "s# 192.168.0.255\"# $BROADCAST\"#g" ${TARGET_DIR}/etc/rc.conf
- sed -i "s#eth0)#$INTERFACE)#g" ${TARGET_DIR}/etc/rc.conf
+ 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
if [ "$GW" != "" ]; then
- sed -i "s#gw 192.168.0.1#gw $GW#g" ${TARGET_DIR}/etc/rc.conf
- sed -i "s#!gateway#gateway#g" ${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" >> ${TARGET_DIR}/etc/resolv.conf
+ echo "nameserver $DNS" >> ${var_TARGET_DIR}/etc/resolv.conf
else
- sed -i "s#eth0=\"eth0.*#$INTERFACE=\"dhcp\"#g" ${TARGET_DIR}/etc/rc.conf
+ sed -i "s#eth0=\"eth0.*#$INTERFACE=\"dhcp\"#g" ${var_TARGET_DIR}/etc/rc.conf
fi
if [ "$PROXY_HTTP" != "" ]; then
- echo "export http_proxy=$PROXY_HTTP" >> ${TARGET_DIR}/etc/profile.d/proxy.sh;
- chmod a+x ${TARGET_DIR}/etc/profile.d/proxy.sh
+ echo "export http_proxy=$PROXY_HTTP" >> ${var_TARGET_DIR}/etc/profile.d/proxy.sh;
+ chmod a+x ${var_TARGET_DIR}/etc/profile.d/proxy.sh
fi
if [ "$PROXY_FTP" != "" ]; then
- echo "export ftp_proxy=$PROXY_FTP" >> ${TARGET_DIR}/etc/profile.d/proxy.sh;
- chmod a+x ${TARGET_DIR}/etc/profile.d/proxy.sh
+ echo "export ftp_proxy=$PROXY_FTP" >> ${var_TARGET_DIR}/etc/profile.d/proxy.sh;
+ chmod a+x ${var_TARGET_DIR}/etc/profile.d/proxy.sh
fi
}
diff --git a/src/lib/lib-pacman.sh b/src/lib/lib-pacman.sh
index fc3fce0..40c7980 100644
--- a/src/lib/lib-pacman.sh
+++ b/src/lib/lib-pacman.sh
@@ -46,9 +46,9 @@ target_write_pacman_conf ()
cp $PKG_SOURCE/packages.txt /tmp/packages.txt
echo "Server = file://$PKGARG" >>/tmp/pacman.conf
fi
- mkdir -p $TARGET_DIR/var/cache/pacman/pkg /var/cache/pacman &>/dev/null
+ mkdir -p $var_TARGET_DIR/var/cache/pacman/pkg /var/cache/pacman &>/dev/null
rm -f /var/cache/pacman/pkg &>/dev/null
- [ "$var_PKG_SOURCE_TYPE" = "ftp" ] && ln -sf $TARGET_DIR/var/cache/pacman/pkg /var/cache/pacman/pkg &>/dev/null
+ [ "$var_PKG_SOURCE_TYPE" = "ftp" ] && ln -sf $var_TARGET_DIR/var/cache/pacman/pkg /var/cache/pacman/pkg &>/dev/null
[ "$var_PKG_SOURCE_TYPE" = "cd" ] && ln -sf $PKGARG /var/cache/pacman/pkg &>/dev/null
}
@@ -65,7 +65,7 @@ target_prepare_pacman() {
# Setup a pacman.conf in /tmp
cat << EOF > /tmp/pacman.conf
[options]
-CacheDir = ${TARGET_DIR}/var/cache/pacman/pkg
+CacheDir = ${var_TARGET_DIR}/var/cache/pacman/pkg
CacheDir = /src/core/pkg
[core]
@@ -73,8 +73,8 @@ Server = ${serverurl}
EOF
# Set up the necessary directories for pacman use
- [ ! -d "${TARGET_DIR}/var/cache/pacman/pkg" ] && mkdir -m 755 -p "${TARGET_DIR}/var/cache/pacman/pkg"
- [ ! -d "${TARGET_DIR}/var/lib/pacman" ] && mkdir -m 755 -p "${TARGET_DIR}/var/lib/pacman"
+ [ ! -d "${var_TARGET_DIR}/var/cache/pacman/pkg" ] && mkdir -m 755 -p "${var_TARGET_DIR}/var/cache/pacman/pkg"
+ [ ! -d "${var_TARGET_DIR}/var/lib/pacman" ] && mkdir -m 755 -p "${var_TARGET_DIR}/var/lib/pacman"
notify "Refreshing package database..."
$PACMAN_TARGET -Sy >$LOG 2>&1 || return 1
@@ -92,7 +92,7 @@ pacman_what_is_this_for ()
nm=${i%-*-*}
PKGLIST="$PKGLIST $nm"
done
- ! [ -d $TARGET_DIR/var/lib/pacman ] && mkdir -p $TARGET_DIR/var/lib/pacman
+ ! [ -d $var_TARGET_DIR/var/lib/pacman ] && mkdir -p $var_TARGET_DIR/var/lib/pacman
! [ -d /var/lib/pacman ] && mkdir -p /var/lib/pacman
}
diff --git a/src/lib/lib-software.sh b/src/lib/lib-software.sh
index 4537276..95bc07a 100644
--- a/src/lib/lib-software.sh
+++ b/src/lib/lib-software.sh
@@ -7,7 +7,7 @@ run_mkinitcpio()
{
target_special_fs on
- run_background mkinitcpio "chroot $TARGET_DIR /sbin/mkinitcpio -p kernel26" /tmp/mkinitcpio.log
+ run_background mkinitcpio "chroot $var_TARGET_DIR /sbin/mkinitcpio -p kernel26" /tmp/mkinitcpio.log
follow_progress "Rebuilding initcpio images ..." /tmp/mkinitcpio.log
wait_for mkinitcpio
@@ -26,38 +26,32 @@ installpkg() {
run_background pacman-installpkg "$PACMAN_TARGET -S $PACKAGES" /tmp/pacman.log
follow_progress " Installing... Please Wait " /tmp/pacman.log
- if [ $(cat /tmp/.pacman-retcode) -ne 0 ]; then
- echo -e "\nPackage Installation FAILED." >>/tmp/pacman.log
- else
- echo -e "\nPackage Installation Complete." >>/tmp/pacman.log
- fi
- rm /tmp/setup-pacman-running
-
wait_for pacman-installpkg
-
- local _result=''
- if [ $(cat /tmp/.pacman-retcode) -ne 0 ]; then
- _result="Installation Failed (see errors below)"
- else
- _result="Installation Complete"
- fi
- rm /tmp/.pacman-retcode
-
- DIALOG --title "$_result" --exit-label "Continue" \
- --textbox "/tmp/pacman.log" 18 70 || return 1
-
- target_specialfs off
-
- sync
+
+ local _result=''
+ if [ $(cat /tmp/.pacman-retcode) -ne 0 ]; then
+ _result="Installation Failed (see errors below)"
+ echo -e "\nPackage Installation FAILED." >>/tmp/pacman.log
+ else
+ _result="Installation Complete"
+ echo -e "\nPackage Installation Complete." >>/tmp/pacman.log
+ fi
+ rm /tmp/.pacman-retcode
+
+ show_warning "$_result" "/tmp/pacman.log" text || return 1
+
+ target_specialfs off
+
+ sync
}
# auto_locale(). taken from setup
# enable glibc locales from rc.conf and build initial locale DB
auto_locale()
{
- for i in $(grep "^LOCALE" ${TARGET_DIR}/etc/rc.conf | sed -e 's/.*="//g' -e's/\..*//g'); do
- sed -i -e "s/^#$i/$i/g" ${TARGET_DIR}/etc/locale.gen
+ for i in $(grep "^LOCALE" ${var_TARGET_DIR}/etc/rc.conf | sed -e 's/.*="//g' -e's/\..*//g'); do
+ sed -i -e "s/^#$i/$i/g" ${var_TARGET_DIR}/etc/locale.gen
done
DIALOG --infobox "Generating glibc base locales..." 4 40
- chroot ${TARGET_DIR} locale-gen >/dev/null
+ chroot ${var_TARGET_DIR} locale-gen >/dev/null
}
diff --git a/src/profiles/profile-dieter b/src/profiles/profile-dieter
index 2776ff5..6574eb0 100644
--- a/src/profiles/profile-dieter
+++ b/src/profiles/profile-dieter
@@ -43,10 +43,10 @@ EOF
lvcreate -L 10G -n home cryptpool
lvcreate -L 10G -n root cryptpool
lvcreate -L 3G -n var cryptpool
- mke2fs -j /dev/cryptpool/home && mount /dev/cryptpool/home $TARGET_DIR/home
- mke2fs -j /dev/cryptpool/root
- mke2fs -j /dev/cryptpool/tmp
- mke2fs -j /dev/cryptpool/var
+ for i in home root tmp var
+ do
+ 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
@@ -74,7 +74,7 @@ worker_install_bootloader ()
_accept_ssl_cert ()
{
mkdir -p /root/.subversion/auth/svn.ssl.server
- cat /root/.subversion/auth/svn.ssl.server/1123d3c8b27895efee3848cc779e526a << EOF
+ cat > /root/.subversion/auth/svn.ssl.server/1123d3c8b27895efee3848cc779e526a << EOF
K 10
ascii_cert
V 716
diff --git a/src/profiles/profile-interactive-DRAFT.sh b/src/profiles/profile-interactive-DRAFT.sh
index b7644e3..b7f5a68 100644
--- a/src/profiles/profile-interactive-DRAFT.sh
+++ b/src/profiles/profile-interactive-DRAFT.sh
@@ -803,6 +803,18 @@ EOF
S_GRUB=1
}
+
+ # exit if network wasn't configured in installer
+ if [ $S_NET -eq 0 ]; then
+ return 1
+ fi
+
+ ask_yesno "Do you want to use the network settings from the installer in rc.conf and resolv.conf?\n\nIf you used Proxy settings, they will be written to /etc/profile.d/proxy.sh" || return 1
+
+ if [ $S_DHCP -ne 1 ]; then
+ auto_network
+fi
+
#####################
## begin execution ##