summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/lib-blockdevices-filesystems.sh17
-rw-r--r--src/lib/lib-network.sh38
-rw-r--r--src/lib/lib-pacman.sh108
-rw-r--r--src/lib/lib-software.sh47
-rw-r--r--src/lib/lib-ui.sh11
-rw-r--r--src/lib/setup_TOPROCESS397
-rw-r--r--src/profiles/profile-interactive-DRAFT.sh164
7 files changed, 382 insertions, 400 deletions
diff --git a/src/lib/lib-blockdevices-filesystems.sh b/src/lib/lib-blockdevices-filesystems.sh
index 101b737..b441a5e 100644
--- a/src/lib/lib-blockdevices-filesystems.sh
+++ b/src/lib/lib-blockdevices-filesystems.sh
@@ -260,3 +260,20 @@ _mkfs() {
fi
}
+
+# auto_fstab(). taken from setup
+# preprocess fstab file
+# comments out old fields and inserts new ones
+# according to partitioning/formatting stage
+#
+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
+ # append entries from new configuration
+ sort /tmp/.fstab >>$TARGET_DIR/etc/fstab
+ fi
+ fi
+}
diff --git a/src/lib/lib-network.sh b/src/lib/lib-network.sh
new file mode 100644
index 0000000..5e6652d
--- /dev/null
+++ b/src/lib/lib-network.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+# auto_network(). taken from setup
+# configures network on host system according to installer
+# settings if user wishes to do so
+#
+auto_network()
+{
+ # 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
+ 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
+ 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
+ fi
+ echo "nameserver $DNS" >> ${TARGET_DIR}/etc/resolv.conf
+ else
+ sed -i "s#eth0=\"eth0.*#$INTERFACE=\"dhcp\"#g" ${TARGET_DIR}/etc/rc.conf
+ fi
+ if [ "$PROXY_HTTP" != "" ]; then
+ notify "export http_proxy=$PROXY_HTTP" >> ${TARGET_DIR}/etc/profile.d/proxy.sh;
+ chmod a+x ${TARGET_DIR}/etc/profile.d/proxy.sh
+ fi
+ if [ "$PROXY_FTP" != "" ]; then
+ notify "export ftp_proxy=$PROXY_FTP" >> ${TARGET_DIR}/etc/profile.d/proxy.sh;
+ chmod a+x ${TARGET_DIR}/etc/profile.d/proxy.sh
+ fi
+}
diff --git a/src/lib/lib-pacman.sh b/src/lib/lib-pacman.sh
index bfc0adb..fc3fce0 100644
--- a/src/lib/lib-pacman.sh
+++ b/src/lib/lib-pacman.sh
@@ -53,6 +53,35 @@ target_write_pacman_conf ()
}
+# target_prepare_pacman() taken from setup. modified a bit
+# configures pacman and syncs for the first time on destination system
+#
+# params: none
+# returns: 1 on error
+target_prepare_pacman() {
+ [ "$var_PKG_SOURCE_TYPE" = "cd" ] && local serverurl="${FILE_URL}"
+ [ "$var_PKG_SOURCE_TYPE" = "ftp" ] && local serverurl="${SYNC_URL}"
+
+ # Setup a pacman.conf in /tmp
+ cat << EOF > /tmp/pacman.conf
+[options]
+CacheDir = ${TARGET_DIR}/var/cache/pacman/pkg
+CacheDir = /src/core/pkg
+
+[core]
+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"
+
+ notify "Refreshing package database..."
+ $PACMAN_TARGET -Sy >$LOG 2>&1 || return 1
+ return 0
+}
+
+
# taken from quickinst. TODO: figure this one out
pacman_what_is_this_for ()
{
@@ -67,3 +96,82 @@ pacman_what_is_this_for ()
! [ -d /var/lib/pacman ] && mkdir -p /var/lib/pacman
}
+
+
+# select_mirror(). taken from setup. TODO: get the UI code out of here
+# Prompt user for preferred mirror and set $SYNC_URL
+#
+# args: none
+# returns: nothing
+select_mirror() {
+ notify "Keep in mind ftp.archlinux.org is throttled.\nPlease select another mirror to get full download speed."
+ # FIXME: this regex doesn't honor commenting
+ MIRRORS=$(egrep -o '((ftp)|(http))://[^/]*' "${MIRRORLIST}" | sed 's|$| _|g')
+ _dia_DIALOG --menu "Select an FTP/HTTP mirror" 14 55 7 \
+ $MIRRORS \
+ "Custom" "_" 2>$ANSWER || return 1
+ local _server=$(cat $ANSWER)
+ if [ "${_server}" = "Custom" ]; then
+ _dia_DIALOG --inputbox "Enter the full URL to core repo." 8 65 \
+ "ftp://ftp.archlinux.org/core/os/i686" 2>$ANSWER || return 1
+ SYNC_URL=$(cat $ANSWER)
+ 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.
+ SYNC_URL=$(egrep -o "${_server}.*" "${MIRRORLIST}" | sed 's/\$repo/core/g' | head -n1)
+ fi
+ echo "Using mirror: $SYNC_URL" >$LOG
+}
+
+# select_source(). taken from setup. TODO: decouple ui
+# displays installation source selection menu
+# and sets up relevant config files
+#
+# params: none
+# returns: nothing
+select_source()
+{
+ DIALOG --menu "Please select an installation source" 10 35 3 \
+ "1" "CD-ROM or OTHER SOURCE" \
+ "2" "FTP/HTTP" 2>$ANSWER
+
+ case $(cat $ANSWER) in
+ "1")
+ MODE="cd"
+ ;;
+ "2")
+ MODE="ftp"
+ ;;
+ esac
+
+ if [ "$MODE" = "cd" ]; then
+ TITLE="Arch Linux CDROM or OTHER SOURCE Installation"
+ DIALOG --msgbox "Packages included on this disk have been mounted to /src/core/pkg. If you wish to use your own packages from another source, manually mount them there." 0 0
+ if [ ! -d /src/core/pkg ]; then
+ DIALOG --msgbox "Package directory /src/core/pkg is missing!" 0 0
+ return 1
+ fi
+ echo "Using CDROM for package installation" >$LOG
+ else
+ TITLE="Arch Linux FTP/HTTP Installation"
+ DIALOG --msgbox "If you wish to load your ethernet modules manually, please do so now in another terminal." 12 65
+ while true; do
+ DIALOG --menu "FTP Installation" 10 35 3 \
+ "0" "Setup Network" \
+ "1" "Choose Mirror" \
+ "2" "Return to Main Menu" 2>$ANSWER
+
+ case "$(cat $ANSWER)" in
+ "0")
+ donetwork ;;
+ "1")
+ select_mirror ;;
+ *)
+ break ;;
+ esac
+ done
+ fi
+ S_SRC=1
+}
diff --git a/src/lib/lib-software.sh b/src/lib/lib-software.sh
index 8ec802a..4537276 100644
--- a/src/lib/lib-software.sh
+++ b/src/lib/lib-software.sh
@@ -1,7 +1,7 @@
#!/bin/sh
-# run_mkinitcpio() taken from setup. adapted a bit.
+# run_mkinitcpio() taken from setup. adapted a lot
# runs mkinitcpio on the target system, displays output
run_mkinitcpio()
{
@@ -16,3 +16,48 @@ run_mkinitcpio()
# alert the user to fatal errors
[ $(cat /tmp/.mkinitcpio-retcode) -ne 0 ] && show_warning "MKINITCPIO FAILED - SYSTEM MAY NOT BOOT" "/tmp/mkinitcpio.log" text
}
+
+
+# installpkg(). taken from setup. modified bigtime
+# performs package installation to the target system
+installpkg() {
+ notify "Package installation will begin now. You can watch the output in the progress window. Please be patient." 0 0
+ target_specialfs on
+ 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
+}
+
+# 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
+ done
+ DIALOG --infobox "Generating glibc base locales..." 4 40
+ chroot ${TARGET_DIR} locale-gen >/dev/null
+}
diff --git a/src/lib/lib-ui.sh b/src/lib/lib-ui.sh
index 4672916..9962d84 100644
--- a/src/lib/lib-ui.sh
+++ b/src/lib/lib-ui.sh
@@ -21,7 +21,7 @@ ask_password ()
# ask a yes/no question.
# $1 question
-# returns 0 if response is Y or y. 1 otherwise
+# returns 0 if response is yes/y (case insensitive). 1 otherwise
# TODO: support for default answer
ask_yesno ()
{
@@ -154,6 +154,12 @@ _dia_follow_progress ()
}
+_dia_ask_yesno ()
+{
+ dialog --yesno "$1" 10 55 # returns 0 for yes, 1 for no
+}
+
+
_cli_ask_password ()
{
if [ -n "$1" ]
@@ -177,7 +183,8 @@ _cli_ask_yesno ()
{
echo -n "$1 (y/n)"
read answer
- if [ "$answer" = y -o "$answer" = Y ]
+ answer=`tr '[:upper:]' '[:lower:]' <<< $answer`
+ if [ "$answer" = y -o "$answer" = yes ]
then
return 0
else
diff --git a/src/lib/setup_TOPROCESS b/src/lib/setup_TOPROCESS
index 2e4391a..917dc9c 100644
--- a/src/lib/setup_TOPROCESS
+++ b/src/lib/setup_TOPROCESS
@@ -268,64 +268,6 @@ mountpoints() {
S_MKFS=1
}
-# select_mirror()
-# Prompt user for preferred mirror and set $SYNC_URL
-#
-# args: none
-# returns: nothing
-select_mirror() {
- DIALOG --msgbox "Keep in mind ftp.archlinux.org is throttled.\nPlease select another mirror to get full download speed." 18 70
- # FIXME: this regex doesn't honor commenting
- MIRRORS=$(egrep -o '((ftp)|(http))://[^/]*' "${MIRRORLIST}" | sed 's|$| _|g')
- DIALOG --menu "Select an FTP/HTTP mirror" 14 55 7 \
- $MIRRORS \
- "Custom" "_" 2>$ANSWER || return 1
- local _server=$(cat $ANSWER)
- if [ "${_server}" = "Custom" ]; then
- DIALOG --inputbox "Enter the full URL to core repo." 8 65 \
- "ftp://ftp.archlinux.org/core/os/i686" 2>$ANSWER || return 1
- SYNC_URL=$(cat $ANSWER)
- 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.
- SYNC_URL=$(egrep -o "${_server}.*" "${MIRRORLIST}" | sed 's/\$repo/core/g' | head -n1)
- fi
- echo "Using mirror: $SYNC_URL" >$LOG
-}
-
-# prepare_pacman()
-# configures pacman and syncs for the first time on destination system
-#
-# params: none
-# returns: 1 on error
-prepare_pacman() {
- if [ "$MODE" = "cd" ]; then
- local serverurl="${FILE_URL}"
- elif [ "$MODE" = "ftp" ]; then
- local serverurl="${SYNC_URL}"
- fi
-
- # Setup a pacman.conf in /tmp
- cat << EOF > /tmp/pacman.conf
-[options]
-CacheDir = ${TARGET_DIR}/var/cache/pacman/pkg
-CacheDir = /src/core/pkg
-
-[core]
-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"
-
- DIALOG --infobox "Refreshing package database..." 6 45
- $PACMAN -Sy >$LOG 2>&1 || return 1
- return 0
-}
-
# select_packages()
# prompts the user to select packages to install
#
@@ -389,141 +331,6 @@ select_packages() {
}
-# installpkg()
-# performs package installation to the target system
-#
-installpkg() {
- # check step dependencies
- if [ $S_SELECT -eq 0 ]; then
- DIALOG --msgbox "You must select packages first." 0 0
- return 1
- fi
-
- DIALOG --msgbox "Package installation will begin now. You can watch the output in the progress window. Please be patient." 0 0
-
- # must mount chroot so pre/post installs don't fail out
- chroot_mount
-
- # execute pacman in a subshell so we can follow its progress
- # pacman output goes /tmp/pacman.log
- # /tmp/setup-pacman-running acts as a lockfile
- ( \
- echo "Installing Packages..." >/tmp/pacman.log ; \
- echo >>/tmp/pacman.log ; \
- touch /tmp/setup-pacman-running ; \
- $PACMAN -S "$PACKAGES" 2>&1 >> /tmp/pacman.log ; \
- echo $? > /tmp/.pacman-retcode ; \
- 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
- ) &
-
- sleep 2
-
- # display pacman output while it's running
- DIALOG --title " Installing... Please Wait " \
- --no-kill --tailboxbg "/tmp/pacman.log" 18 70 2>$ANSWER
- while [ -f /tmp/setup-pacman-running ]; do
- sleep 1
- done
- kill $(cat $ANSWER)
-
- # pacman finished, display scrollable output
- 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
-
- # don't need chroot anymore
- chroot_umount
-
- # ensure the disk is synced
- sync
-
- S_INSTALL=1
-
- # automagic time!
- # any automatic configuration should go here
- DIALOG --infobox "Writing base configuration..." 6 40
- auto_fstab
- auto_network
- auto_locale
-}
-
-# auto_fstab()
-# preprocess fstab file
-# comments out old fields and inserts new ones
-# according to partitioning/formatting stage
-#
-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
- # append entries from new configuration
- sort /tmp/.fstab >>$TARGET_DIR/etc/fstab
- fi
- fi
-}
-
-# auto_network()
-# configures network on host system according to installer
-# settings if user wishes to do so
-#
-auto_network()
-{
- # exit if network wasn't configured in installer
- if [ $S_NET -eq 0 ]; then
- return 1
- fi
-
- DIALOG --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" 10 55 || return 1
-
- 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
- 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
- fi
- echo "nameserver $DNS" >> ${TARGET_DIR}/etc/resolv.conf
- else
- sed -i "s#eth0=\"eth0.*#$INTERFACE=\"dhcp\"#g" ${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
- 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
- fi
-}
-
-# auto_locale()
-# 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
- done
- DIALOG --infobox "Generating glibc base locales..." 4 40
- chroot ${TARGET_DIR} locale-gen >/dev/null
-}
-
# donetwork()
# Hand-hold through setting up networking
#
@@ -722,207 +529,3 @@ EOF
S_GRUB=1
}
-# select_source()
-# displays installation source selection menu
-# and sets up relevant config files
-#
-# params: none
-# returns: nothing
-select_source()
-{
- DIALOG --menu "Please select an installation source" 10 35 3 \
- "1" "CD-ROM or OTHER SOURCE" \
- "2" "FTP/HTTP" 2>$ANSWER
-
- case $(cat $ANSWER) in
- "1")
- MODE="cd"
- ;;
- "2")
- MODE="ftp"
- ;;
- esac
-
- if [ "$MODE" = "cd" ]; then
- TITLE="Arch Linux CDROM or OTHER SOURCE Installation"
- DIALOG --msgbox "Packages included on this disk have been mounted to /src/core/pkg. If you wish to use your own packages from another source, manually mount them there." 0 0
- if [ ! -d /src/core/pkg ]; then
- DIALOG --msgbox "Package directory /src/core/pkg is missing!" 0 0
- return 1
- fi
- echo "Using CDROM for package installation" >$LOG
- else
- TITLE="Arch Linux FTP/HTTP Installation"
- DIALOG --msgbox "If you wish to load your ethernet modules manually, please do so now in another terminal." 12 65
- while true; do
- DIALOG --menu "FTP Installation" 10 35 3 \
- "0" "Setup Network" \
- "1" "Choose Mirror" \
- "2" "Return to Main Menu" 2>$ANSWER
-
- case "$(cat $ANSWER)" in
- "0")
- donetwork ;;
- "1")
- select_mirror ;;
- *)
- break ;;
- esac
- done
- fi
- S_SRC=1
-}
-
-# set_clock()
-# prompts user to set hardware clock and timezone
-#
-# params: none
-# returns: 1 on failure
-set_clock()
-{
- # utc or local?
- DIALOG --menu "Is your hardware clock in UTC or local time?" 10 50 2 \
- "UTC" " " \
- "local" " " \
- 2>$ANSWER || return 1
- HARDWARECLOCK=$(cat $ANSWER)
-
- # timezone?
- tzselect > $ANSWER || return 1
- TIMEZONE=$(cat $ANSWER)
-
- # set system clock from hwclock - stolen from rc.sysinit
- local HWCLOCK_PARAMS=""
- if [ "$HARDWARECLOCK" = "UTC" ]; then
- HWCLOCK_PARAMS="$HWCLOCK_PARAMS --utc"
- else
- HWCLOCK_PARAMS="$HWCLOCK_PARAMS --localtime"
- fi
- if [ "$TIMEZONE" != "" -a -e "/usr/share/zoneinfo/$TIMEZONE" ]; then
- /bin/rm -f /etc/localtime
- /bin/cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
- fi
- /sbin/hwclock --hctosys $HWCLOCK_PARAMS --noadjfile
-
- # display and ask to set date/time
- dialog --calendar "Set the date.\nUse <TAB> to navigate and arrow keys to change values." 0 0 0 0 0 2> $ANSWER || return 1
- local _date="$(cat $ANSWER)"
- dialog --timebox "Set the time.\nUse <TAB> to navigate and up/down to change values." 0 0 2> $ANSWER || return 1
- local _time="$(cat $ANSWER)"
- echo "date: $_date time: $_time" >$LOG
-
- # save the time
- # DD/MM/YYYY hh:mm:ss -> YYYY-MM-DD hh:mm:ss
- local _datetime="$(echo "$_date" "$_time" | sed 's#\(..\)/\(..\)/\(....\) \(..\):\(..\):\(..\)#\3-\2-\1 \4:\5:\6#g')"
- echo "setting date to: $_datetime" >$LOG
- date -s "$_datetime" 2>&1 >$LOG
- /sbin/hwclock --systohc $HWCLOCK_PARAMS --noadjfile
-
- S_CLOCK=1
-}
-
-prepare_harddrive()
-{
- S_MKFSAUTO=0
- S_MKFS=0
- DONE=0
- NEXTITEM=""
- while [ "$DONE" = "0" ]; do
- if [ -n "$NEXTITEM" ]; then
- DEFAULT="--default-item $NEXTITEM"
- else
- DEFAULT=""
- fi
- DIALOG $DEFAULT --menu "Prepare Hard Drive" 12 60 5 \
- "1" "Auto-Prepare (erases the ENTIRE hard drive)" \
- "2" "Partition Hard Drives" \
- "3" "Set Filesystem Mountpoints" \
- "4" "Return to Main Menu" 2>$ANSWER
- NEXTITEM="$(cat $ANSWER)"
- case $(cat $ANSWER) in
- "1")
- autoprepare ;;
- "2")
- partition ;;
- "3")
- PARTFINISH=""
- mountpoints ;;
- *)
- DONE=1 ;;
- esac
- done
- NEXTITEM="1"
-}
-
-configure_system()
-{
- ## PREPROCESSING ##
- # only done on first invocation of configure_system
- if [ $S_CONFIG -eq 0 ]; then
-
- # /etc/pacman.d/mirrorlist
- # add installer-selected mirror to the top of the mirrorlist
- if [ "$MODE" = "ftp" -a "${SYNC_URL}" != "" ]; then
- awk "BEGIN { printf(\"# Mirror used during installation\nServer = "${SYNC_URL}"\n\n\") } 1 " "${TARGET_DIR}/etc/pacman.d/mirrorlist"
- fi
-
- # /etc/rc.conf
- # insert timezone and utc info
- sed -i -e "s/^TIMEZONE=.*/TIMEZONE=\"$TIMEZONE\"/g" \
- -e "s/^HARDWARECLOCK=.*/HARDWARECLOCK=\"$HARDWARECLOCK\"/g" \
- ${TARGET_DIR}/etc/rc.conf
- fi
-
- ## END PREPROCESS ##
-
- [ "$EDITOR" ] || geteditor
- FILE=""
-
- # main menu loop
- while true; do
- if [ -n "$FILE" ]; then
- DEFAULT="--default-item $FILE"
- else
- DEFAULT=""
- fi
-
- DIALOG $DEFAULT --menu "Configuration" 17 70 10 \
- "/etc/rc.conf" "System Config" \
- "/etc/fstab" "Filesystem Mountpoints" \
- "/etc/mkinitcpio.conf" "Initramfs Config" \
- "/etc/modprobe.conf" "Kernel Modules" \
- "/etc/resolv.conf" "DNS Servers" \
- "/etc/hosts" "Network Hosts" \
- "/etc/hosts.deny" "Denied Network Services" \
- "/etc/hosts.allow" "Allowed Network Services" \
- "/etc/locale.gen" "Glibc Locales" \
- "/etc/pacman.d/mirrorlist" "Pacman Mirror List" \
- "Root-Password" "Set the root password" \
- "Return" "Return to Main Menu" 2>$ANSWER || FILE="Return"
- FILE="$(cat $ANSWER)"
-
- if [ "$FILE" = "Return" -o -z "$FILE" ]; then # exit
- break
- elif [ "$FILE" = "Root-Password" ]; then # non-file
- while true; do
- chroot ${TARGET_DIR} passwd root && break
- done
- else #regular file
- $EDITOR ${TARGET_DIR}${FILE}
- fi
- done
-
- ## POSTPROCESSING ##
-
- # /etc/initcpio.conf
- #
- run_mkinitcpio
-
- # /etc/locale.gen
- #
- chroot ${TARGET_DIR} locale-gen
-
- ## END POSTPROCESSING ##
-
- S_CONFIG=1
-}
diff --git a/src/profiles/profile-interactive-DRAFT.sh b/src/profiles/profile-interactive-DRAFT.sh
index cca2930..f94853f 100644
--- a/src/profiles/profile-interactive-DRAFT.sh
+++ b/src/profiles/profile-interactive-DRAFT.sh
@@ -108,6 +108,170 @@ partition() {
S_PART=1
}
+
+configure_system()
+{
+ ## PREPROCESSING ##
+ # only done on first invocation of configure_system
+ if [ $S_CONFIG -eq 0 ]; then
+
+ # /etc/pacman.d/mirrorlist
+ # add installer-selected mirror to the top of the mirrorlist
+ if [ "$MODE" = "ftp" -a "${SYNC_URL}" != "" ]; then
+ awk "BEGIN { printf(\"# Mirror used during installation\nServer = "${SYNC_URL}"\n\n\") } 1 " "${TARGET_DIR}/etc/pacman.d/mirrorlist"
+ fi
+
+ # /etc/rc.conf
+ # insert timezone and utc info
+ sed -i -e "s/^TIMEZONE=.*/TIMEZONE=\"$TIMEZONE\"/g" \
+ -e "s/^HARDWARECLOCK=.*/HARDWARECLOCK=\"$HARDWARECLOCK\"/g" \
+ ${TARGET_DIR}/etc/rc.conf
+ fi
+
+ ## END PREPROCESS ##
+
+ [ "$EDITOR" ] || geteditor
+ FILE=""
+
+ # main menu loop
+ while true; do
+ if [ -n "$FILE" ]; then
+ DEFAULT="--default-item $FILE"
+ else
+ DEFAULT=""
+ fi
+
+ DIALOG $DEFAULT --menu "Configuration" 17 70 10 \
+ "/etc/rc.conf" "System Config" \
+ "/etc/fstab" "Filesystem Mountpoints" \
+ "/etc/mkinitcpio.conf" "Initramfs Config" \
+ "/etc/modprobe.conf" "Kernel Modules" \
+ "/etc/resolv.conf" "DNS Servers" \
+ "/etc/hosts" "Network Hosts" \
+ "/etc/hosts.deny" "Denied Network Services" \
+ "/etc/hosts.allow" "Allowed Network Services" \
+ "/etc/locale.gen" "Glibc Locales" \
+ "/etc/pacman.d/mirrorlist" "Pacman Mirror List" \
+ "Root-Password" "Set the root password" \
+ "Return" "Return to Main Menu" 2>$ANSWER || FILE="Return"
+ FILE="$(cat $ANSWER)"
+ if [ "$FILE" = "Return" -o -z "$FILE" ]; then # exit
+ break
+ elif [ "$FILE" = "Root-Password" ]; then # non-file
+ while true; do
+ chroot ${TARGET_DIR} passwd root && break
+ done
+ else #regular file
+ $EDITOR ${TARGET_DIR}${FILE}
+ fi
+ done
+
+ ## POSTPROCESSING ##
+
+ # /etc/initcpio.conf
+ #
+ run_mkinitcpio
+
+ # /etc/locale.gen
+ #
+ chroot ${TARGET_DIR} locale-gen
+
+ ## END POSTPROCESSING ##
+
+ S_CONFIG=1
+}
+
+
+prepare_harddrive()
+{
+ S_MKFSAUTO=0
+ S_MKFS=0
+ DONE=0
+ NEXTITEM=""
+ while [ "$DONE" = "0" ]; do
+ if [ -n "$NEXTITEM" ]; then
+ DEFAULT="--default-item $NEXTITEM"
+ else
+ DEFAULT=""
+ fi
+ DIALOG $DEFAULT --menu "Prepare Hard Drive" 12 60 5 \
+ "1" "Auto-Prepare (erases the ENTIRE hard drive)" \
+ "2" "Partition Hard Drives" \
+ "3" "Set Filesystem Mountpoints" \
+ "4" "Return to Main Menu" 2>$ANSWER
+ NEXTITEM="$(cat $ANSWER)"
+ case $(cat $ANSWER) in
+ "1")
+ autoprepare ;;
+ "2")
+ partition ;;
+ "3")
+ PARTFINISH=""
+ mountpoints ;;
+ *)
+ DONE=1 ;;
+ esac
+ done
+ NEXTITEM="1"
+}
+
+
+# set_clock()
+# prompts user to set hardware clock and timezone
+#
+# params: none
+# returns: 1 on failure
+set_clock()
+{
+ # utc or local?
+ DIALOG --menu "Is your hardware clock in UTC or local time?" 10 50 2 \
+ "UTC" " " \
+ "local" " " \
+ 2>$ANSWER || return 1
+ HARDWARECLOCK=$(cat $ANSWER)
+
+ # timezone?
+ tzselect > $ANSWER || return 1
+ TIMEZONE=$(cat $ANSWER)
+
+ # set system clock from hwclock - stolen from rc.sysinit
+ local HWCLOCK_PARAMS=""
+ if [ "$HARDWARECLOCK" = "UTC" ]; then
+ HWCLOCK_PARAMS="$HWCLOCK_PARAMS --utc"
+ else
+ HWCLOCK_PARAMS="$HWCLOCK_PARAMS --localtime"
+ fi
+ if [ "$TIMEZONE" != "" -a -e "/usr/share/zoneinfo/$TIMEZONE" ]; then
+ /bin/rm -f /etc/localtime
+ /bin/cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
+ fi
+ /sbin/hwclock --hctosys $HWCLOCK_PARAMS --noadjfile
+
+ # display and ask to set date/time
+ dialog --calendar "Set the date.\nUse <TAB> to navigate and arrow keys to change values." 0 0 0 0 0 2> $ANSWER || return 1
+ local _date="$(cat $ANSWER)"
+ dialog --timebox "Set the time.\nUse <TAB> to navigate and up/down to change values." 0 0 2> $ANSWER || return 1
+ local _time="$(cat $ANSWER)"
+ echo "date: $_date time: $_time" >$LOG
+
+ # save the time
+ # DD/MM/YYYY hh:mm:ss -> YYYY-MM-DD hh:mm:ss
+ local _datetime="$(echo "$_date" "$_time" | sed 's#\(..\)/\(..\)/\(....\) \(..\):\(..\):\(..\)#\3-\2-\1 \4:\5:\6#g')"
+ echo "setting date to: $_datetime" >$LOG
+ date -s "$_datetime" 2>&1 >$LOG
+ /sbin/hwclock --systohc $HWCLOCK_PARAMS --noadjfile
+
+ S_CLOCK=1
+}
+
+[ $S_SELECT -eq 0 ] && install_pkg && S_INSTALL=1 # user must first select, then install
+# automagic time!
+# any automatic configuration should go here
+notify "Writing base configuration..."
+auto_fstab
+auto_network
+auto_locale
+
#####################
## begin execution ##