Install windows 10 directly to a target disk / virtual disk from a running Linux system, without booting from an installation ISO.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
981 B

extract_prefix() {
local regfile="$1"
local prefix="$2"
local prefix_esc="$(echo "$prefix" | sed -re 's#\\#\\\\#g')"
cat "$regfile" \
| dos2unix \
| grep -E '^[^;]' \
| awk '/^Windows Re/ { print; want=1; next;} /^\[-?'"$prefix_esc"'/ { want=1; print ""; print; next;} /^\[/ { want=0; } (want) { print;}' \
| sed -re 's/CurrentControlSet/ControlSet001/g'
import_hive() {
local regfile="$1"
local prefix="$2"
local hive="$3"
if grep -qF "[$prefix" "$regfile"; then
echo "Importing $prefix -> $hive"
extract_prefix "$regfile" "$prefix" | hivexregedit --merge --prefix "$prefix" "$hive"
import_hive "$regfile" 'HKEY_LOCAL_MACHINE\SYSTEM' "$mnt/Windows/System32/config/SYSTEM"
import_hive "$regfile" 'HKEY_LOCAL_MACHINE\SOFTWARE' "$mnt/Windows/System32/config/SOFTWARE"
import_hive "$regfile" 'HKEY_CURRENT_USER' "$mnt/Users/Default/NTUSER.DAT"