added scripts for usb sticke generation

This commit is contained in:
Michael H.G. Schmidt 2021-03-14 19:39:32 +01:00
parent edc363b672
commit 50bad7b9f0
5 changed files with 228 additions and 16 deletions

59
CreateStick.cmd Normal file
View File

@ -0,0 +1,59 @@
@echo off
rem ===================
rem COMMANDLINE CHECKS
rem ===================
IF %1.==. GOTO USAGE
IF %2.==. GOTO USAGE
rem get fullpath of isofile ...
set USBDRIVE=%1
set ISOFILE=%~f2
if NOT EXIST %ISOFILE% (
echo ERROR: file %ISOFILE% not found!
exit /b
)
if /I %USBDRIVE% == C: (
echo ERROR: cannot use drive %USBDRIVE% !
exit /b
)
if NOT EXIST %USBDRIVE% (
echo ERROR: drive %USBDRIVE% not found!
exit /b
)
rem =====
rem MAIN
rem =====
echo.
echo ##########################################
echo using drive %USBDRIVE% ...
echo using image %ISOFILE% ...
echo mounting disk image (iso) with powershell ...
powershell Mount-DiskImage -ImagePath %ISOFILE%
echo copying files from image to targetpath %USBDRIVE% ...
robocopy \\.\CDROM0 %USBDRIVE% /MIR /256 /NFL /NDL
echo unmounting disk image (iso) ...
powershell Dismount-Diskimage -ImagePath %ISOFILE%
echo READY.
echo.
rem =====
rem END
rem =====
GOTO END
:USAGE
echo "usage: %0 <USBDRIVE> <ISOFILE>"
:END

89
FormatStick.cmd Normal file
View File

@ -0,0 +1,89 @@
@echo off
set T=c:\TEMP
set DPARTSCRIPT=%T%\diskpart.txt
echo.
echo ##########################################
rem create temp directory and cleanup ...
mkdir %T% 1>nul 2>nul
del /Y %DPARTSCRIPT% 1>nul 2>nul
rem =====
rem QUESTIONS
rem =====
echo.
echo Showing disk list ...
> %DPARTSCRIPT% (
@echo.list disk
@echo.exit
@echo.
)
diskpart /s %DPARTSCRIPT% 2>nul
set DISK=
:askdisk
set /p DISK="Please select a disk: "
> %DPARTSCRIPT% (
@echo.select disk %DISK%
@echo.exit
@echo.
)
diskpart /s %DPARTSCRIPT% 1>nul 2>nul
if %errorlevel% EQU 0 (
echo OK using disk %DISK%
GOTO CONT1
) else (
echo ERROR: please select a valid disk number!
)
goto askdisk
:CONT1
set LABEL=
set /p LABEL="Please enter a label for the new disk: "
echo WARNING ! This will DELETE ALL data on disk number [ %DISK% ]
echo.
set answer=
:askyes
set /p answer="REALLY delete disk %DISK% (Y/N)? "
if /i "%answer:~,1%" EQU "Y" (
GOTO CONT2
)
if /i "%answer:~,1%" EQU "N" (
echo ABORT.
exit /b
)
echo Please type Y or N.
goto askyes
:CONT2
rem =====
rem MAIN
rem =====
> %DPARTSCRIPT% (
@echo.select disk %DISK%
@echo.clean
@echo.create partition primary
@echo.select partition 1
@echo.format fs=fat32 LABEL="%LABEL%" quick
@echo.active
@echo.exit
@echo.
)
diskpart /s %DPARTSCRIPT% 1>nul 2>nul
if %errorlevel% NEQ 0 (
echo ERROR: while formatting the disk!
exit /b
)
echo READY. USB stick formatted.
rem =====
rem END
rem =====

View File

