@echo off
call check-for-admin
if %ERRORLEVEL% neq 0 exit /b

set SOFTWARE=..\software
set MSI=drawio-setup.msi
set STARTMENU=%PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs
set STARTMENU_USER=%APPDATA%\Microsoft\Windows\Start Menu\Programs

if NOT EXIST %SOFTWARE%\%MSI% (
  echo ERROR: %SOFTWARE%\%MSI% not found!
  exit /b
)

echo ####### %0 #######

echo installing Draw-IO ...
cd %SOFTWARE%
@echo on
msiexec /i %MSI% /passive
@echo off
cd %OPT%

echo moving Draw-IO startmenu shortcut ...
move /Y "%STARTMENU_USER%\draw.io.lnk" "%STARTMENU%"
icacls "%STARTMENU%\draw.io.lnk" /grant Users:R

echo moving Draw-IO desktop link to public desktop ...
move /Y "%USERPROFILE%\Desktop\draw.io.lnk" "%PUBLIC%\Desktop"
icacls "%PUBLIC%\Desktop\draw.io.lnk" /grant Users:R

echo ####### %0 #######
pause

