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
|
||||
|
||||
#make sure aria2c and wine package is already installed
|
||||
# package_installed aria2c
|
||||
#make sure wine and winetricks package is already installed
|
||||
package_installed wine
|
||||
package_installed md5sum
|
||||
package_installed winetricks
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
|
||||
#has tow mode [pkgName] [mode=summary]
|
||||
function package_installed() {
|
||||
which $1 &> /dev/null
|
||||
local pkginstalled="$?"
|
||||
|
||||
if [ "$2" == "summary" ];then
|
||||
if [ "$pkginstalled" -eq 0 ];then
|
||||
echo "true"
|
||||
else
|
||||
echo "false"
|
||||
fi
|
||||
else
|
||||
if [ "$pkginstalled" -eq 0 ];then
|
||||
show_message "package\033[1;36m $1\e[0m is installed..."
|
||||
else
|
||||
|
@ -12,6 +21,7 @@ function package_installed() {
|
|||
exit 5
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function setup_log() {
|
||||
|
@ -131,8 +141,8 @@ function replacement() {
|
|||
function install_photoshopSE() {
|
||||
local filename="photoshopCC-V19.1.6-2018x64.tgz"
|
||||
local filemd5="b63f6ed690343ee12b6195424f94c33f"
|
||||
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="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 filepath="$CACHE_PATH/$filename"
|
||||
|
||||
download_component $filepath $filemd5 $filelink $filename
|
||||
|
@ -204,7 +214,7 @@ function export_var() {
|
|||
function download_component() {
|
||||
local tout=0
|
||||
while true;do
|
||||
if [ $tout -ge 2 ];then
|
||||
if [ $tout -ge 3 ];then
|
||||
error "sorry something went wrong during download $4"
|
||||
fi
|
||||
if [ -f $1 ];then
|
||||
|
@ -218,11 +228,22 @@ function download_component() {
|
|||
fi
|
||||
else
|
||||
show_message "downloading $4 ..."
|
||||
# aria2c -c -x 8 -d $CACHE_PATH -o $4 $3
|
||||
wget $3 -P $CACHE_PATH
|
||||
pkgres=$(package_installed aria2c "summary")
|
||||
if [ "$pkgres" == "true" ];then
|
||||
show_message "using aria2c to download $4"
|
||||
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
|
||||
((tout++))
|
||||
fi
|
||||
done
|
||||
|
|
|
@ -51,8 +51,9 @@ main() {
|
|||
ask_question "would you delete cache directory?" "N"
|
||||
if [ "$result" == "yes" ];then
|
||||
rm -rf "$CACHE_PATH" || error2 "couldn't remove cache directory"
|
||||
show_message2 "cache directory removed."
|
||||
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
|
||||
else
|
||||
echo "cache directory Not Found!"
|
||||
|
|
Loading…
Reference in New Issue