using aria2 if available else using wget to download files
This commit is contained in:
parent
0ca346c398
commit
df99154c49
|
@ -10,8 +10,7 @@ function main() {
|
||||||
|
|
||||||
is64
|
is64
|
||||||
|
|
||||||
#make sure aria2c and wine package is already installed
|
#make sure wine and winetricks package is already installed
|
||||||
# package_installed aria2c
|
|
||||||
package_installed wine
|
package_installed wine
|
||||||
package_installed md5sum
|
package_installed md5sum
|
||||||
package_installed winetricks
|
package_installed winetricks
|
||||||
|
|
|
@ -1,15 +1,25 @@
|
||||||
|
|
||||||
|
#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
|
||||||
|
if [ "$pkginstalled" -eq 0 ];then
|
||||||
|
echo "true"
|
||||||
|
else
|
||||||
|
echo "false"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
warning "package\033[1;33m $1\e[0m is not installed.\nplease make sure it's already installed"
|
if [ "$pkginstalled" -eq 0 ];then
|
||||||
ask_question "would you continue?" "N"
|
show_message "package\033[1;36m $1\e[0m is installed..."
|
||||||
if [ "$question_result" == "no" ];then
|
else
|
||||||
echo "exit..."
|
warning "package\033[1;33m $1\e[0m is not installed.\nplease make sure it's already installed"
|
||||||
exit 5
|
ask_question "would you continue?" "N"
|
||||||
|
if [ "$question_result" == "no" ];then
|
||||||
|
echo "exit..."
|
||||||
|
exit 5
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -131,8 +141,8 @@ function replacement() {
|
||||||
function install_photoshopSE() {
|
function install_photoshopSE() {
|
||||||
local filename="photoshopCC-V19.1.6-2018x64.tgz"
|
local filename="photoshopCC-V19.1.6-2018x64.tgz"
|
||||||
local filemd5="b63f6ed690343ee12b6195424f94c33f"
|
local filemd5="b63f6ed690343ee12b6195424f94c33f"
|
||||||
local filelink="https://victor.poshtiban.io/p/gictor/photoshopCC/photoshopCC-V19.1.6-2018x64.tgz"
|
# local filelink="https://victor.poshtiban.io/p/gictor/photoshopCC/photoshopCC-V19.1.6-2018x64.tgz"
|
||||||
# local filelink="http://127.0.0.1:8080/photoshopCC-V19.1.6-2018x64.tgz"
|
local filelink="http://127.0.0.1:8080/photoshopCC-V19.1.6-2018x64.tgz"
|
||||||
local filepath="$CACHE_PATH/$filename"
|
local filepath="$CACHE_PATH/$filename"
|
||||||
|
|
||||||
download_component $filepath $filemd5 $filelink $filename
|
download_component $filepath $filemd5 $filelink $filename
|
||||||
|
@ -204,7 +214,7 @@ function export_var() {
|
||||||
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
|
||||||
|
@ -218,10 +228,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
|
||||||
|
|
|
@ -51,8 +51,9 @@ main() {
|
||||||
ask_question "would you delete cache directory?" "N"
|
ask_question "would you delete cache directory?" "N"
|
||||||
if [ "$result" == "yes" ];then
|
if [ "$result" == "yes" ];then
|
||||||
rm -rf "$CACHE_PATH" || error2 "couldn't remove cache directory"
|
rm -rf "$CACHE_PATH" || error2 "couldn't remove cache directory"
|
||||||
|
show_message2 "cache directory removed."
|
||||||
else
|
else
|
||||||
echo "nice, you can copy component data and use them later for photoshop installation"
|
echo "nice, you can use downloaded data later for photoshop installation"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "cache directory Not Found!"
|
echo "cache directory Not Found!"
|
||||||
|
|
Loading…
Reference in New Issue