~ubuntu-installer/kickseed/master

« back to all changes in this revision

Viewing changes to initrd-kickseed

  • Committer: Colin Watson
  • Date: 2007-06-18 20:00:14 UTC
  • Revision ID: git-v1:bdb520ff21d55a70cc0a7c80de9a90052e1ebe91
[project @ Arch-1:colin.watson@canonical.com--2005%kickseed--mainline--0--patch-174]
Display an error if we can't fetch the Kickstart file from HTTP/FTP, or ...
* Display an error if we can't fetch the Kickstart file from HTTP/FTP, or
  if we can't mount the given NFS server.



Original author: Colin Watson <colin.watson@canonical.com>
Date: 2005-08-08 14:01:28+00:00

r47465

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
        fi
38
38
}
39
39
 
 
40
FETCH_ERROR=
40
41
fetch_url () {
41
42
        local url="$1"
42
43
        local file="$2"
44
45
        while [ $iters -lt 3 ]; do
45
46
                # TODO proxy support? Would it be useful?
46
47
                # TODO add progress bar
47
 
                if wget -q "$url" -O "$file" 2>&1 | logger -t kickseed; then
 
48
                if FETCH_ERROR="$(wget -q "$url" -O "$file" 2>&1)"; then
48
49
                        return 0
49
50
                fi
 
51
                echo "$FETCH_ERROR" | logger -t kickseed
50
52
                iters=$(($iters + 1))
51
53
        done
52
54
        return 1
60
62
                logger -t kickseed "Downloading kickstart file from $KS"
61
63
                if ! fetch_url "$KS" "$KSCFG"; then
62
64
                        logger -t kickseed "... failed"
 
65
                        db_subst initrd-kickseed/wget-failed URL "$KS"
 
66
                        db_subst initrd-kickseed/wget-failed \
 
67
                                ERROR "$FETCH_ERROR"
 
68
                        db_input high initrd-kickseed/wget-failed || true
 
69
                        db_go
63
70
                        exit 1
64
71
                fi
65
72
                ;;
71
78
                if ! mount -t nfs -o ro,intr,nolock \
72
79
                                "$server:${file%/*}" "${KSCFG%/*}"; then
73
80
                        logger -t kickseed "... failed"
 
81
                        db_subst initrd-kickseed/nfs-mount-failed \
 
82
                                DIR "${file%/*}"
 
83
                        db_subst initrd-kickseed/nfs-mount-failed \
 
84
                                SERVER "$server"
 
85
                        db_input initrd-kickseed/nfs-mount-failed || true
 
86
                        db_go
74
87
                        exit 1
75
88
                fi
76
89
                trap "umount '${KSCFG%/*}' || true" \