download with aria2 if available else wget
This commit is contained in:
parent
2177830173
commit
4aaac3f394
|
@ -8,8 +8,7 @@ function main() {
|
||||||
|
|
||||||
setup_log "================| script executed |================"
|
setup_log "================| script executed |================"
|
||||||
|
|
||||||
#make sure aria2c and wine package is already installed
|
#make sure wine package is already installed
|
||||||
# package_installed aria2c
|
|
||||||
package_installed wine
|
package_installed wine
|
||||||
package_installed md5sum
|
package_installed md5sum
|
||||||
|
|
||||||
|
@ -83,4 +82,4 @@ function install_illustratorCC() {
|
||||||
|
|
||||||
check_arg $@
|
check_arg $@
|
||||||
save_paths
|
save_paths
|
||||||
main
|
main
|
||||||
|
|
|
@ -102,17 +102,27 @@ function rmdir_if_exist() {
|
||||||
show_message "create\033[0;36m $1\e[0m directory..."
|
show_message "create\033[0;36m $1\e[0m directory..."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#has tow mode [pkgName] [mode=summary]
|
||||||
function package_installed() {
|
function package_installed() {
|
||||||
which $1 &> /dev/null
|
which $1 &> /dev/null
|
||||||
local pkginstalled="$?"
|
local pkginstalled="$?"
|
||||||
if [ "$pkginstalled" -eq 0 ];then
|
|
||||||
show_message "package\033[1;36m $1\e[0m is installed..."
|
if [ "$2" == "summary" ];then
|
||||||
else
|
if [ "$pkginstalled" -eq 0 ];then
|
||||||
warning "package\033[1;33m $1\e[0m is not installed.\nplease make sure it's already installed"
|
echo "true"
|
||||||
ask_question "would you continue?" "N"
|
else
|
||||||
if [ "$question_result" == "no" ];then
|
echo "false"
|
||||||
echo "exit..."
|
fi
|
||||||
exit 5
|
else
|
||||||
|
if [ "$pkginstalled" -eq 0 ];then
|
||||||
|
show_message "package\033[1;36m $1\e[0m is installed..."
|
||||||
|
else
|
||||||
|
warning "package\033[1;33m $1\e[0m is not installed.\nplease make sure it's already installed"
|
||||||
|
ask_question "would you continue?" "N"
|
||||||
|
if [ "$question_result" == "no" ];then
|
||||||
|
echo "exit..."
|
||||||
|
exit 5
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -169,7 +179,7 @@ function set_dark_mod() {
|
||||||
function download_component() {
|
function download_component() {
|
||||||
local tout=0
|
local tout=0
|
||||||
while true;do
|
while true;do
|
||||||
if [ $tout -ge 2 ];then
|
if [ $tout -ge 3 ];then
|
||||||
error "sorry something went wrong during download $4"
|
error "sorry something went wrong during download $4"
|
||||||
fi
|
fi
|
||||||
if [ -f $1 ];then
|
if [ -f $1 ];then
|
||||||
|
@ -183,10 +193,21 @@ function download_component() {
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
show_message "downloading $4 ..."
|
show_message "downloading $4 ..."
|
||||||
# aria2c -c -x 8 -d $CACHE_PATH -o $4 $3
|
pkgres=$(package_installed aria2c "summary")
|
||||||
wget $3 -P $CACHE_PATH
|
if [ "$pkgres" == "true" ];then
|
||||||
if [ $? -eq 0 ];then
|
show_message "using aria2c to download $4"
|
||||||
notify-send "$4 download completed" -i "download"
|
aria2c -c -x 8 -d "$CACHE_PATH" -o $4 $3
|
||||||
|
|
||||||
|
if [ $? -eq 0 ];then
|
||||||
|
notify-send "$4 download completed" -i "download"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
show_message "using wget to download $4"
|
||||||
|
wget "$3" -P "$CACHE_PATH"
|
||||||
|
|
||||||
|
if [ $? -eq 0 ];then
|
||||||
|
notify-send "$4 download completed" -i "download"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
((tout++))
|
((tout++))
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue