Some improvements to installoptionalpackage :
* retry failed downloads a few times before giving up and exiting * detect and exit upon failed archive extraction * more verbose and explanatory message for re-installing packages Fixes #6426 and resolves a TODO. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37913 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
d6734c083a
commit
e277f0be57
@ -146,17 +146,23 @@ function InstallOptionalHaikuImagePackage()
|
|||||||
if ! [ -f \$archiveFile ] ; then
|
if ! [ -f \$archiveFile ] ; then
|
||||||
echo "Downloading \$3 ..."
|
echo "Downloading \$3 ..."
|
||||||
# TODO : add some error handling for downloads
|
# TODO : add some error handling for downloads
|
||||||
# local attempt=1
|
local attempt=1
|
||||||
# while [ `wget -nv \$3 2>&1 > /dev/null ; echo \$?` -ne 0 -a $attempt -lt 5 ]; do
|
while [ \`wget -nv \$3 ; echo \$? \` -ne 0 ]; do
|
||||||
# echo "Download attempt #\$attempt failed. Retrying ..."
|
if [ \$attempt -eq 5 ]; then
|
||||||
# rm \$archiveFile
|
break
|
||||||
# (( attempt++ ))
|
fi
|
||||||
# done
|
(( attempt++ ))
|
||||||
# if [ $attempt -ge 5 ]; then
|
echo "Download attempt #\$attempt failed. Retrying ..."
|
||||||
# echo "Max download retries exceeded. Halting installation."
|
if [ -e \$archiveFile ]; then
|
||||||
# exit 1
|
rm \$archiveFile
|
||||||
# fi
|
fi
|
||||||
wget -nv \$3
|
done
|
||||||
|
if [ \$attempt -ge 5 ]; then
|
||||||
|
if [ -e \$archiveFile ]; then
|
||||||
|
rm \$archiveFile
|
||||||
|
fi
|
||||||
|
Exit "Max download retries exceeded. Halting installation."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local dirTokens='/boot'
|
local dirTokens='/boot'
|
||||||
@ -177,12 +183,18 @@ function InstallOptionalHaikuImagePackage()
|
|||||||
echo "Extracting \$archiveFile ..."
|
echo "Extracting \$archiveFile ..."
|
||||||
extractDir="\${dirTokens}"
|
extractDir="\${dirTokens}"
|
||||||
|
|
||||||
|
local errorMessage="
|
||||||
|
...Failed while extracting \$archiveFile
|
||||||
|
You may need to manually clean up the partially extracted files.
|
||||||
|
"
|
||||||
case "\$archiveFile" in
|
case "\$archiveFile" in
|
||||||
*.zip)
|
*.zip)
|
||||||
unzip -q -o -d "\$extractDir" "\$archiveFile"
|
unzip -q -o -d "\$extractDir" "\$archiveFile" \
|
||||||
|
|| Exit "\$errorMessage"
|
||||||
;;
|
;;
|
||||||
*.tgz|*.tar.gz)
|
*.tgz|*.tar.gz)
|
||||||
tar -C "\$extractDir" -xf "\$archiveFile"
|
tar -C "\$extractDir" -xf "\$archiveFile" \
|
||||||
|
|| Exit "\$errorMessage"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unhandled archive extension in InstallOptionalHaikuImagePackage()"
|
echo "Unhandled archive extension in InstallOptionalHaikuImagePackage()"
|
||||||
@ -567,6 +579,10 @@ function AddPackages()
|
|||||||
rm "${tmpDir}/optpkg.jam"
|
rm "${tmpDir}/optpkg.jam"
|
||||||
CreateInstallerScript
|
CreateInstallerScript
|
||||||
sh ${tmpDir}/install-optpkg.sh
|
sh ${tmpDir}/install-optpkg.sh
|
||||||
|
exitcode=$?
|
||||||
|
if [ $exitcode -gt 0 ]; then
|
||||||
|
ErrorExit "... something went wrong when installing packages."
|
||||||
|
fi
|
||||||
rm ${tmpDir}/install-optpkg.sh
|
rm ${tmpDir}/install-optpkg.sh
|
||||||
|
|
||||||
# update files to account for the newly installed packages
|
# update files to account for the newly installed packages
|
||||||
@ -606,7 +622,12 @@ function BuildFinalListOfPackagesToInstall()
|
|||||||
|
|
||||||
if ! [ ${#packagesToInstall} -gt 1 ]; then
|
if ! [ ${#packagesToInstall} -gt 1 ]; then
|
||||||
echo "... no packages need to be installed."
|
echo "... no packages need to be installed."
|
||||||
echo "If you wish to re-install a package, edit $installedPackagesFile"
|
echo ""
|
||||||
|
echo "If you wish to re-install a package, run these two commands"
|
||||||
|
echo " rm ${baseDir}/OptionalPackageNames"
|
||||||
|
echo " open $installedPackagesFile"
|
||||||
|
echo "and delete the line containing the package name(s)."
|
||||||
|
echo ""
|
||||||
proceedWithInstallation=false
|
proceedWithInstallation=false
|
||||||
fi
|
fi
|
||||||
if ! $proceedWithInstallation ; then
|
if ! $proceedWithInstallation ; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user