add better select source check

This commit is contained in:
Tobias Powalowski 2010-03-06 10:13:54 +01:00
parent 40356d4229
commit 32eb01f72d

View file

@ -1882,6 +1882,15 @@ mountpoints() {
S_MKFS=1 S_MKFS=1
} }
# source_set()
# check if installation source is set, if not run select_source!
source_set(){
if ! [ "$S_SRC" = "1" ]; then
DIALOG --msgbox "Error:\nYou must select Source first." 0 0
select_source
fi
}
getsource() { getsource() {
S_SRC=0 S_SRC=0
if [ "$MODE" = "media" ]; then if [ "$MODE" = "media" ]; then
@ -1974,6 +1983,10 @@ prepare_pacman() {
DIALOG --infobox "Refreshing package database..." 6 45 DIALOG --infobox "Refreshing package database..." 6 45
$PACMAN -Sy >$LOG 2>&1 || return 1 $PACMAN -Sy >$LOG 2>&1 || return 1
if [ $? -ne 0 ]; then
DIALOG --msgbox "Pacman preparation failed! Check $LOG for errors." 6 60
return 1
fi
return 0 return 0
} }
@ -2030,18 +2043,9 @@ run_pacman(){
# params: none # params: none
# returns: 1 on error # returns: 1 on error
select_packages() { select_packages() {
if ! [ "$S_SRC" = "1" ]; then source_set
DIALOG --msgbox "Error:\nYou must select Source first." 0 0
return 1
fi
# set up our install location if necessary and sync up
# so we can get package lists
pacman_conf pacman_conf
prepare_pacman prepare_pacman
if [ $? -ne 0 ]; then
DIALOG --msgbox "Pacman preparation failed! Check $LOG for errors." 6 60
return 1
fi
# Archboot setup media Mode uses packages.txt! # Archboot setup media Mode uses packages.txt!
if [ "$MODE" = "media" ]; then if [ "$MODE" = "media" ]; then
DIALOG --msgbox "Package selection is split into two stages. First you will select package categories that contain packages you may be interested in. Then you will be presented with a full list of packages in your selected categories, allowing you to fine-tune your selection.\n\nNOTE: It is recommended that you install the BASE category from this setup, SUPPORT contains additional useful packages for networking and filesystems, DEVEL contains software building tools." 18 70 DIALOG --msgbox "Package selection is split into two stages. First you will select package categories that contain packages you may be interested in. Then you will be presented with a full list of packages in your selected categories, allowing you to fine-tune your selection.\n\nNOTE: It is recommended that you install the BASE category from this setup, SUPPORT contains additional useful packages for networking and filesystems, DEVEL contains software building tools." 18 70
@ -2151,10 +2155,7 @@ select_packages() {
# performs package installation to the target system # performs package installation to the target system
# #
install_packages() { install_packages() {
if ! [ "$S_SRC" = "1" ]; then source_set
DIALOG --msgbox "Error:\nYou must select Source first." 0 0
return 1
fi
if [ "$MODE" = "media" ]; then if [ "$MODE" = "media" ]; then
if [ ! -f /tmp/.pkglist -o "$S_SELECT" != "1" ]; then if [ ! -f /tmp/.pkglist -o "$S_SELECT" != "1" ]; then
DIALOG --msgbox "You must select packages first." 0 0 DIALOG --msgbox "You must select packages first." 0 0
@ -2436,6 +2437,7 @@ dosyslinux() {
pacman_conf_bootloader pacman_conf_bootloader
fi fi
PACKAGES="syslinux" PACKAGES="syslinux"
source_set
prepare_pacman prepare_pacman
run_pacman run_pacman
# reset PACKAGES after installing # reset PACKAGES after installing
@ -2521,6 +2523,7 @@ dosyslinux() {
dolilo() { dolilo() {
if [ ! -f $DESTDIR/etc/lilo.conf ]; then if [ ! -f $DESTDIR/etc/lilo.conf ]; then
DIALOG --msgbox "Couldn't find $DESTDIR/etc/lilo.conf, installing lilo now ..." 0 0 DIALOG --msgbox "Couldn't find $DESTDIR/etc/lilo.conf, installing lilo now ..." 0 0
source_set
prepare_pacman prepare_pacman
PACKAGES="lilo" PACKAGES="lilo"
run_pacman run_pacman
@ -2575,6 +2578,7 @@ dolilo() {
dogrub() { dogrub() {
if [ ! -f $DESTDIR/boot/grub/menu.lst ]; then if [ ! -f $DESTDIR/boot/grub/menu.lst ]; then
DIALOG --msgbox "Couldn't find $DESTDIR/boot/grub/menu.lst, installing grub now ..." 0 0 DIALOG --msgbox "Couldn't find $DESTDIR/boot/grub/menu.lst, installing grub now ..." 0 0
source_set
prepare_pacman prepare_pacman
PACKAGES="grub" PACKAGES="grub"
run_pacman run_pacman
@ -2830,6 +2834,7 @@ dogrub2(){
else else
pacman_conf_bootloader pacman_conf_bootloader
fi fi
source_set
prepare_pacman prepare_pacman
PACKAGES="grub2" PACKAGES="grub2"
run_pacman run_pacman