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,19 +121,48 @@ rem set args and copy setup files to system
|
||||||
rem NOTE: init_client_dir.cmd sets %client_dir% and creates %client_dir%\Office folder
|
rem NOTE: init_client_dir.cmd sets %client_dir% and creates %client_dir%\Office folder
|
||||||
call "%bin%\Scripts\init_client_dir.cmd" /Office
|
call "%bin%\Scripts\init_client_dir.cmd" /Office
|
||||||
echo Copying setup file(s) for %L_ITEM%...
|
echo Copying setup file(s) for %L_ITEM%...
|
||||||
rem extract setup/xml and start installation
|
rem NOTE: If L_PATH == "2013" or "2016" extract the ODT setup/xml, otherwise copy from OFFICE_SERVER
|
||||||
set "setup=%L_PATH%\setup.exe"
|
set "_odt=False"
|
||||||
set "dest=%client_dir%\Office\%L_PATH%"
|
if %L_PATH% equ 2013 (set "_odt=True")
|
||||||
"%SEVEN_ZIP%" e "%cbin%\_Office.7z" -aoa -bso0 -bse0 -p%ARCHIVE_PASSWORD% -o"!dest!" !setup! !L_ITEM! || exit /b 1
|
if %L_PATH% equ 2016 (set "_odt=True")
|
||||||
"%systemroot%\System32\ping.exe" -n 2 127.0.0.1>nul
|
if "%_odt%" == "True" (
|
||||||
if not exist "!dest!\setup.exe" (goto ErrorOfficeSourceNotFound)
|
rem extract setup/xml and start installation
|
||||||
if not exist "!dest!\!L_ITEM!" (goto ErrorOfficeSourceNotFound)
|
set "source=%L_PATH%\setup.exe"
|
||||||
pushd "!dest!"
|
set "dest=%client_dir%\Office\%L_PATH%"
|
||||||
rem # The line below jumps to ErrorUnknown even though setup.exe is run correctly??
|
"%SEVEN_ZIP%" e "%cbin%\_Office.7z" -aoa -bso0 -bse0 -p%ARCHIVE_PASSWORD% -o"!dest!" !source! !L_ITEM! || exit /b 1
|
||||||
rem start "" "setup.exe" /configure !L_ITEM! || popd & goto ErrorUnknown
|
"%systemroot%\System32\ping.exe" -n 2 127.0.0.1>nul
|
||||||
rem # Going to assume it extracted correctly and blindly start setup.exe
|
if not exist "!dest!\setup.exe" (goto ErrorOfficeSourceNotFound)
|
||||||
start "" "setup.exe" /configure !L_ITEM!
|
if not exist "!dest!\!L_ITEM!" (goto ErrorOfficeSourceNotFound)
|
||||||
popd
|
pushd "!dest!"
|
||||||
|
rem # The line below jumps to ErrorUnknown even though setup.exe is run correctly??
|
||||||
|
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
|
goto Exit
|
||||||
|
|
||||||
:LaunchQuickBooksSetup
|
:LaunchQuickBooksSetup
|
||||||
|
|
|
||||||
|
|
@ -164,28 +164,33 @@ def mount_backup_shares():
|
||||||
if server['Mounted']:
|
if server['Mounted']:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Else, test connection
|
mount_network_share(server)
|
||||||
try:
|
|
||||||
ping(server['IP'])
|
|
||||||
except subprocess.CalledProcessError:
|
|
||||||
print_error(
|
|
||||||
r'Failed to mount \\{Name}\{Share}, {IP} unreachable.'.format(
|
|
||||||
**server))
|
|
||||||
sleep(1)
|
|
||||||
continue # Continue to next server
|
|
||||||
|
|
||||||
# Mount
|
def mount_network_share(server):
|
||||||
cmd = r'net use \\{IP}\{Share} /user:{User} {Pass}'.format(**server)
|
"""Mount a network share defined by server."""
|
||||||
cmd = cmd.split(' ')
|
# Test connection
|
||||||
try:
|
try:
|
||||||
run_program(cmd)
|
ping(server['IP'])
|
||||||
except Exception:
|
except subprocess.CalledProcessError:
|
||||||
print_warning(r'Failed to mount \\{Name}\{Share} ({IP})'.format(
|
print_error(
|
||||||
|
r'Failed to mount \\{Name}\{Share}, {IP} unreachable.'.format(
|
||||||
**server))
|
**server))
|
||||||
sleep(1)
|
sleep(1)
|
||||||
else:
|
return False
|
||||||
print_info('Mounted {Name}'.format(**server))
|
|
||||||
server['Mounted'] = True
|
# Mount
|
||||||
|
cmd = r'net use \\{IP}\{Share} /user:{User} {Pass}'.format(**server)
|
||||||
|
cmd = cmd.split(' ')
|
||||||
|
try:
|
||||||
|
run_program(cmd)
|
||||||
|
except Exception:
|
||||||
|
print_warning(r'Failed to mount \\{Name}\{Share} ({IP})'.format(
|
||||||
|
**server))
|
||||||
|
sleep(1)
|
||||||
|
else:
|
||||||
|
print_info('Mounted {Name}'.format(**server))
|
||||||
|
server['Mounted'] = True
|
||||||
|
|
||||||
def run_fast_copy(items, dest):
|
def run_fast_copy(items, dest):
|
||||||
"""Copy items to dest using FastCopy."""
|
"""Copy items to dest using FastCopy."""
|
||||||
|
|
@ -560,14 +565,20 @@ def transfer_source(source_obj, dest_path, selected_items):
|
||||||
def umount_backup_shares():
|
def umount_backup_shares():
|
||||||
"""Unnount the backup shares regardless of current status."""
|
"""Unnount the backup shares regardless of current status."""
|
||||||
for server in BACKUP_SERVERS:
|
for server in BACKUP_SERVERS:
|
||||||
try:
|
umount_network_share(server)
|
||||||
# Umount
|
|
||||||
run_program(r'net use \\{IP}\{Share} /delete'.format(**server))
|
def umount_network_share(server):
|
||||||
print_info('Umounted {Name}'.format(**server))
|
"""Unnount a network share defined by server."""
|
||||||
server['Mounted'] = False
|
cmd = r'net use \\{IP}\{Share} /delete'.format(**server)
|
||||||
except Exception:
|
cmd = cmd.split(' ')
|
||||||
print_error(r'Failed to umount \\{Name}\{Share}.'.format(**server))
|
try:
|
||||||
sleep(1)
|
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):
|
def wim_contains(source_path, file_path):
|
||||||
"""Check if the WIM contains a file or folder."""
|
"""Check if the WIM contains a file or folder."""
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from functions.common import *
|
from functions.common import *
|
||||||
|
from functions.data import *
|
||||||
from settings.launchers import *
|
from settings.launchers import *
|
||||||
from settings.music import *
|
from settings.music import *
|
||||||
from settings.sources import *
|
from settings.sources import *
|
||||||
|
|
@ -156,6 +157,29 @@ def resolve_dynamic_url(source_url, regex):
|
||||||
# Return
|
# Return
|
||||||
return url
|
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 ##
|
## Data Recovery ##
|
||||||
def update_testdisk():
|
def update_testdisk():
|
||||||
# Stop running processes
|
# Stop running processes
|
||||||
|
|
|
||||||
|
|
@ -39,14 +39,6 @@ CLIENT_INFO_SERVER = {
|
||||||
'Share': '/srv/ClientInfo',
|
'Share': '/srv/ClientInfo',
|
||||||
'User': 'upload',
|
'User': 'upload',
|
||||||
}
|
}
|
||||||
QUICKBOOKS_SERVER = {
|
|
||||||
'IP': QUICKBOOKS_SERVER_IP,
|
|
||||||
'Name': 'ServerOne',
|
|
||||||
'Mounted': False,
|
|
||||||
'Share': 'QuickBooks',
|
|
||||||
'User': 'restore',
|
|
||||||
'Pass': 'Abracadabra',
|
|
||||||
}
|
|
||||||
OFFICE_SERVER = {
|
OFFICE_SERVER = {
|
||||||
'IP': OFFICE_SERVER_IP,
|
'IP': OFFICE_SERVER_IP,
|
||||||
'Name': 'ServerOne',
|
'Name': 'ServerOne',
|
||||||
|
|
@ -55,6 +47,14 @@ OFFICE_SERVER = {
|
||||||
'User': 'restore',
|
'User': 'restore',
|
||||||
'Pass': 'Abracadabra',
|
'Pass': 'Abracadabra',
|
||||||
}
|
}
|
||||||
|
QUICKBOOKS_SERVER = {
|
||||||
|
'IP': QUICKBOOKS_SERVER_IP,
|
||||||
|
'Name': 'ServerOne',
|
||||||
|
'Mounted': False,
|
||||||
|
'Share': 'QuickBooks',
|
||||||
|
'User': 'restore',
|
||||||
|
'Pass': 'Abracadabra',
|
||||||
|
}
|
||||||
WINDOWS_SERVER = {
|
WINDOWS_SERVER = {
|
||||||
'IP': '10.0.0.10',
|
'IP': '10.0.0.10',
|
||||||
'Name': 'ServerOne',
|
'Name': 'ServerOne',
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,11 @@ if __name__ == '__main__':
|
||||||
width=40,
|
width=40,
|
||||||
item = item)
|
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
|
## Generate Launchers
|
||||||
print_success('Generating launchers')
|
print_success('Generating launchers')
|
||||||
for section in sorted(LAUNCHERS.keys()):
|
for section in sorted(LAUNCHERS.keys()):
|
||||||
|
|
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,4 +1,5 @@
|
||||||
**/__pycache__/*
|
**/__pycache__/*
|
||||||
|
*.bak
|
||||||
*.exe
|
*.exe
|
||||||
.bin/7-Zip/
|
.bin/7-Zip/
|
||||||
.bin/AIDA64/
|
.bin/AIDA64/
|
||||||
|
|
@ -35,4 +36,4 @@
|
||||||
.cbin/_Office/
|
.cbin/_Office/
|
||||||
.cbin/_vcredists/
|
.cbin/_vcredists/
|
||||||
.cbin/wimlib/
|
.cbin/wimlib/
|
||||||
OUT/
|
OUT*/
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue