Readded network installers
* Only installers for supported years have launchers created
This commit is contained in:
parent
65d710b72f
commit
4701ef77fd
6 changed files with 120 additions and 50 deletions
|
|
@ -121,10 +121,15 @@ rem set args and copy setup files to system
|
|||
rem NOTE: init_client_dir.cmd sets %client_dir% and creates %client_dir%\Office folder
|
||||
call "%bin%\Scripts\init_client_dir.cmd" /Office
|
||||
echo Copying setup file(s) for %L_ITEM%...
|
||||
rem NOTE: If L_PATH == "2013" or "2016" extract the ODT setup/xml, otherwise copy from OFFICE_SERVER
|
||||
set "_odt=False"
|
||||
if %L_PATH% equ 2013 (set "_odt=True")
|
||||
if %L_PATH% equ 2016 (set "_odt=True")
|
||||
if "%_odt%" == "True" (
|
||||
rem extract setup/xml and start installation
|
||||
set "setup=%L_PATH%\setup.exe"
|
||||
set "source=%L_PATH%\setup.exe"
|
||||
set "dest=%client_dir%\Office\%L_PATH%"
|
||||
"%SEVEN_ZIP%" e "%cbin%\_Office.7z" -aoa -bso0 -bse0 -p%ARCHIVE_PASSWORD% -o"!dest!" !setup! !L_ITEM! || exit /b 1
|
||||
"%SEVEN_ZIP%" e "%cbin%\_Office.7z" -aoa -bso0 -bse0 -p%ARCHIVE_PASSWORD% -o"!dest!" !source! !L_ITEM! || exit /b 1
|
||||
"%systemroot%\System32\ping.exe" -n 2 127.0.0.1>nul
|
||||
if not exist "!dest!\setup.exe" (goto ErrorOfficeSourceNotFound)
|
||||
if not exist "!dest!\!L_ITEM!" (goto ErrorOfficeSourceNotFound)
|
||||
|
|
@ -134,6 +139,30 @@ rem start "" "setup.exe" /configure !L_ITEM! || popd & goto ErrorUnknown
|
|||
rem # Going to assume it extracted correctly and blindly start setup.exe
|
||||
start "" "setup.exe" /configure !L_ITEM!
|
||||
popd
|
||||
) else (
|
||||
rem copy setup files from OFFICE_SERVER
|
||||
set "fastcopy_args=/cmd=diff /no_ui /auto_close"
|
||||
set "product=%L_PATH%\%L_ITEM%"
|
||||
set "product_name=%L_ITEM%"
|
||||
call :GetBasename product_name || goto ErrorBasename
|
||||
set "source=\\%OFFICE_SERVER%\Office\!product!"
|
||||
set "dest=%client_dir%\Office"
|
||||
rem Verify source
|
||||
if not exist "!source!" (goto ErrorOfficeSourceNotFound)
|
||||
rem Copy setup file(s) to system
|
||||
start "" /wait "%FASTCOPY%" !fastcopy_args! "!source!" /to="!dest!\"
|
||||
rem Run setup
|
||||
if exist "!dest!\!product_name!\setup.exe" (
|
||||
start "" "!dest!\!product_name!\setup.exe" || goto ErrorUnknown
|
||||
) else if "!product_name:~-3,3!" == "exe" (
|
||||
start "" "!dest!\!product_name!" || goto ErrorUnknown
|
||||
) else if "!product_name:~-3,3!" == "msi" (
|
||||
start "" "!dest!\!product_name!" || goto ErrorUnknown
|
||||
) else (
|
||||
rem Office source not supported by this script
|
||||
goto ErrorOfficeUnsupported
|
||||
)
|
||||
)
|
||||
goto Exit
|
||||
|
||||
:LaunchQuickBooksSetup
|
||||
|
|
|
|||
|
|
@ -164,7 +164,12 @@ def mount_backup_shares():
|
|||
if server['Mounted']:
|
||||
continue
|
||||
|
||||
# Else, test connection
|
||||
mount_network_share(server)
|
||||
|
||||
|
||||
def mount_network_share(server):
|
||||
"""Mount a network share defined by server."""
|
||||
# Test connection
|
||||
try:
|
||||
ping(server['IP'])
|
||||
except subprocess.CalledProcessError:
|
||||
|
|
@ -172,7 +177,7 @@ def mount_backup_shares():
|
|||
r'Failed to mount \\{Name}\{Share}, {IP} unreachable.'.format(
|
||||
**server))
|
||||
sleep(1)
|
||||
continue # Continue to next server
|
||||
return False
|
||||
|
||||
# Mount
|
||||
cmd = r'net use \\{IP}\{Share} /user:{User} {Pass}'.format(**server)
|
||||
|
|
@ -560,14 +565,20 @@ def transfer_source(source_obj, dest_path, selected_items):
|
|||
def umount_backup_shares():
|
||||
"""Unnount the backup shares regardless of current status."""
|
||||
for server in BACKUP_SERVERS:
|
||||
umount_network_share(server)
|
||||
|
||||
def umount_network_share(server):
|
||||
"""Unnount a network share defined by server."""
|
||||
cmd = r'net use \\{IP}\{Share} /delete'.format(**server)
|
||||
cmd = cmd.split(' ')
|
||||
try:
|
||||
# Umount
|
||||
run_program(r'net use \\{IP}\{Share} /delete'.format(**server))
|
||||
print_info('Umounted {Name}'.format(**server))
|
||||
server['Mounted'] = False
|
||||
run_program(cmd)
|
||||
except Exception:
|
||||
print_error(r'Failed to umount \\{Name}\{Share}.'.format(**server))
|
||||
sleep(1)
|
||||
else:
|
||||
print_info('Umounted {Name}'.format(**server))
|
||||
server['Mounted'] = False
|
||||
|
||||
def wim_contains(source_path, file_path):
|
||||
"""Check if the WIM contains a file or folder."""
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
import requests
|
||||
|
||||
from functions.common import *
|
||||
from functions.data import *
|
||||
from settings.launchers import *
|
||||
from settings.music import *
|
||||
from settings.sources import *
|
||||
|
|
@ -156,6 +157,29 @@ def resolve_dynamic_url(source_url, regex):
|
|||
# Return
|
||||
return url
|
||||
|
||||
def scan_for_net_installers(server, family_name, min_year):
|
||||
if not server['Mounted']:
|
||||
mount_network_share(server)
|
||||
|
||||
if server['Mounted']:
|
||||
for year in os.scandir(r'\\{IP}\{Share}'.format(**server)):
|
||||
if int(year.name) < min_year:
|
||||
# Don't support outdated installers
|
||||
continue
|
||||
for version in os.scandir(year.path):
|
||||
section = r'Installers\Extras\{}\{}'.format(
|
||||
family_name, year.name)
|
||||
if section not in LAUNCHERS:
|
||||
LAUNCHERS[section] = {}
|
||||
if version.name not in LAUNCHERS[section]:
|
||||
LAUNCHERS[section][version.name] = {
|
||||
'L_TYPE': family_name,
|
||||
'L_PATH': year.name,
|
||||
'L_ITEM': version.name,
|
||||
'L_CHCK': 'True',
|
||||
}
|
||||
umount_network_share(server)
|
||||
|
||||
## Data Recovery ##
|
||||
def update_testdisk():
|
||||
# Stop running processes
|
||||
|
|
|
|||
|
|
@ -39,14 +39,6 @@ CLIENT_INFO_SERVER = {
|
|||
'Share': '/srv/ClientInfo',
|
||||
'User': 'upload',
|
||||
}
|
||||
QUICKBOOKS_SERVER = {
|
||||
'IP': QUICKBOOKS_SERVER_IP,
|
||||
'Name': 'ServerOne',
|
||||
'Mounted': False,
|
||||
'Share': 'QuickBooks',
|
||||
'User': 'restore',
|
||||
'Pass': 'Abracadabra',
|
||||
}
|
||||
OFFICE_SERVER = {
|
||||
'IP': OFFICE_SERVER_IP,
|
||||
'Name': 'ServerOne',
|
||||
|
|
@ -55,6 +47,14 @@ OFFICE_SERVER = {
|
|||
'User': 'restore',
|
||||
'Pass': 'Abracadabra',
|
||||
}
|
||||
QUICKBOOKS_SERVER = {
|
||||
'IP': QUICKBOOKS_SERVER_IP,
|
||||
'Name': 'ServerOne',
|
||||
'Mounted': False,
|
||||
'Share': 'QuickBooks',
|
||||
'User': 'restore',
|
||||
'Pass': 'Abracadabra',
|
||||
}
|
||||
WINDOWS_SERVER = {
|
||||
'IP': '10.0.0.10',
|
||||
'Name': 'ServerOne',
|
||||
|
|
|
|||
|
|
@ -117,6 +117,11 @@ if __name__ == '__main__':
|
|||
width=40,
|
||||
item = item)
|
||||
|
||||
## Search for network Office/QuickBooks installers & add to LAUNCHERS
|
||||
print_success('Scanning for network installers')
|
||||
scan_for_net_installers(OFFICE_SERVER, 'Office', min_year=2010)
|
||||
scan_for_net_installers(QUICKBOOKS_SERVER, 'QuickBooks', min_year=2015)
|
||||
|
||||
## Generate Launchers
|
||||
print_success('Generating launchers')
|
||||
for section in sorted(LAUNCHERS.keys()):
|
||||
|
|
|
|||
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,4 +1,5 @@
|
|||
**/__pycache__/*
|
||||
*.bak
|
||||
*.exe
|
||||
.bin/7-Zip/
|
||||
.bin/AIDA64/
|
||||
|
|
@ -35,4 +36,4 @@
|
|||
.cbin/_Office/
|
||||
.cbin/_vcredists/
|
||||
.cbin/wimlib/
|
||||
OUT/
|
||||
OUT*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue