refactor files to edit

This commit is contained in:
Tobias Powalowski 2012-07-24 14:01:22 +02:00
parent a77ef7118c
commit 48ab288c0c

View file

@ -4939,24 +4939,7 @@ configure_system() {
else
DEFAULT=""
fi
if [[ "${SYSTEMD}" = "1" ]]; then
DIALOG ${DEFAULT} --menu "Configuration" 23 80 18 \
"/etc/hostname" "System Hostname" \
"/etc/vconsole.conf" "Virtual Console" \
"/etc/locale.conf" "Locale Setting" \
"/etc/timezone" "Timezone Setting" \
"/etc/fstab" "Filesystem Mountpoints" \
"/etc/mkinitcpio.conf" "Initramfs Config" \
"/etc/modprobe.d/modprobe.conf" "Kernel Modules" \
"/etc/resolv.conf" "DNS Servers" \
"/etc/hosts" "Network Hosts" \
"/etc/locale.gen" "Glibc Locales" \
"/etc/pacman.d/mirrorlist" "Pacman Mirror List" \
"/etc/pacman.conf" "Pacman Config File" \
"Root-Password" "Set the root password" \
"Return" "Return to Main Menu" 2>${ANSWER} || break
else
DIALOG ${DEFAULT} --menu "Configuration" 24 80 19 \
DIALOG ${DEFAULT} --menu "Configuration" 21 80 16 \
"/etc/rc.conf" "System Config" \
"/etc/hostname" "System Hostname" \
"/etc/vconsole.conf" "Virtual Console" \
@ -4972,13 +4955,18 @@ configure_system() {
"/etc/pacman.conf" "Pacman Config File" \
"Root-Password" "Set the root password" \
"Return" "Return to Main Menu" 2>${ANSWER} || break
fi
FILE="$(cat ${ANSWER})"
if [[ "${FILE}" = "Return" || -z "${FILE}" ]]; then # exit
S_CONFIG=1
break
elif [[ "${FILE}" = "/etc/rc.conf" || "${FILE}" = "/etc/hostname" ]]; then # non-file
# if user edited /etc/rc.conf, add the hostname to /etc/hosts if it's not already there.
elif [[ "${FILE}" = "/etc/rc.conf" ]]; then # non-file
if [[ "${SYSTEMD}" = "1" ]]; then
DIALOG --msgbox "You use systemd. This file has no function on systemd systems." 18 70
else
${EDITOR} ${DESTDIR}${FILE}
fi
elif [[ "${FILE}" = "/etc/hostname" ]]; then # non-file
# if user edited /etc/hostname, add the hostname to /etc/hosts if it's not already there.
# note that if the user edits rc.conf several times to change the hostname more then once,
# we will add them all to /etc/hosts. this is not perfect, but to avoid this, too much code would be required
# (feel free to prove me wrong :))