; $VER: uhcinstall 1.25 (20.8.2018) UHCTools Install-script ; This script will setup the needed ENV-variables and download ; and extract the UHC amigabin_xxx.lha file. Failat 21 Set UHCMIRROR0 "http://uhc.megaburken.net/" Set UHCMIRROR1 "http://uhc.driar.se/" Set UHCMIRROR2 "http://uhc.a1k.org/" Set UHCMIRROR3 "http://uhc.fidonet.io/" Set UHCMIRROR4 "http://uhc.joacimmelin.se/" Set CURRENTPATH "`cd`" ; This will be the directory aget or wget downloads uhctools_???.lha to. As a ; side effect, it will find aget in this directory when launched from the ; bootstrap installation script. ; The next time the bootstrap archive is updated on aminet, the bootstrap ; installation script will cd to T: instead so this can then be removed cd T: Version >NIL: exec.library 50 IF WARN Set OSTAG "os3" SKIP OSDETECTDONE ENDIF IF EXISTS SYS:MorphOS Set OSTAG "mos" SKIP OSDETECTDONE ENDIF Version >NIL: newlib.library IF NOT WARN Set OSTAG "os4" SKIP OSDETECTDONE ENDIF Version >NIL: aros.library IF NOT WARN Set OSTAG "aros-i386" SKIP OSDETECTDONE ENDIF Echo "*nArch not detected, aborting!" Skip CLEANUP LAB OSDETECTDONE Set UHCARCHIVE "uhctools_${OSTAG}.lha" Echo "This script will download and extract the file ${UHCARCHIVE} to the" Echo "directory SYS:UHC/. It will also setup the required ENV-variables that" Ask "allows you to update the tools in the future. Proceed (y/n)?" IF NOT WARN Echo "*nAborting...*n" Skip CLEANUP ENDIF Echo "" Which >NIL: aget IF WARN Which >NIL: wget IF WARN Echo "*nCouldn't find aget or wget on your system so the installation can't continue." Skip CLEANUP ELSE Set UHCDLPROGRAM "wget" ENDIF ELSE Set UHCDLPROGRAM "aget" ENDIF Which >NIL: lha IF WARN Echo "*nCouldn't find lha on your system so the installation can't continue." Skip CLEANUP ENDIF Set UHCCOUNTER 0 LAB MIRRORLOOP Set UHCROOTURL "`Get "UHCMIRROR$UHCCOUNTER"`" Echo "Fetching ${UHCROOTURL}${UHCARCHIVE}" IF "$UHCDLPROGRAM" EQ "aget" Version >NIL: "`which aget`" VERSION 0 REVISION 32 IF WARN aget QUIET "${UHCROOTURL}${UHCARCHIVE}" T: ELSE aget TIMEOUTSECONDS=10 QUIET "${UHCROOTURL}${UHCARCHIVE}" T: ENDIF ELSE Set PREVDIR="`cd`" cd T: stack 65536 wget --quiet "${UHCROOTURL}${UHCARCHIVE}" cd "$PREVDIR" Unset PREVDIR ENDIF IF NOT EXISTS "T:${UHCARCHIVE}" Set UHCCOUNTER "`Eval "$UHCCOUNTER + 1"`" Get >NIL: "UHCMIRROR$UHCCOUNTER" IF WARN Echo "Couldn't download the needed file, all mirrors appears to be down!*n*nTry again later!*n" Skip CLEANUP ENDIF Echo "Using next mirror" SKIP MIRRORLOOP BACK ENDIF IF EXISTS "SYS:UHC" Ask "*nSYS:UHC already exists, do you want to continue anyway (y/n)?" IF NOT WARN Echo "*nAborting...*n" Skip CLEANUP ENDIF ELSE MakeDir SYS:UHC ENDIF Which >NIL: Lha IF WARN Echo "*nLha not found, manually extract the file T:amigabin_${OSTAG} to SYS:UHC" Echo "and then type *"y*" to continue." Ask "Is the file extracted (y/n):" IF NOT WARN Echo "*nAborting...*n" Delete >NIL: SYS:UHC ALL Skip CLEANUP ENDIF ELSE Echo "Extracting ${UHCARCHIVE} to SYS:UHC/" IF ${OSTAG} EQ "aros-i386" Lha xqfw=SYS:UHC/ "T:${UHCARCHIVE}" IF WARN Echo "*nFailed to extract ${UHCARCHIVE} to SYS:UHC/" Echo "Make sure your SYS:-volume is not full and that you have a proper" Echo "version of Lha in your path." Skip CLEANUP ENDIF ELSE Stack 8192 Lha x -mq "T:${UHCARCHIVE}" "SYS:UHC/" IF WARN Echo "*nFailed to extract ${UHCARCHIVE} to SYS:UHC/" Echo "Make sure your SYS:-volume is not full and that you have a proper" Echo "version of Lha in your path." Skip CLEANUP ENDIF ENDIF ENDIF SetENV UHCBIN "SYS:UHC/" Copy ENV:UHCBIN ENVARC: Echo "*nWill now add a few lines to your S:User-Startup to set up assigns and" Ask "paths to UHC Tools. Proceed (y/n)?" IF NOT WARN Execute ${UHCBIN}UHC-Startup Echo "*nRemember to add paths manually!" ELSE Echo ";BEGIN UHC" >T:User-Startup.UHCPart Echo " IF EXISTS *"*${UHCBIN}UHC-Startup*"" >>T:User-Startup.UHCPart Echo " Execute *"*${UHCBIN}UHC-Startup*"" >>T:User-Startup.UHCPart Echo " ENDIF" >>T:User-Startup.UHCPart Echo ";END UHC*n" >>T:User-Startup.UHCPart Execute T:User-Startup.UHCPart Echo NOLINE >>S:User-Startup Copy S:User-Startup "${UHCBIN}User-Startup.org" Copy T:User-Startup.UHCPart S:User-Startup Type "${UHCBIN}User-Startup.org" >>S:User-Startup ENDIF IF NOT EXISTS ENV:UHC MakeDir ENV:UHC ENDIF SetENV UHC/TEMPDIR "T:" SetENV UHC/AUTOUPDATE "1" SetENV UHC/SHOWARCHIVER "0" SetENV UHC/SHOWPROGRESS "1" SetENV UHC/SEARCHURL "uhc.driar.se/uhcsearch" IF NOT EXISTS ENVARC:UHC MakeDir ENVARC:UHC ENDIF Copy >NIL: ENV:UHC/#? ENVARC:UHC/ ALL Protect >NIL: UHC:S/#? +s IF "${OSTAG}" NOT EQ "os4" Copy >NIL: UHC:S/uhcupdate S: ELSE Copy >NIL: UHC:S/uhcupdate S:Shell/ ENDIF Delete >NIL: T:${UHCARCHIVE} Echo "*nWe're all done! Run *"uhcupdate*" to update all utilities in the future!*n" LAB CLEANUP cd "$CURRENTPATH" UnSet CURRENTPATH UnSet OSTAG UnSet UHCROOTURL UnSet UHCARCHIVE UnSet UHCDLPROGRAM UnSet UHCCOUNTER UnSet UHCMIRROR0 Unset UHCMIRROR1 UnSet UHCMIRROR2