1220080Snwhitehorn#!/bin/sh
2220080Snwhitehorn#-
3220080Snwhitehorn# Copyright (c) 2011 Nathan Whitehorn
4220080Snwhitehorn# All rights reserved.
5220080Snwhitehorn#
6220080Snwhitehorn# Redistribution and use in source and binary forms, with or without
7220080Snwhitehorn# modification, are permitted provided that the following conditions
8220080Snwhitehorn# are met:
9220080Snwhitehorn# 1. Redistributions of source code must retain the above copyright
10220080Snwhitehorn#    notice, this list of conditions and the following disclaimer.
11220080Snwhitehorn# 2. Redistributions in binary form must reproduce the above copyright
12220080Snwhitehorn#    notice, this list of conditions and the following disclaimer in the
13220080Snwhitehorn#    documentation and/or other materials provided with the distribution.
14220080Snwhitehorn#
15220080Snwhitehorn# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16220080Snwhitehorn# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17220080Snwhitehorn# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18220080Snwhitehorn# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19220080Snwhitehorn# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20220080Snwhitehorn# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21220080Snwhitehorn# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22220080Snwhitehorn# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23220080Snwhitehorn# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24220080Snwhitehorn# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25220080Snwhitehorn# SUCH DAMAGE.
26220080Snwhitehorn#
27220080Snwhitehorn# $FreeBSD: stable/11/usr.sbin/bsdinstall/scripts/mirrorselect 366259 2020-09-29 15:37:57Z zeising $
28220080Snwhitehorn
29220080Snwhitehorn: ${DIALOG_OK=0}
30220080Snwhitehorn: ${DIALOG_CANCEL=1}
31220080Snwhitehorn: ${DIALOG_HELP=2}
32220080Snwhitehorn: ${DIALOG_EXTRA=3}
33220080Snwhitehorn: ${DIALOG_ITEM_HELP=4}
34220080Snwhitehorn: ${DIALOG_ESC=255}
35220080Snwhitehorn
36220080Snwhitehornexec 3>&1
37220080SnwhitehornMIRROR=`dialog --backtitle "FreeBSD Installer" \
38220080Snwhitehorn    --title "Mirror Selection" --extra-button --extra-label "Other" \
39220080Snwhitehorn    --menu "Please select the site closest to you or \"other\" if you'd like to specify a different choice.  Also note that not every site listed here carries more than the base distribution kits. Only Primary sites are guaranteed to carry the full range of possible distributions. Select a site that's close!" \
40220080Snwhitehorn    0 0 0 \
41220080Snwhitehorn	ftp://ftp.freebsd.org	"Main Site"\
42220080Snwhitehorn	ftp://ftp.freebsd.org 	"IPv6 Main Site"\
43220080Snwhitehorn	ftp://ftp3.ie.freebsd.org 	"IPv6 Ireland"\
44220080Snwhitehorn	ftp://ftp2.jp.freebsd.org 	"IPv6 Japan"\
45225467Sbrueffer	ftp://ftp4.se.freebsd.org	"IPv6 Sweden"\
46220080Snwhitehorn	ftp://ftp4.us.freebsd.org 	"IPv6 USA"\
47220080Snwhitehorn	ftp://ftp1.freebsd.org 	"Primary"\
48220080Snwhitehorn	ftp://ftp2.freebsd.org 	"Primary #2"\
49220080Snwhitehorn	ftp://ftp3.freebsd.org 	"Primary #3"\
50220080Snwhitehorn	ftp://ftp4.freebsd.org 	"Primary #4"\
51220080Snwhitehorn	ftp://ftp5.freebsd.org 	"Primary #5"\
52220080Snwhitehorn	ftp://ftp6.freebsd.org 	"Primary #6"\
53220080Snwhitehorn	ftp://ftp7.freebsd.org 	"Primary #7"\
54220080Snwhitehorn	ftp://ftp10.freebsd.org 	"Primary #10"\
55220080Snwhitehorn	ftp://ftp11.freebsd.org 	"Primary #11"\
56220080Snwhitehorn	ftp://ftp12.freebsd.org 	"Primary #12"\
57220080Snwhitehorn	ftp://ftp13.freebsd.org 	"Primary #13"\
58220080Snwhitehorn	ftp://ftp14.freebsd.org 	"Primary #14"\
59220080Snwhitehorn	ftp://ftp.au.freebsd.org 	"Australia"\
60220080Snwhitehorn	ftp://ftp2.au.freebsd.org 	"Australia #2"\
61220080Snwhitehorn	ftp://ftp3.au.freebsd.org 	"Australia #3"\
62220080Snwhitehorn	ftp://ftp.at.freebsd.org 	"Austria"\
63220080Snwhitehorn	ftp://ftp2.br.freebsd.org 	"Brazil #2"\
64220080Snwhitehorn	ftp://ftp3.br.freebsd.org 	"Brazil #3"\
65220080Snwhitehorn	ftp://ftp4.br.freebsd.org 	"Brazil #4"\
66220080Snwhitehorn	ftp://ftp.cn.freebsd.org 	"China"\
67220080Snwhitehorn	ftp://ftp.cz.freebsd.org 	"Czech Republic"\
68220080Snwhitehorn	ftp://ftp.dk.freebsd.org 	"Denmark"\
69220080Snwhitehorn	ftp://ftp.fi.freebsd.org 	"Finland"\
70220080Snwhitehorn	ftp://ftp.fr.freebsd.org 	"France"\
71220080Snwhitehorn	ftp://ftp3.fr.freebsd.org 	"France #3"\
72235228Sroberto	ftp://ftp4.fr.freebsd.org 	"IPv6 France #4"\
73220080Snwhitehorn	ftp://ftp5.fr.freebsd.org 	"France #5"\
74220080Snwhitehorn	ftp://ftp6.fr.freebsd.org 	"France #6"\
75253543Sgavin	ftp://ftp7.fr.freebsd.org 	"France #7"\
76224656Sroberto	ftp://ftp8.fr.freebsd.org 	"IPv6 France #8"\
77220080Snwhitehorn	ftp://ftp.de.freebsd.org 	"Germany"\
78220080Snwhitehorn	ftp://ftp2.de.freebsd.org 	"Germany #2"\
79220080Snwhitehorn	ftp://ftp4.de.freebsd.org 	"Germany #4"\
80220080Snwhitehorn	ftp://ftp5.de.freebsd.org 	"Germany #5"\
81220080Snwhitehorn	ftp://ftp7.de.freebsd.org 	"Germany #7"\
82220080Snwhitehorn	ftp://ftp8.de.freebsd.org 	"Germany #8"\
83220080Snwhitehorn	ftp://ftp.gr.freebsd.org 	"Greece"\
84220080Snwhitehorn	ftp://ftp2.gr.freebsd.org 	"Greece #2"\
85220080Snwhitehorn	ftp://ftp3.ie.freebsd.org 	"Ireland #3"\
86220080Snwhitehorn	ftp://ftp.jp.freebsd.org 	"Japan"\
87220080Snwhitehorn	ftp://ftp2.jp.freebsd.org 	"Japan #2"\
88220080Snwhitehorn	ftp://ftp3.jp.freebsd.org 	"Japan #3"\
89220080Snwhitehorn	ftp://ftp4.jp.freebsd.org 	"Japan #4"\
90220080Snwhitehorn	ftp://ftp5.jp.freebsd.org 	"Japan #5"\
91220080Snwhitehorn	ftp://ftp6.jp.freebsd.org 	"Japan #6"\
92220080Snwhitehorn	ftp://ftp7.jp.freebsd.org 	"Japan #7"\
93220080Snwhitehorn	ftp://ftp8.jp.freebsd.org 	"Japan #8"\
94220080Snwhitehorn	ftp://ftp9.jp.freebsd.org 	"Japan #9"\
95220080Snwhitehorn	ftp://ftp.kr.freebsd.org 	"Korea"\
96220080Snwhitehorn	ftp://ftp2.kr.freebsd.org 	"Korea #2"\
97253543Sgavin	ftp://ftp.lv.freebsd.org 	"Latvia"\
98220080Snwhitehorn	ftp://ftp.nl.freebsd.org 	"Netherlands"\
99220080Snwhitehorn	ftp://ftp2.nl.freebsd.org 	"Netherlands #2"\
100253543Sgavin	ftp://ftp.nz.freebsd.org 	"New Zealand"\
101220080Snwhitehorn	ftp://ftp.no.freebsd.org 	"Norway"\
102220080Snwhitehorn	ftp://ftp.pl.freebsd.org 	"Poland"\
103220080Snwhitehorn	ftp://ftp.ru.freebsd.org 	"Russia"\
104220080Snwhitehorn	ftp://ftp2.ru.freebsd.org 	"Russia #2"\
105253543Sgavin	ftp://ftp5.ru.freebsd.org 	"Russia #5"\
106253543Sgavin	ftp://ftp6.ru.freebsd.org 	"Russia #6"\
107220080Snwhitehorn	ftp://ftp.sk.freebsd.org 	"Slovak Republic"\
108253543Sgavin	ftp://ftp2.sk.freebsd.org 	"Slovak Republic #2"\
109220080Snwhitehorn	ftp://ftp.si.freebsd.org 	"Slovenia"\
110220080Snwhitehorn	ftp://ftp.za.freebsd.org 	"South Africa"\
111220080Snwhitehorn	ftp://ftp2.za.freebsd.org 	"South Africa #2"\
112220080Snwhitehorn	ftp://ftp4.za.freebsd.org 	"South Africa #4"\
113220080Snwhitehorn	ftp://ftp.se.freebsd.org 	"Sweden"\
114220080Snwhitehorn	ftp://ftp4.se.freebsd.org 	"Sweden #4"\
115220080Snwhitehorn	ftp://ftp.ch.freebsd.org 	"Switzerland"\
116220080Snwhitehorn	ftp://ftp.tw.freebsd.org 	"Taiwan"\
117220080Snwhitehorn	ftp://ftp2.tw.freebsd.org 	"Taiwan #2"\
118220080Snwhitehorn	ftp://ftp3.tw.freebsd.org 	"Taiwan #3"\
119220080Snwhitehorn	ftp://ftp4.tw.freebsd.org 	"Taiwan #4"\
120220080Snwhitehorn	ftp://ftp6.tw.freebsd.org 	"Taiwan #6"\
121220080Snwhitehorn	ftp://ftp11.tw.freebsd.org 	"Taiwan #11"\
122220080Snwhitehorn	ftp://ftp.uk.freebsd.org 	"UK"\
123220080Snwhitehorn	ftp://ftp2.uk.freebsd.org 	"UK #2"\
124220080Snwhitehorn	ftp://ftp3.uk.freebsd.org 	"UK #3"\
125220080Snwhitehorn	ftp://ftp4.uk.freebsd.org 	"UK #4"\
126220080Snwhitehorn	ftp://ftp5.uk.freebsd.org 	"UK #5"\
127220080Snwhitehorn	ftp://ftp.ua.freebsd.org 	"Ukraine"\
128220080Snwhitehorn	ftp://ftp7.ua.freebsd.org 	"Ukraine #7"\
129220080Snwhitehorn	ftp://ftp1.us.freebsd.org 	"USA #1"\
130220080Snwhitehorn	ftp://ftp2.us.freebsd.org 	"USA #2"\
131220080Snwhitehorn	ftp://ftp3.us.freebsd.org 	"USA #3"\
132220080Snwhitehorn	ftp://ftp4.us.freebsd.org 	"USA #4"\
133220080Snwhitehorn	ftp://ftp5.us.freebsd.org 	"USA #5"\
134220080Snwhitehorn	ftp://ftp6.us.freebsd.org 	"USA #6"\
135220080Snwhitehorn	ftp://ftp8.us.freebsd.org 	"USA #8"\
136220080Snwhitehorn	ftp://ftp10.us.freebsd.org 	"USA #10"\
137220080Snwhitehorn	ftp://ftp11.us.freebsd.org 	"USA #11"\
138220080Snwhitehorn	ftp://ftp13.us.freebsd.org 	"USA #13"\
139220080Snwhitehorn	ftp://ftp14.us.freebsd.org 	"USA #14"\
140220080Snwhitehorn	ftp://ftp15.us.freebsd.org 	"USA #15"\
141220080Snwhitehorn    2>&1 1>&3`
142220080SnwhitehornMIRROR_BUTTON=$?
143220080Snwhitehornexec 3>&-
144220080Snwhitehorn
145244057Sgjb_UNAME_R=`uname -r`
146269074Sdes_UNAME_R=${_UNAME_R%-p*}
147220080Snwhitehorn
148244057Sgjbcase ${_UNAME_R} in
149254265Sgjb	*-CURRENT|*-STABLE|*-PRERELEASE)
150244057Sgjb		RELDIR="snapshots"
151244057Sgjb		;;
152244057Sgjb	*)
153244057Sgjb		RELDIR="releases"
154244057Sgjb		;;
155244057Sgjbesac
156244057Sgjb
157244057SgjbBSDINSTALL_DISTSITE="$MIRROR/pub/FreeBSD/${RELDIR}/`uname -m`/`uname -p`/${_UNAME_R}"
158244057Sgjb
159220080Snwhitehorncase $MIRROR_BUTTON in
160220080Snwhitehorn$DIALOG_CANCEL)
161220080Snwhitehorn	exit 1
162220080Snwhitehorn	;;
163220080Snwhitehorn$DIALOG_OK)
164220080Snwhitehorn	;;
165220080Snwhitehorn$DIALOG_EXTRA)
166220080Snwhitehorn	exec 3>&1
167220080Snwhitehorn	BSDINSTALL_DISTSITE=`dialog --backtitle "FreeBSD Installer" \
168220080Snwhitehorn	    --title "Mirror Selection" \
169220080Snwhitehorn	    --inputbox "Please enter the URL to an alternate FreeBSD mirror:" \
170220080Snwhitehorn	    0 0 "$BSDINSTALL_DISTSITE" 2>&1 1>&3`
171220080Snwhitehorn	MIRROR_BUTTON=$?
172220080Snwhitehorn	exec 3>&-
173220080Snwhitehorn	test $MIRROR_BUTTON -eq 0 || exec $0 $@
174220080Snwhitehorn	;;
175220080Snwhitehornesac
176220080Snwhitehorn
177220080Snwhitehornexport BSDINSTALL_DISTSITE
178220080Snwhitehornecho $BSDINSTALL_DISTSITE >&2
179