Remove wget dependency
apt-cyg has had a long standing circular dependency with wget. This is because
Base Cygwin does not include wget or curl. I have mentioned before workarounds
to this
41e1d91172
However none were ideal. I have since discovered lynx, which can be used in a
pinch to download files
http://unix.stackexchange.com/a/83987
lynx has these features
- pure command line, unlike setup-x86_64
- works with "https://" URLs, unlike /dev/tcp
- comes with Base Cygwin, unlike wget/curl
If wget is not installed, lynx will be used as a fallback with a warning
printed.
This commit is contained in:
parent
aa4a288c33
commit
61ae91a00a
34
apt-cyg
34
apt-cyg
|
@ -23,15 +23,19 @@
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
# THE SOFTWARE.
|
# THE SOFTWARE.
|
||||||
|
|
||||||
# this script requires some packages
|
|
||||||
if ! type awk bzip2 tar wget xz &>/dev/null
|
|
||||||
then
|
|
||||||
echo You must install wget, tar, gawk, xz and bzip2 to use apt-cyg.
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
ARCH=${HOSTTYPE/i6/x}
|
ARCH=${HOSTTYPE/i6/x}
|
||||||
|
|
||||||
|
function wget {
|
||||||
|
if command wget -h &>/dev/null
|
||||||
|
then
|
||||||
|
command wget "$@"
|
||||||
|
else
|
||||||
|
warn wget is not installed, using lynx as fallback
|
||||||
|
set "${*: -1}"
|
||||||
|
lynx -source "$1" > "${1##*/}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function usage {
|
function usage {
|
||||||
hr '
|
hr '
|
||||||
usage: apt-cyg [command] [options] [packages]
|
usage: apt-cyg [command] [options] [packages]
|
||||||
|
@ -129,10 +133,14 @@ function check-packages {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function warn {
|
function info {
|
||||||
printf '\e[36m%s\e[m\n' "$*" >&2
|
printf '\e[36m%s\e[m\n' "$*" >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function warn {
|
||||||
|
printf '\e[1;31m%s\e[m\n' "$*" >&2
|
||||||
|
}
|
||||||
|
|
||||||
function apt-update {
|
function apt-update {
|
||||||
if find-workspace
|
if find-workspace
|
||||||
then
|
then
|
||||||
|
@ -162,14 +170,14 @@ function apt-list {
|
||||||
for pkg in "${pks[@]}"
|
for pkg in "${pks[@]}"
|
||||||
do
|
do
|
||||||
(( sbq++ )) && echo
|
(( sbq++ )) && echo
|
||||||
warn Searching for installed packages matching "$pkg":
|
info Searching for installed packages matching "$pkg":
|
||||||
awk 'NR>1 && $1~ENVIRON["pkg"] && $0=$1' /etc/setup/installed.db
|
awk 'NR>1 && $1~ENVIRON["pkg"] && $0=$1' /etc/setup/installed.db
|
||||||
echo
|
echo
|
||||||
warn Searching for installable packages matching "$pkg":
|
info Searching for installable packages matching "$pkg":
|
||||||
awk '$1 ~ ENVIRON["pkg"] && $0 = $1' RS='\n\n@ ' FS='\n' setup.ini
|
awk '$1 ~ ENVIRON["pkg"] && $0 = $1' RS='\n\n@ ' FS='\n' setup.ini
|
||||||
done
|
done
|
||||||
(( sbq )) && return
|
(( sbq )) && return
|
||||||
warn The following packages are installed:
|
info The following packages are installed:
|
||||||
awk 'NR>1 && $0=$1' /etc/setup/installed.db
|
awk 'NR>1 && $0=$1' /etc/setup/installed.db
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,7 +436,7 @@ function apt-install {
|
||||||
fi
|
fi
|
||||||
if (( wr ))
|
if (( wr ))
|
||||||
then
|
then
|
||||||
echo 'Warning: some required packages did not install, continuing'
|
info some required packages did not install, continuing
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# run all postinstall scripts
|
# run all postinstall scripts
|
||||||
|
@ -564,7 +572,7 @@ do
|
||||||
fi
|
fi
|
||||||
shift
|
shift
|
||||||
else
|
else
|
||||||
warn No file name provided, ignoring $1
|
info No file name provided, ignoring $1
|
||||||
fi
|
fi
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in New Issue