From 687fb342458e6196b4a87d553b4835f148fb1dbb Mon Sep 17 00:00:00 2001 From: sidneys Date: Tue, 7 Apr 2020 22:41:41 +0200 Subject: [PATCH 1/6] feat(macos-compatibility): add os-specific dependency checks and installation help --- convert.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/convert.sh b/convert.sh index 2e4c124..8b40000 100644 --- a/convert.sh +++ b/convert.sh @@ -284,16 +284,27 @@ fi if ! which cabextract >/dev/null 2>&1 \ || ! which wimlib-imagex >/dev/null 2>&1 \ || ! which chntpw >/dev/null 2>&1 \ -|| ! which genisoimage >/dev/null 2>&1; then +|| ! which genisoimage >/dev/null 2>&1 \ +&& ! which mkisofs >/dev/null 2>&1; then echo "One of required applications is not installed." echo "The following applications need to be installed to use this script:" echo " - cabextract" echo " - wimlib-imagex" echo " - chntpw" - echo " - genisoimage" + echo " - genisoimage (or mkisofs)" echo "" + + if [[ "$(uname)" == "Linux" ]]; then + # Linux echo "If you use Debian or Ubuntu you can install these using:" echo "sudo apt-get install cabextract wimtools chntpw genisoimage" + elif [[ "$(uname)" == "Darwin" ]]; then + # macOS + echo "If you use Homebrew, you can install these using:" + echo "brew tap sidneys/homebrew" + echo "brew install cabextract wimlib cdrtools sidneys/homebrew/chntpw" + fi + exit 1 fi From 9e50b92ecd97e928035e6791df3ea03230f757a6 Mon Sep 17 00:00:00 2001 From: sidneys Date: Tue, 7 Apr 2020 22:43:50 +0200 Subject: [PATCH 2/6] feat(macos-compatibility): add usage of mkisofs instead of genisoimage when appropriate (on macOS) --- convert.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) mode change 100644 => 100755 convert.sh diff --git a/convert.sh b/convert.sh old mode 100644 new mode 100755 index 8b40000..fbd0cb0 --- a/convert.sh +++ b/convert.sh @@ -296,8 +296,8 @@ if ! which cabextract >/dev/null 2>&1 \ if [[ "$(uname)" == "Linux" ]]; then # Linux - echo "If you use Debian or Ubuntu you can install these using:" - echo "sudo apt-get install cabextract wimtools chntpw genisoimage" + echo "If you use Debian or Ubuntu you can install these using:" + echo "sudo apt-get install cabextract wimtools chntpw genisoimage" elif [[ "$(uname)" == "Darwin" ]]; then # macOS echo "If you use Homebrew, you can install these using:" @@ -566,7 +566,13 @@ fi echo -e "$infoColor""Creating ISO image...""$resetColor" find ISODIR -exec touch {} + -genisoimage -b "boot/etfsboot.com" --no-emul-boot \ +# Use mkisofs instead of genisoimage if it was not found +$genisoimage=`which genisoimage >/dev/null 2>&` +if [ -z $genisoimage ]; then + $genisoimage=`which mkisofs >/dev/null 2>&` +fi + +"$genisoimage" -b "boot/etfsboot.com" --no-emul-boot \ --eltorito-alt-boot -b "efi/microsoft/boot/efisys.bin" --no-emul-boot \ --udf --hide "*" -V "$isoLabel" -o "$isoName" ISODIR From 32269042abd167c9b49fcbb0a8c149efd9e852b3 Mon Sep 17 00:00:00 2001 From: sidneys Date: Tue, 7 Apr 2020 23:10:33 +0200 Subject: [PATCH 3/6] feat(macos-compatibility): remove requirement for gnu-version of `sed` which supports case-insensitive search, by converting all characters to lowercase before usage --- convert.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/convert.sh b/convert.sh index fbd0cb0..b4dd6cd 100755 --- a/convert.sh +++ b/convert.sh @@ -374,7 +374,7 @@ fi list= -lang=$(grep -i "_..-.*.esd" <<< "$metadataFiles" | head -1 | sed 's/.*_//g;s/.esd//gi') +lang=$(grep -i "_..-.*.esd" <<< "$metadataFiles" | head -1 | tr '[:upper:]' '[:lower:]' | sed 's/.*_//g;s/.esd//g') metadataFiles=$(grep -i "$lang" <<< "$metadataFiles" | sort | uniq) firstMetadata=$(head -1 <<< "$metadataFiles") From b19bfd5b54233e1455a725dc28b0b14d2ce421cc Mon Sep 17 00:00:00 2001 From: sidneys Date: Tue, 7 Apr 2020 23:33:43 +0200 Subject: [PATCH 4/6] feat(macos-compatibility): add support for and documentation of macOS configuration file `convert_config_macos` --- convert.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/convert.sh b/convert.sh index b4dd6cd..d0da0a1 100755 --- a/convert.sh +++ b/convert.sh @@ -6,8 +6,10 @@ if [ -f `dirname $0`/convert_ve_plugin ]; then . `dirname $0`/convert_ve_plugin fi -if [ -f `dirname $0`/convert_config_linux ]; then +if [ -f `dirname $0`/convert_config_linux ] && [ `uname` == "Linux" ]; then . `dirname $0`/convert_config_linux +elif [ -f `dirname $0`/convert_config_macos ] && [ `uname` == "Darwin" ]; then + . `dirname $0`/convert_config_macos else VIRTUAL_EDITIONS_LIST="CoreSingleLanguage Enterprise EnterpriseN Education \ EducationN ProfessionalEducation ProfessionalEducationN \ @@ -266,7 +268,11 @@ if [ "$1" == "-?" -o "$1" == "--help" -o "$1" == "-h" ]; then echo "0 - do not create virtual editions (default)" echo "1 - create virtual edtitions" echo "" + if [ `uname` == "Linux" ]; then echo -e "${infoColor}convert_config_linux file${resetColor}" + elif [ `uname` == "Darwin" ]; then + echo -e "${infoColor}convert_config_macos file${resetColor}" + fi echo "This file can be used to configure some advanced options of this script." echo "It is required to place configuration in the same directory as script." echo "" From cf56b0077ae7a28f4cb9f6e5141aa7af38ed3db2 Mon Sep 17 00:00:00 2001 From: sidneys Date: Tue, 7 Apr 2020 23:34:25 +0200 Subject: [PATCH 5/6] chore(macos-compatibility): consolidate script syntax --- convert.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/convert.sh b/convert.sh index d0da0a1..df7857c 100755 --- a/convert.sh +++ b/convert.sh @@ -269,7 +269,7 @@ if [ "$1" == "-?" -o "$1" == "--help" -o "$1" == "-h" ]; then echo "1 - create virtual edtitions" echo "" if [ `uname` == "Linux" ]; then - echo -e "${infoColor}convert_config_linux file${resetColor}" + echo -e "${infoColor}convert_config_linux file${resetColor}" elif [ `uname` == "Darwin" ]; then echo -e "${infoColor}convert_config_macos file${resetColor}" fi @@ -297,14 +297,14 @@ if ! which cabextract >/dev/null 2>&1 \ echo " - cabextract" echo " - wimlib-imagex" echo " - chntpw" - echo " - genisoimage (or mkisofs)" + echo " - genisoimage or mkisofs" echo "" - if [[ "$(uname)" == "Linux" ]]; then + if [ `uname` == "Linux" ]; then # Linux echo "If you use Debian or Ubuntu you can install these using:" echo "sudo apt-get install cabextract wimtools chntpw genisoimage" - elif [[ "$(uname)" == "Darwin" ]]; then + elif [ `uname` == "Darwin" ]; then # macOS echo "If you use Homebrew, you can install these using:" echo "brew tap sidneys/homebrew" @@ -572,10 +572,10 @@ fi echo -e "$infoColor""Creating ISO image...""$resetColor" find ISODIR -exec touch {} + -# Use mkisofs instead of genisoimage if it was not found -$genisoimage=`which genisoimage >/dev/null 2>&` -if [ -z $genisoimage ]; then - $genisoimage=`which mkisofs >/dev/null 2>&` +# Use mkisofs as fallback to genisoimage +genisoimage="$(command -v genisoimage)" +if [ -z "$genisoimage" ]; then + genisoimage="$(command -v mkisofs)" fi "$genisoimage" -b "boot/etfsboot.com" --no-emul-boot \ From 8812fcd7f0b33f3238307f62da3608e627b2ccb0 Mon Sep 17 00:00:00 2001 From: sidneys Date: Tue, 7 Apr 2020 23:56:04 +0200 Subject: [PATCH 6/6] docs(macos-compatibility): update README with information regarding macOS --- convert.sh | 3 +-- readme.md | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/convert.sh b/convert.sh index df7857c..7f86824 100755 --- a/convert.sh +++ b/convert.sh @@ -299,18 +299,17 @@ if ! which cabextract >/dev/null 2>&1 \ echo " - chntpw" echo " - genisoimage or mkisofs" echo "" - if [ `uname` == "Linux" ]; then # Linux echo "If you use Debian or Ubuntu you can install these using:" echo "sudo apt-get install cabextract wimtools chntpw genisoimage" elif [ `uname` == "Darwin" ]; then # macOS + echo "macOS requires Homebrew (https://brew.sh) to install the prerequisite software." echo "If you use Homebrew, you can install these using:" echo "brew tap sidneys/homebrew" echo "brew install cabextract wimlib cdrtools sidneys/homebrew/chntpw" fi - exit 1 fi diff --git a/readme.md b/readme.md index 39e08fb..af5c239 100644 --- a/readme.md +++ b/readme.md @@ -2,7 +2,7 @@ UUP converter ------------- ### Description -A basic UUP converter aimed for Linux users who don't have access to any +A basic UUP converter aimed at Linux and macOS users who don't have access to any Windows machine, but want or need to create an ISO image for latest Windows Insider version downloaded from UUP dump. @@ -50,7 +50,7 @@ option. ### Configuration file Configuration of advanced script options can be modified using -convert_config_linux file. +the file `convert_config_linux` (on Linux) or `convert_config_macos` (on macOS). ###### Configuration options ``` @@ -66,14 +66,25 @@ This script uses the following commands to do its work: * cabextract - to extract cabs * wimlib-imagex - to export files from metadata ESD * chntpw - to modify registry of first index of boot.wim - * genisoimage - to create ISO image + * genisoimage or mkisofs - to create ISO image +###### Linux If you use Debian or Ubuntu based distribution you can quickly install these using the following command: -``` +```bash sudo apt-get install cabextract wimtools chntpw genisoimage ``` If you use any other distribution, then you will need to check its repository for packages needed to run this script. + +###### macOS +macOS requires [Homebrew](https://brew.sh) to install the prerequisite software. +After Homebrew was installed, you can install the requirements using: + +```bash +brew tap sidneys/homebrew +brew install cabextract wimlib cdrtools sidneys/homebrew/chntpw +``` +