summaryrefslogtreecommitdiff
path: root/src/lib/setup_TOPROCESS
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/setup_TOPROCESS')
-rw-r--r--src/lib/setup_TOPROCESS397
1 files changed, 0 insertions, 397 deletions
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
-}