Missing documentation, small fix #1

Open
opened 2023-07-27 18:33:49 +03:00 by bmaupin · 0 comments
bmaupin commented 2023-07-27 18:33:49 +03:00 (Migrated from codeberg.org)

Hi! This project is really interesting. It's one-of-a-kind as far as I can tell.

If I get a chance, I can try to create one or more pull requests, but in the meantime here's what I had to do to get this working.

Bug

First I had to fix a small bug:

$ git diff
diff --git a/setup_win10.py b/setup_win10.py
index ba4c20a..e7efdda 100755
--- a/setup_win10.py
+++ b/setup_win10.py
@@ -243,7 +243,7 @@ def main(*, disk=None, part=None, wim=None, iso=None, image_name=None, unattend=
                     with with_mounted(part) as win_mnt, with_mounted(esp, fs='fat') as esp_mnt:
                         copy_efi_files(win_mnt, esp_mnt)
         else:
-            setup_part(part, unattend=unattend, postproc=postproc, postproc_only=postproc_only)
+            setup_part(part, wim, image_name, unattend=unattend, postproc=postproc, postproc_only=postproc_only)

 if __name__ == '__main__':
     clize.run(main)

Documentation

Then I had to figure out how to actually use the project. This is what I figured out on my own, but I may have missed some things:

Necessary system packages

  • libparted-dev (to use python-parted)
  • ms-sys
  • wimtools (for wimapply)

On Ubuntu I did this:

wget https://launchpad.net/~eugenesan/+archive/ubuntu/ppa/+files/ms-sys_2.7.0-0~eugenesan~bionic1_amd64.deb
sudo dpkg -i ms-sys_2.7.0-0~eugenesan~bionic1_amd64.deb
rm ms-sys_2.7.0-0~eugenesan~bionic1_amd64.deb
sudo apt install libparted-dev wimtools

Necessary python packages

Maybe it would be good to put these in a requirements.txt file?

  • clize
  • construct
  • python-parted

Unfortunately I wasn't able to run the script as my normal user since it requires root. But I didn't want to install those Python packages using pip as root due to conflicts with system packages, so I created a virtual env as root and installed the packages here:

sudo -i
python -m venv deploy-win10-from-linux-venv
source deploy-win10-from-linux-venv/bin/activate
pip install --upgrade pip
pip install clize construct python-parted

Determining the image name

I had to extract sources/install.wim from the Windows installation ISO, and then run this command to list the image names:

wiminfo install.wim

Running the script

As best as I could tell, these are the required arguments:

  • --iso or --wim
  • --image-name
  • --disk or --part

This is the full command I used:

python /home/user/workspace/personal/deploy-win10-from-linux/setup_win10.py --iso /home/user/Desktop/tmp-windows-10/Win10_22H2_English_x64v1.iso --image-name "Windows 10 Pro" --part /dev/sdc1

Set boot flag on NTFS partition

Lastly, using GParted I had to set the boot flag on the NTFS partition, otherwise Windows wouldn't boot: In GParted, right-click the partition > Manage Flags > make sure boot is checked > Close

Hi! This project is really interesting. It's one-of-a-kind as far as I can tell. If I get a chance, I can try to create one or more pull requests, but in the meantime here's what I had to do to get this working. ## Bug First I had to fix a small bug: ``` $ git diff diff --git a/setup_win10.py b/setup_win10.py index ba4c20a..e7efdda 100755 --- a/setup_win10.py +++ b/setup_win10.py @@ -243,7 +243,7 @@ def main(*, disk=None, part=None, wim=None, iso=None, image_name=None, unattend= with with_mounted(part) as win_mnt, with_mounted(esp, fs='fat') as esp_mnt: copy_efi_files(win_mnt, esp_mnt) else: - setup_part(part, unattend=unattend, postproc=postproc, postproc_only=postproc_only) + setup_part(part, wim, image_name, unattend=unattend, postproc=postproc, postproc_only=postproc_only) if __name__ == '__main__': clize.run(main) ``` ## Documentation Then I had to figure out how to actually use the project. This is what I figured out on my own, but I may have missed some things: #### Necessary system packages - `libparted-dev` (to use `python-parted`) - `ms-sys` - `wimtools` (for `wimapply`) On Ubuntu I did this: ``` wget https://launchpad.net/~eugenesan/+archive/ubuntu/ppa/+files/ms-sys_2.7.0-0~eugenesan~bionic1_amd64.deb sudo dpkg -i ms-sys_2.7.0-0~eugenesan~bionic1_amd64.deb rm ms-sys_2.7.0-0~eugenesan~bionic1_amd64.deb sudo apt install libparted-dev wimtools ``` #### Necessary python packages Maybe it would be good to put these in a [`requirements.txt` file](https://learnpython.com/blog/python-requirements-file/)? - `clize` - `construct` - `python-parted` Unfortunately I wasn't able to run the script as my normal user since it requires root. But I didn't want to install those Python packages using `pip` as root due to conflicts with system packages, so I created a virtual env as root and installed the packages here: ``` sudo -i python -m venv deploy-win10-from-linux-venv source deploy-win10-from-linux-venv/bin/activate pip install --upgrade pip pip install clize construct python-parted ``` #### Determining the image name I had to extract sources/install.wim from the Windows installation ISO, and then run this command to list the image names: ``` wiminfo install.wim ``` #### Running the script As best as I could tell, these are the required arguments: - `--iso` or `--wim` - `--image-name` - `--disk` or `--part` This is the full command I used: ``` python /home/user/workspace/personal/deploy-win10-from-linux/setup_win10.py --iso /home/user/Desktop/tmp-windows-10/Win10_22H2_English_x64v1.iso --image-name "Windows 10 Pro" --part /dev/sdc1 ``` #### Set boot flag on NTFS partition Lastly, using GParted I had to set the _boot_ flag on the NTFS partition, otherwise Windows wouldn't boot: In GParted, right-click the partition > _Manage Flags_ > make sure _boot_ is checked > _Close_
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: arti/deploy-win10-from-linux#1
No description provided.