Skip to content

Commit a424a47

Browse files
committed
Numerous cleanups/fixes for floppy and script files
Fixed URLs in ultradefrag.bat Fixed installation issue in ultradefrag.bat Fixed 7z call to only extract the files we need Improved uninstall-7zip.bat Replaced lessmsi with sevenzip install due to unzip failures in 2012 servercore Replaced `if exist "%SystemDrive%\Program Files (x86)` with `if defined ProgramFiles(x86)` Standardized .cmd/.bat headers to include PACKER_DEBUG check Fixed minor typos
1 parent 09a73e4 commit a424a47

30 files changed

+231
-175
lines changed

floppy/00-run-all-scripts.cmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@setlocal EnableDelayedExpansion EnableExtensions
22
@for %%i in (%~dp0\_packer_config*.cmd) do @call "%%~i"
3-
@if not defined PACKER_DEBUG (@echo off) else (@echo on)
3+
@if defined PACKER_DEBUG (@echo on) else (@echo off)
44

55
goto main
66

floppy/01-install-wget.cmd

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
setlocal EnableDelayedExpansion EnableExtensions
1+
@setlocal EnableDelayedExpansion EnableExtensions
2+
@for %%i in (%~dp0\_packer_config*.cmd) do @call "%%~i"
3+
@if defined PACKER_DEBUG (@echo on) else (@echo off)
4+
25
title Installing wget. Please wait...
36

47
:: bitsadmin can't download http://users.ugent.be/~bpuype/cgi-bin/fetch.pl?dl=wget/wget.exe

floppy/_download.cmd

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
setlocal EnableDelayedExpansion EnableExtensions
1+
@setlocal EnableDelayedExpansion EnableExtensions
2+
@for %%i in (%~dp0\_packer_config*.cmd) do @call "%%~i"
3+
@if defined PACKER_DEBUG (@echo on) else (@echo off)
24

35
if not defined PACKER_SEARCH_PATHS set PACKER_SEARCH_PATHS="%USERPROFILE%" a: b: c: d: e: f: g: h: i: j: k: l: m: n: o: p: q: r: s: t: u: v: w: x: y: z:
46

floppy/_packer_config.cmd

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@
1111
:: Uncomment the following to define the directory where scripts/save-logs.cmd
1212
:: will save the installation logs
1313
:: Default: z:\c\packer_logs
14-
:: set PACKER_LOG_DIR=z:\c\packer_logs
14+
set PACKER_LOG_DIR=z:\c\packer_logs
1515

1616
:: Uncomment the following to pause PACKER_PAUSE seconds after each script is
1717
:: run by floppy/00-run-all-scripts.cmd (unless you press Y)
1818
:: Default: (unset)
19-
:: set PACKER_PAUSE=60
19+
set PACKER_PAUSE=5
2020

2121
:: Uncomment the following to pause if a script run by
2222
:: floppy/00-run-all-scripts.cmd returns a non-zero exit value
2323
:: Default: (unset)
24-
:: set PACKER_PAUSE_ON_ERROR=1
24+
set PACKER_PAUSE_ON_ERROR=1
2525

2626
:: Uncomment the following to shutdown if a script run by
2727
:: floppy/00-run-all-scripts.cmd returns a non-zero exit value

floppy/_uninstall-cygwin.bat

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
setlocal EnableDelayedExpansion EnableExtensions
1+
@setlocal EnableDelayedExpansion EnableExtensions
2+
@for %%i in (%~dp0\_packer_config*.cmd) do @call "%%~i"
3+
@if defined PACKER_DEBUG (@echo on) else (@echo off)
4+
25
title Uninstalling Cygwin. Please wait...
36

47
:: If TEMP is not defined in this shell instance, define it ourselves

floppy/cygwin.bat

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
setlocal EnableDelayedExpansion EnableExtensions
1+
@setlocal EnableDelayedExpansion EnableExtensions
2+
@for %%i in (%~dp0\_packer_config*.cmd) do @call "%%~i"
3+
@if defined PACKER_DEBUG (@echo on) else (@echo off)
4+
25
title Installing Cygwin. Please wait...
36

