Skip to content

Commit

Permalink
Update how version.txt and variables.txt works
Browse files Browse the repository at this point in the history
  • Loading branch information
brimstone committed Jun 22, 2017
1 parent 80ed747 commit b96733a
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 13 deletions.
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ This is simply run at first login after install. Place things in here like
silent installation instructions for programs either off the same iso or
downloaded from the internet.

### version.txt
This file should contain one of the following keys:
### variables.txt
This file should set at least one variable.

#### `version`
This should be one of the following keys:

|key |Version |
|---------|------------------------|
Expand All @@ -47,7 +50,20 @@ This file should contain one of the following keys:
|win7-64 |Windows 7 64-bit |
|win7-32 |Windows 7 32-bit |

#### `localmirror`
This should be the absolute address of a local mirror for ISOs. It can also be `"none"` for no mirror and no prompt. This allows truly unattended installation.


#### Example `variables.txt`
```
version=win10-64
localmirror=http://192.168.0.1/isos/
```

### Autounattend.xml
If this file is present on the ISO, it will be used instead of an
`Autounattend.xml` from the [boxcutter](https://github.com/boxcutter/windows)
project. Take care that this file matches the version in `version.xml`
project. Take care that this file matches the version in `version.xml` One
gotcha is how Windows 7 and Windows 2008 think the install media is DriveID 0
and the actual "C" drive is DriveID 1. Keep that in mind when crafting answer
files for this versions.
25 changes: 16 additions & 9 deletions debian-root/installer
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,23 @@ dialog(){
}

version=""
localmirror=""

if mount /dev/sr0 /iso; then
if [ -e /iso/version.txt ]; then
version="$(< /iso/version.txt)"
fi
if [ -e /iso/Autounattend.xml ]; then
au="/iso/Autounattend.xml"
else
au="/au/${version}.xml"
if [ -e /iso/variables.txt ]; then
. /iso/variables.txt
fi
fi

cmd="$(echo dialog --no-tags --radiolist '"Pick a version"' 20 60 13 $(awk -F, '{print $1,"\"" $2 "\"","off"}' /etc/versions) | sed 's/off/on/')"
cmd="$(echo dialog --title '"Windows Version Selection"' --no-tags --radiolist '"Select a Windows version to install"' 20 60 13 $(awk -F, '{print $1,"\"" $2 "\"","off"}' /etc/versions) | sed 's/off/on/')"
if [ -z "$version" ]; then
version="$(eval "$cmd" 3>&2 2>&1 1>&3)"
fi

# Allow just overriding of the Autounattend.xml file, based on version
if [ -e "/iso/${version}/Autounattend.xml" ]; then
au="/iso/${version}/Autounattend.xml"
else
au="/au/${version}.xml"
fi

Expand All @@ -36,7 +39,11 @@ fi
URL="$(awk -F, "\$1 == \"$version\" {print \$4}" /etc/versions)"
SHA1SUM="$(awk -F, "\$1 == \"$version\" {print \$3}" /etc/versions)"

localmirror="$(dialog --inputbox "Enter URL of local mirror. This can be left blank." 8 60 3>&2 2>&1 1>&3)"
if [ "$localmirror" != "none" ]; then
localmirror="$(dialog --title "Mirror selection" --inputbox "Enter URL of local mirror. This can be left blank." 8 60 3>&2 2>&1 1>&3)"
else
localmirror=""
fi

if [ -n "$localmirror" ]; then
URL="$localmirror/$(basename "$URL")"
Expand Down
Empty file added disk/.gitkeep
Empty file.
2 changes: 2 additions & 0 deletions iso/variables.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
version=win10-64
localmirror=none
1 change: 0 additions & 1 deletion iso/version.txt

This file was deleted.

0 comments on commit b96733a

Please sign in to comment.