Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 4322842d40
Fetching contributors…

Cannot retrieve contributors at this time

321 lines (245 sloc) 10.133 kb
############################################################
# #
# This code is written for Lunar Linux, see #
# http://lunar-linux.org #
# #
############################################################
# #
# $MENUS/download #
# includes menu for download options in lunar #
# #
# 20020714 #
# #
############################################################
# #
# Portions Copyrighted Kyle Sallee under GPL #
# Copyrighted Kagan Kongar 2002 under GPLv2 #
# proxy portions Copyright 2002 by rodzilla #
# #
############################################################
inputbox() {
$DIALOG --nocancel \
--inputbox \
"$1" 0 0 "$2"
}
configure_proxy() {
HTTP_PROMPT="Please enter the HTTP proxy server. \
Example: http://192.168.1.1:8080/"
FTP_PROMPT="Please enter the FTP proxy server. \
Example: http://192.168.1.1:8080/"
NO_PROMPT="Please enter all domains/ip addresses \
(comma-separated) proxy should NOT be used for: \
Example: .mit.edu,mysite.com"
HPROXY=`inputbox "$HTTP_PROMPT" "$http_proxy"` &&
[ "$ftp_proxy" == "" ] && ftp_proxy="$HPROXY"
FPROXY=`inputbox "$FTP_PROMPT" "$ftp_proxy"` &&
NPROXY=`inputbox "$NO_PROMPT" "$no_proxy"`
}
confirm_proxy_settings() {
confirm() {
$DIALOG $2 --nocancel --yesno "$1" 8 50
}
FINISHED=NO
while [ "$FINISHED" != "YES" ] ; do
PROMPT="Are these settings correct?"
PROMPT="$PROMPT\nHTTP Proxy: $HPROXY"
PROMPT="$PROMPT\n FTP Proxy: $FPROXY"
PROMPT="$PROMPT\n No Proxy: $NPROXY"
if confirm "$PROMPT" "--cr-wrap" ; then
FINISHED=YES
else
configure_proxy
FINISHED=NO
fi
done
set_local_config "http_proxy" "$HPROXY"
set_local_config "ftp_proxy" "$FPROXY"
set_local_config "no_proxy" "$NPROXY"
}
proxy_exit_message() {
$DIALOG --cr-wrap \
--title "Lunar Proxy Settings Complete" \
--msgbox \
"Your proxy configuration has been saved.
Please note that these proxy settings will only be used by
Lunar (wget) and possibly some other command-line utilities.
You will still have to configure proxy settings in your
favorite web browser, etc..." 12 65
}
proxy_menu()
{
configure_proxy
confirm_proxy_settings
proxy_exit_message
}
download_options() {
set_download_rate() {
PROMPT="Please enter the maximum bytes per second for lgeting. \
Example: enter 8000 for downloading no faster then \
8 kBps, 80k for 80 kBps, or 1m for 1mBps"
if DOWNLOAD_RATE=`$DIALOG --title "Download Rate" \
--ok-label "Commit" \
--inputbox \
"$PROMPT" \
0 0 "$DOWNLOAD_RATE"`
then
set_local_config "DOWNLOAD_RATE" "$DOWNLOAD_RATE"
fi
}
set_repository_threshold() {
PROMPT="Please enter the minimum time between repository updates in minutes, \
enter 0 for no threshold. Default threshold is 10 minutes"
if REPOSITORY_THRESHOLD=`$DIALOG --title "Repository threshold" \
--ok-label "Commit" \
--inputbox \
"$PROMPT" \
0 0 "$REPOSITORY_THRESHOLD"`
then
set_local_config "REPOSITORY_THRESHOLD" "$REPOSITORY_THRESHOLD"
fi
}
set_ftp_active(){
PROMPT="Please select the connection type for ftp downloads.
Passive ftp is the safe and default option. However, if you
are behind a weird firewall, or if you are experiencing
download problems, select active ftp option.
This option can also be set per module basis. Add
FTP_ACTIVE=on in DETAILS file :=) or vice-versa."
FTP_ACTIVE=${FTP_ACTIVE:-off}
FTP_PASSIVE=${FTP_PASSIVE:-on}
[ "$FTP_ACTIVE" == "on" ] &&
FTP_PASSIVE=off ||
FTP_PASSIVE=on
FTP_CONNECTION=`$DIALOG --title "Ftp Connection" \
--ok-label "Commit" \
--radiolist \
"$PROMPT" \
0 0 0 \
"Passive" "normal behaviour" $FTP_PASSIVE \
"Active" "behind a firewall" $FTP_ACTIVE`
case $FTP_CONNECTION in
Active) FTP_ACTIVE=on
;;
Passive) FTP_ACTIVE=off
;;
esac
set_local_config "FTP_ACTIVE" "$FTP_ACTIVE"
}
set_partial_downloads(){
PROMPT="Please enable/disable the partial download option.
This is the -c option of wget. Enable is default
and works fine on almost all cases.
This option can also be set per module basis. Add
CONTINUE=off in DETAILS file :=) or vice-versa."
CONTINUE=${CONTINUE:-on}
PARTIAL=`$DIALOG --title "Partial Downloads" \
--ok-label "Commit" \
--checklist \
"$PROMPT" \
0 0 0 \
"Enable" "partial downloads" $CONTINUE`
#lets get rid of " and spaces in the variable
PARTIAL=`echo $PARTIAL | sed s/\"//g | tr -d " "`
if [ "$PARTIAL" == "Enable" ] ; then
set_local_config "CONTINUE" "on"
else
set_local_config "CONTINUE" "off"
fi
}
set_cache_usage(){
PROMPT="Please enable/disable the cache usage.
This options controls the use of cache for http downloads.
Default is ON. If this option is set to off, wget will send
a Pragma: no-cache directive to http server.
This option can also be set per module basis. Add
USE_CACHE=off in DETAILS file :=) or vice-versa."
USE_CACHE=${USE_CACHE:-on}
CACHE=`$DIALOG --title "Cache Usage" \
--ok-label "Commit" \
--checklist \
"$PROMPT" \
0 0 0 \
"Enable" "http cache usage" $USE_CACHE`
#lets get rid of " and spaces in the variable
CACHE=`echo $CACHE | sed s/\"//g | tr -d " "`
if [ "$CACHE" == "Enable" ] ; then
set_local_config "USE_CACHE" "on"
else
set_local_config "USE_CACHE" "off"
fi
}
set_retries() {
PROMPT="Please enter the maximum number of retries.
Example: enter 3 for retrying the download three times.
The default value (if unset) is 5. Enter 0 for infinite
number of retries.
This option can also be set per module basis. Add
NUM_RETRY=<n> in DETAILS file :=)"
NUM_RETRY=${NUM_RETRY:-5}
if NUM_RETRY=`$DIALOG --title "Number of Retries" \
--ok-label "Commit" \
--inputbox \
"$PROMPT" \
0 0 "$NUM_RETRY"`
then
set_local_config "NUM_RETRY" "$NUM_RETRY"
fi
}
set_exhaustive() {
PROMPT="If you want, lget may try downloading the file from all
available mirrors, instead of the one you select from the mirror
menu. All mirrors will be tried until the file is found.
This is not recommended for normal downloads, broken downloads
should be reported to maintainer@lunar-linux.org.
"
EXHAUSTIVE=${EXHAUSTIVE:-off}
EXHAUSTIVE=`$DIALOG --title "Exhaustive mirror testing: " \
--ok-label "Commit" \
--checklist \
"$PROMPT" \
0 0 0 \
"Enable" "exhaustive mirror testing" $EXHAUSTIVE`
EXHAUSTIVE=`echo $EXHAUSTIVE | sed s/\"//g | tr -d " "`
if [ "$EXHAUSTIVE" == "Enable" ] ; then
set_local_config "EXHAUSTIVE" "on"
else
set_local_config "EXHAUSTIVE" "off"
fi
}
while
A_HELP="Active or passive connections while using ftp"
C_HELP="Continue to get or re-get the partial downloads"
N_HELP="How many times will wget try to download the file?"
H_HELP="Cache usage for http downloads"
R_HELP="Per process download rate"
P_HELP="Proxy Settings"
E_HELP="Test all mirrors available on download"
T_HELP="Repository update threshold time"
COMMAND=`$DIALOG --title "Download Options" \
--item-help \
--ok-label "Select" \
--cancel-label "Exit" \
--menu \
"" \
0 40 8 \
"A" "Ftp Active/Passive" "$A_HELP" \
"C" "Partial Downloads" "$C_HELP" \
"H" "Cache Usage" "$H_HELP" \
"N" "Number of Retries" "$N_HELP" \
"P" "Proxies" "$P_HELP" \
"R" "Download Rate" "$R_HELP" \
"E" "Exhaustive mirrors" "$E_HELP" \
"T" "Repository update threshold" "$T_HELP"`
do
case $COMMAND in
A) set_ftp_active ;;
C) set_partial_downloads ;;
H) set_cache_usage ;;
N) set_retries ;;
P) proxy_menu ;;
R) set_download_rate ;;
E) set_exhaustive ;;
T) set_repository_threshold ;;
esac
done
}
Jump to Line
Something went wrong with that request. Please try again.