@ -1,11 +1,14 @@
@echo off
set SOURCES=c:\TEMP\W10\sources
set IMAGE=install_FINAL.esd
set ALTIMAGE=install_FINAL_lastrun.esd
rem ===================
rem COMMANDLINE CHECKS
rem ===================
IF %1.==. GOTO USAGE
set USBDRIVE=%1
if /I %USBDRIVE% == C: (
@ -13,13 +16,15 @@ if /I %USBDRIVE% == C: (
exit /b
)
echo using drive %USBDRIVE% ...
if NOT EXIST %USBDRIVE% (
echo ERROR: drive %USBDRIVE% not found!
exit /b
)
echo.
echo ##########################################
echo using drive %USBDRIVE% ...
rem =====
rem MAIN
rem =====
@ -30,25 +35,43 @@ set answer=
if /i "%answer:~,1%" EQU "B" (
echo selected: BIOS
copy /Y autounattend_BIOS.xml %USBDRIVE%\autounattend.xml
GOTO CONT
GOTO CONT
)
if /i "%answer:~,1%" EQU "U" (
echo selected: UEFI
copy /Y autounattend_UEFI.xml %USBDRIVE%\autounattend.xml
GOTO CONT
GOTO CONT
)
echo Please type B for BIOS or U for UEFI setup.
goto ask
:CONT
if EXIST %SOURCES%\install_FINAL.esd (
echo copying install.esd to drive %USBDRIVE% ...
robocopy %SOURCES% %USBDRIVE%\sources install_FINAL.esd /J /NJH
del /F %USBDRIVE%\sources\install.esd
move /Y %USBDRIVE%\sources\install_FINAL.esd %USBDRIVE%\sources\install.esd
move /Y %SOURCES%\install_FINAL.esd %SOURCES%\install_FINAL_lastrun.esd
if EXIST %SOURCES%\%IMAGE% (
echo.
echo copying [ %IMAGE ] to drive %USBDRIVE% ...
robocopy %SOURCES% %USBDRIVE%\sources %IMAGE% /J /NJH
rem move image in place ...
del /F %USBDRIVE%\sources\install.esd 2>nul
move /Y %USBDRIVE%\sources\%IMAGE% %USBDRIVE%\sources\install.esd
rem rename image in sources directory ...
move /Y %SOURCES%\%IMAGE% %SOURCES%\%ALTIMAGE%
) else (
echo.
echo INFO: NOT copying image!
echo.
echo HINT: please rename
echo [ %SOURCES%\%ALTIMAGE% ]
echo to [ %SOURCES%\%IMAGE% ]
echo for force copy of image.
)
:CONT
echo.
if EXIST tools (
echo copying folder tools to drive %USBDRIVE% ...
@ -66,6 +89,8 @@ for %%P in (software scripts source optional personal) do (
echo.
echo copying custom setup script to %USBDRIVE% ...
copy /Y CustomSetup.cmd %USBDRIVE%\
echo READY.
echo.
rem =====
rem END

View File

@ -4,12 +4,16 @@
" "
"""""""""""""""""""""""""""""""
set showmode
set history=700 "Sets how many lines of history VIM has to remember
set ttimeoutlen=50 "Speed up O etc in the Terminal
set autoread "Set to auto read when a file is changed from the outside
set bs=2 "allow backspace
set scrolloff=6 "start scrolling 5 lines before edge of viewport
set pastetoggle=<f10> "Better paste behavior
"Better paste behavior
nnoremap <f10> :set invpaste paste?<CR>
set pastetoggle=<f10>
"Search Options
set ignorecase "Ignore case when searching
@ -27,8 +31,11 @@ set noswapfile
" "
"""""""""""""""""""""""""""""""
"dont't show line numbers
set nonumber
"Show line numbers
set number
"Toggle line numbers on f9
nnoremap <f9> :set invnumber number?<CR>
"Transform tabs to spaces
set tabstop=8
@ -53,11 +60,36 @@ set noerrorbells visualbell t_vb=
" Statusline "
" "
"""""""""""""""""""""""""""""""
let g:currentmode={
\ 'n' : 'Normal',
\ 'no' : 'Normal Operator Pending',
\ 'v' : 'Visual',
\ 'V' : 'V-Line',
\ '^V' : 'V-Block',
\ 's' : 'Select',
\ 'S' : 'S-Line',
\ '^S' : 'S-Block',
\ 'i' : 'Insert',
\ 'R' : 'Replace',
\ 'Rv' : 'V-Replace',
\ 'c' : 'Command',
\ 'cv' : 'Vim Ex',
\ 'ce' : 'Ex',
\ 'r' : 'Prompt',
\ 'rm' : 'More',
\ 'r?' : 'Confirm',
\ '!' : 'Shell',
\ 't' : 'Terminal'
\}
set laststatus=2
hi User1 ctermbg=green ctermfg=red guibg=green guifg=red
hi User2 ctermbg=red ctermfg=white guibg=red guifg=blue
hi User3 ctermbg=blue ctermfg=green guibg=white guifg=green
hi User2 ctermbg=red ctermfg=white guibg=red guifg=white
hi User3 ctermbg=blue ctermfg=green guibg=blue guifg=green
hi User4 ctermbg=cyan ctermfg=black guibg=cyan guifg=black
hi User5 ctermbg=blue ctermfg=black guibg=blue guifg=black
set statusline=
set statusline+=%1* "switch to User1 highlight
@ -67,8 +99,15 @@ set statusline+=\ %-40F
set statusline+=%= "move to right
set statusline+=%5* "switch to User5 highlight
set statusline+=\ F9=linenumbers "user help
set statusline+=\ F10=pastemode\ "user help
set statusline+=%2* "switch to User2 highlight
set statusline+=\ %{&fileencoding?&fileencoding:&encoding}
set statusline+=\ [%{&fileformat}\]
set statusline+=\ %8((%l,%c)%)
set statusline+=\ %P
set statusline+=\ %P\ "percent and space at end off string
set statusline+=%4* "switch to User4 highlight
set statusline+=\ %{toupper(g:currentmode[mode()])}\ "The current mode

Binary file not shown.