47
if not defined CYGWIN_ARCH (

floppy/disablewinupdate.bat

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<!-- :
2-
@echo off
2+
@setlocal EnableDelayedExpansion EnableExtensions
3+
@for %%i in (%~dp0\_packer_config*.cmd) do @call "%%~i"
4+
@if defined PACKER_DEBUG (@echo on) else (@echo off)
5+
36
echo ==^> Enabling updates for other products from Microsoft Update
47
net stop wuauserv
58

floppy/install-winrm.cmd

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
setlocal EnableDelayedExpansion EnableExtensions
1+
@setlocal EnableDelayedExpansion EnableExtensions
2+
@for %%i in (%~dp0\_packer_config*.cmd) do @call "%%~i"
3+
@if defined PACKER_DEBUG (@echo on) else (@echo off)
4+
25
title Enabling Windows Remote Management. Please wait...
36

47
echo ==^> Turning off User Account Control (UAC)

floppy/networkprompt.bat

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
setlocal EnableDelayedExpansion EnableExtensions
1+
@setlocal EnableDelayedExpansion EnableExtensions
2+
@for %%i in (%~dp0\_packer_config*.cmd) do @call "%%~i"
3+
@if defined PACKER_DEBUG (@echo on) else (@echo off)
4+
25
title Disabling new network prompt. Please wait...
36

47
echo ==^> Disabling new network prompt

floppy/openssh.bat

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
setlocal EnableDelayedExpansion EnableExtensions
1+
@setlocal EnableDelayedExpansion EnableExtensions
2+
@for %%i in (%~dp0\_packer_config*.cmd) do @call "%%~i"
3+
@if defined PACKER_DEBUG (@echo on) else (@echo off)
4+
25
title Installing Openssh. Please wait...
36

47
if not defined OPENSSH_32_URL set OPENSSH_32_URL=http://www.mls-software.com/files/setupssh-6.7p1-1-v1.exe
5-
if not defined OPENSSH_64_URL set OPENSSH_64_URL=http://www.mls-software.com/files/setupssh-6.7p1-1-v1(x64).exe
8+
:: if not defined OPENSSH_64_URL set OPENSSH_64_URL=http://www.mls-software.com/files/setupssh-6.7p1-1-v1(x64).exe
69
if not defined SSHD_PASSWORD set SSHD_PASSWORD=D@rj33l1ng
710

8-
if exist "%SystemDrive%\Program Files (x86)" (
9-
set OPENSSH_URL="%OPENSSH_64_URL%"
10-
) else (
11+
:: if defined ProgramFiles(x86) (
12+
:: set OPENSSH_URL="%OPENSSH_64_URL%"
13+
:: ) else (
1114
set OPENSSH_URL="%OPENSSH_32_URL%"
12-
)
15+
:: )
1316

1417
:: strip off quotes
1518
for %%i in (%OPENSSH_URL%) do set OPENSSH_EXE=%%~nxi

floppy/passwordchange.bat

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
setlocal EnableDelayedExpansion EnableExtensions
1+
@setlocal EnableDelayedExpansion EnableExtensions
2+
@for %%i in (%~dp0\_packer_config*.cmd) do @call "%%~i"
3+
@if defined PACKER_DEBUG (@echo on) else (@echo off)
4+
25
title Disabling automatic machine account password changes. Please wait...
36

47
echo ==^> Disabling automatic machine account password changes

floppy/powerconfig.bat

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
setlocal EnableDelayedExpansion EnableExtensions
1+
@setlocal EnableDelayedExpansion EnableExtensions
2+
@for %%i in (%~dp0\_packer_config*.cmd) do @call "%%~i"
3+
@if defined PACKER_DEBUG (@echo on) else (@echo off)
4+
25
title Setting power configuration. Please wait...
36

47
echo ==^> Setting power configuration to High Performance

floppy/zz-start-sshd.cmd

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
setlocal EnableDelayedExpansion EnableExtensions
1+
@setlocal EnableDelayedExpansion EnableExtensions
2+
@for %%i in (%~dp0\_packer_config*.cmd) do @call "%%~i"
3+
@if defined PACKER_DEBUG (@echo on) else (@echo off)
24

35
if not defined PACKER_SERVICES set PACKER_SERVICES=opensshd sshd winrm
46

floppy/zzz-debug-log.cmd

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@setlocal EnableDelayedExpansion EnableExtensions
2-
@for %%i in (a:\_packer_config*.cmd) do @call "%%~i"
3-
@if not defined PACKER_DEBUG echo off
2+
@for %%i in (%~dp0\_packer_config*.cmd) do @call "%%~i"
3+
@if defined PACKER_DEBUG (@echo on) else (@echo off)
44

55
if "%1" == "" goto main
66

script/01-install-handle.cmd

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@setlocal EnableDelayedExpansion EnableExtensions
22
@for %%i in (a:\_packer_config*.cmd) do @call "%%~i"
3-
@if not defined PACKER_DEBUG echo off
3+
@if defined PACKER_DEBUG (@echo on) else (@echo off)
44

55
if not defined HANDLE_URL set HANDLE_URL=http://live.sysinternals.com/handle.exe
66

@@ -15,7 +15,7 @@ pushd "%HANDLE_DIR%"
1515
if exist "%SystemRoot%\_download.cmd" (
1616
call "%SystemRoot%\_download.cmd" "%HANDLE_URL%" "%HANDLE_PATH%"
1717
) else (
18-
echo ==^> Downloadling "%HANDLE_URL%" to "%HANDLE_PATH%"
18+
echo ==^> Downloading "%HANDLE_URL%" to "%HANDLE_PATH%"
1919
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('%HANDLE_URL%', '%HANDLE_PATH%')" <NUL
2020
)
2121
if not exist "%HANDLE_PATH%" goto exit1

script/clean.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@setlocal EnableDelayedExpansion EnableExtensions
22
@for %%i in (a:\_packer_config*.cmd) do @call "%%~i"
3-
@if not defined PACKER_DEBUG echo off
3+
@if defined PACKER_DEBUG (@echo on) else (@echo off)
44

55
pushd "%TEMP%"
66

script/cmtool.bat

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@setlocal EnableDelayedExpansion EnableExtensions
22
@for %%i in (a:\_packer_config*.cmd) do @call "%%~i"
3-
@if not defined PACKER_DEBUG echo off
3+
@if defined PACKER_DEBUG (@echo on) else (@echo off)
44

55
if not defined CM echo ==^> ERROR: The "CM" variable was not found in the environment & goto exit1
66

@@ -32,7 +32,6 @@ echo ==^> Creating "%CHEF_DIR%"
3232
mkdir "%CHEF_DIR%"
3333
pushd "%CHEF_DIR%"
3434

35-
:: todo support CM_VERSION variable
3635
if exist "%SystemRoot%\_download.cmd" (
3736
call "%SystemRoot%\_download.cmd" "%CHEF_URL%" "%CHEF_PATH%"
3837
) else (
@@ -65,7 +64,12 @@ mkdir "%CHEFDK_DIR%"
6564
pushd "%CHEFDK_DIR%"
6665

6766
echo ==^> Downloading Chef DK to %CHEFDK_PATH%
68-
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('%CHEFDK_URL%', '%CHEFDK_PATH%')" <NUL
67+
if exist "%SystemRoot%\_download.cmd" (
68+
call "%SystemRoot%\_download.cmd" "%CHEFDK_URL%" "%CHEFDK_PATH%"
69+
) else (
70+
echo ==^> Downloading %CHEFDK_URL% to %CHEFDK_PATH%
71+
powershell -Command "(New-Object System.Net.WebClient).DownloadFile(\"%CHEFDK_URL%\", '%CHEFDK_PATH%')" <NUL
72+
)
6973
if not exist "%CHEFDK_PATH%" goto exit1
7074

7175
echo ==^> Installing Chef Development Kit %CM_VERSION%
@@ -119,7 +123,7 @@ if "%CM_VERSION%" == "latest" set CM_VERSION=2014.7.0
119123
if not defined SALT_32_URL set SALT_32_URL=https://docs.saltstack.com/downloads/Salt-Minion-%CM_VERSION%-x86-Setup.exe
120124
if not defined SALT_64_URL set SALT_64_URL=https://docs.saltstack.com/downloads/Salt-Minion-%CM_VERSION%-AMD64-Setup.exe
121125

122-
if exist "%SystemDrive%\Program Files (x86)" (
126+
if defined ProgramFiles(x86) (
123127
set SALT_URL=%SALT_64_URL%
124128
) else (
125129
set SALT_URL=%SALT_32_URL%
@@ -133,7 +137,6 @@ echo ==^> Creating "%SALT_DIR%"
133137
mkdir "%SALT_DIR%"
134138
pushd "%SALT_DIR%"
135139

136-
:: todo support CM_VERSION variable
137140
if exist "%SystemRoot%\_download.cmd" (
138141
call "%SystemRoot%\_download.cmd" "%SALT_URL%" "%SALT_PATH%"
139142
) else (

script/dump-logs.cmd

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@setlocal EnableDelayedExpansion EnableExtensions
22
@for %%i in (a:\_packer_config*.cmd) do @call "%%~i"
3-
@if not defined PACKER_DEBUG echo off
4-
3+
@if defined PACKER_DEBUG (@echo on) else (@echo off)
54

65
for %%i in ("%TEMP%\*.log.txt") do (
76
echo =========================================================================

script/enable-rdp.cmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@setlocal EnableDelayedExpansion EnableExtensions
22
@for %%i in (a:\_packer_config*.cmd) do @call "%%~i"
3-
@if not defined PACKER_DEBUG echo off
3+
@if defined PACKER_DEBUG (@echo on) else (@echo off)
44

55
echo ==^> Enabling RDP on port 3389
66
netsh advfirewall firewall add rule name="Open Port 3389" dir=in action=allow protocol=TCP localport=3389

script/reboot.cmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@setlocal EnableDelayedExpansion EnableExtensions
22
@for %%i in (a:\_packer_config*.cmd) do @call "%%~i"
3-
@if not defined PACKER_DEBUG echo off
3+
@if defined PACKER_DEBUG (@echo on) else (@echo off)
44

55
shutdown /s /t 10 /f /d p:4:1 /c Packer_Reboot
66
ping -t 127.0.0.1

script/regenerate-dotnet-cache.cmd

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
@setlocal EnableDelayedExpansion EnableExtensions
22
@for %%i in (a:\_packer_config*.cmd) do @call "%%~i"
3-
@if not defined PACKER_DEBUG echo off
3+
@if defined PACKER_DEBUG (@echo on) else (@echo off)
44

55
echo ==^> Regenerating .Net native image cache
66

7-
if exist "%SystemDrive%\Program Files (x86)" (
7+
if defined ProgramFiles(x86) (
88
set DOTNET_FRAMEWORK_DIR=%SystemRoot%\Microsoft.NET\Framework64
99
) else (
1010
set DOTNET_FRAMEWORK_DIR=%SystemRoot%\Microsoft.NET\Framework

script/save-logs.cmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@setlocal EnableDelayedExpansion EnableExtensions
22
@for %%i in (a:\_packer_config*.cmd) do @call "%%~i"
3-
@if not defined PACKER_DEBUG echo off
3+
@if defined PACKER_DEBUG (@echo on) else (@echo off)
44

55
echo ==^> Saving installation logs
66

script/save-temp-dirs.cmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@setlocal EnableDelayedExpansion EnableExtensions
22
@for %%i in (a:\_packer_config*.cmd) do @call "%%~i"
3-
@if not defined PACKER_DEBUG echo off
3+
@if defined PACKER_DEBUG (@echo on) else (@echo off)
44

55
echo ==^> Saving all installation files
66

script/sdelete.bat

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@setlocal EnableDelayedExpansion EnableExtensions
22
@for %%i in (a:\_packer_config*.cmd) do @call "%%~i"
3-
@if not defined PACKER_DEBUG echo off
3+
@if defined PACKER_DEBUG (@echo on) else (@echo off)
44

55
if not defined SDELETE_URL set SDELETE_URL=http://live.sysinternals.com/sdelete.exe
66

@@ -15,7 +15,7 @@ pushd "%SDELETE_DIR%"
1515
if exist "%SystemRoot%\_download.cmd" (
1616
call "%SystemRoot%\_download.cmd" "%SDELETE_URL%" "%SDELETE_PATH%"
1717
) else (
18-
echo ==^> Downloadling "%SDELETE_URL%" to "%SDELETE_PATH%"
18+
echo ==^> Downloading "%SDELETE_URL%" to "%SDELETE_PATH%"
1919
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('%SDELETE_URL%', '%SDELETE_PATH%')" <NUL
2020
)
2121
if not exist "%SDELETE_PATH%" goto exit1

0 commit comments

Comments
 (0)