failat 30
; IP: device and ppipc.library installation script 90:7:28
; (intended to work -- mostly -- under 1.2 on)
cd _I_IP_:  ; assigned in tooltype
makedir >NIL: RAM:C_IP
copy >NIL: Local_C to RAM:C_IP
path add RAM:C_IP
if exists LIBS:ppipc.library
    echo "ppipc.library found in LIBS: ...OK"
    skip handler
endif
echo "  All ppIPC functions need 'ppipc.library' to be available in LIBS:"
echo "-- It will take up under 3K of disk space"
jask "-rInstall ppipc.library in LIBS: ?"
if warn
    echo "OK..."
    copy ppipc.library to LIBS: clone
    echo "ppipc.library copied"
else
    echo "OK -- another time maybe..."
    skip exit
endif

lab handler
echo ""
if exists L:IP-Handler
    echo "IP-Handler (for 'IP:' device) found in L: ...OK"
    skip xipcquit
endif
echo "  To mount the 'IP:' device at boot-up, IP-Handler must be in L:"
echo "It occupies about 4.5K of disk space"
echo "  If you would prefer (and are running AmigaDOS 1.3 or later),"
echo "you can mount the device temporarily now without installing"
echo "the handler (answer NO to the first requester)."
echo "It will remain available until you next reboot your Amiga"
jask "-rInstall IP-Handler in L: ?"
if warn
    echo "OK..."
    copy IP-Handler to L: clone
    echo "Handler copied"
else
    skip trial
endif

lab xipcquit
if exists C:IPCQuit
    skip mountlist
endif
echo ""
echo "a utility you will sometimes want available is 'IPCQuit';"
echo "if you wish, I will transfer it to your C: directory now"
jask "-rCopy IPCQuit to C: ?"
if warn
    echo "OK..."
    copy IPCQuit to C: clone
    echo "IPCQuit copied"
endif

lab mountlist
echo ""
mat >NIL: search IP: nocase devs:mountlist
if warn
    echo "  For future mounting of the 'IP:' device,"
    echo "MountList will need an entry for IP:"
    echo "I can add a suitable entry now if you permit."
    echo "If you prefer, and know how, you may do the job yourself."
    echo "Or (under 1.3) you can mount it temporarily for testing."
    echo "If the file is edited automatically, the original will"
    echo "be kept as DEVS:MountList.BAK."
    echo "If somehow an error should occur, the original file"
    echo "will NOT be changed."
    jask "-r.. shall I Edit MountList?"
    if warn
        echo "Proceeding to add IP: to MountList"
        if exists DEVS:MountList.BAK
            jask "-rMountlist.BAK exists -- shall I go on?" "-nNo Way!!" -pOK -q
            if not warn
                echo "OK -- I'll stop here"
                skip exit
            else
                delete DEVS:MountList.BAK
            endif
        endif
        Merge >RAM:_New_MountList DEVS:MountList -1 IP_MountList
        if fail
            skip nogood
        endif
        copy RAM:_New_Mountlist to DEVS:
        if fail
            skip nogood
        endif
        delete RAM:_New_MountList
        cd DEVS:
        rename MountList as MountList.BAK
        rename _New_MountList as MountList
        echo "New MountList installed"
        cd _I_IP_:
        skip startup
    lab nogood
        echo "MountList editing FAILED!"
        skip exit
    else
        echo ""
        echo "MountList not being changed..."
        echo "To make the changes yourself, use the template"
        echo "IP_MountList in the 'Install 'IP:' Modules' directory"
        skip trial
    endif
else
    echo "Mountlist appears correct for IP: device"
    skip startup
endif

lab trial
    jask "-rMount for a temporary trial instead?" -q
    if warn
        echo "OK...mounting device directly"
        Mount IP: from IP_MountList_direct
        if fail
            echo "Sorry -- didn't work... probably not using 1.3?"
        endif
        skip exit
    else
        echo "OK -- give it a try sometime..."
        skip exit
    endif

lab startup
echo ""
execute fixup_Startup ;a separate file, being so complex...
assign >NIL: exists IP: ; this will (should!) simply fail under 1.2
if warn
    jask "-rMount IP: now?"
    if warn
        mount IP:
        echo "IP: device should be available for use"
    endif
else
    echo "IP: device is mounted ready for use."
endif
lab exit
delete >NIL: all RAM:C_IP
