; Install GlowIcons
; -----------------
; Author: Henrik Noerfjand Stengaard
; Date: 2021-12-03
;
; This script creates a backup of old icons and installs GlowIcons.


; skip to end, if glowicons are not installed
If Not Exists "SYS:Icons/GlowIcons"
  echo "*e[1mError: GlowIcons are not installed in 'SYS:Icons/GlowIcons'!*e[0m"
  Wait 1
  SKIP end
EndIf

; show requester to install glowicons
set install `RequestChoice "Install GlowIcons" "Do you want to install GlowIcons?" "Yes|No"`
If Not $install Eq "1" VAL
  SKIP end
EndIf

; show overwrite 
IF EXISTS "SYS:Icons/OldIcons/OldIcons-Backup.lha"
  ; show requester to install glowicons
  set overwrite `RequestChoice "Overwrite old icons backup" "Old icons backup already exist!*N*NDo you want to overwrite existing old icons backup?" "Yes|No"`
  If Not $overwrite Eq "1" VAL
    SKIP install
  EndIf
  echo "Deleting old icons backup..."
  Delete "SYS:Icons/OldIcons/OldIcons-Backup.lha" >NIL:
  echo "Done"
EndIf

; create sys, icons directory
If Not Exists "SYS:Icons/"
  MakeDir "SYS:Icons/" >NIL:
EndIf

; create sys, icons, old icons directory
If Not Exists "SYS:Icons/OldIcons/"
  MakeDir "SYS:Icons/OldIcons/" >NIL:
EndIf

echo "Creating old icons backup..."
Lha -q -e -r -x a "SYS:Icons/OldIcons/OldIcons-Backup.lha" "SYS:" #?.info
echo "Done"


; install glowicons
; -----------------
LAB install
echo "Installing GlowIcons..."
Copy "SYS:Icons/GlowIcons" "SYS:" ALL CLONE >NIL:
echo "Done"
echo ""
echo "Please reboot Amiga to get GlowIcons shown."
Wait 5


; end
; ---
LAB end
