Closed ZouYuhua closed 1 year ago
So I just tried out number 2 here, where you used pycdlib-explorer to add a file and then write out the ISO. It worked totally fine for me here; it added the file, it wrote it out, and then I could see the file in the resulting ISO.
When you say "it doesn't work", what does that mean? How did you check whether the file existed?
So I just tried out number 2 here, where you used pycdlib-explorer to add a file and then write out the ISO. It worked totally fine for me here; it added the file, it wrote it out, and then I could see the file in the resulting ISO.
When you say "it doesn't work", what does that mean? How did you check whether the file existed?
Sorry for the delayed reply due to Chinese National holidays.
Try number 2 in my Mac: zouy@zouy-a02 ~ % /usr/local/bin/pycdlib-explorer ~/Documents/ubuntu-20.04.5-desktop-amd64.iso (pycdlib) add_file /TEST01.CFG;1 /Users/zouy/Documents/test01.cfg rr_name=test01.cfg (pycdlib) add_file /GRUB.CFG;1 /Users/zouy/Documents/grub.cfg rr_name=grub.cfg (pycdlib) write /Users/zouy/Documents/ubuntu-20.04.5-desktop-amd64-new.iso (pycdlib) exit
when extract /Users/zouy/Documents/ubuntu-20.04.5-desktop-amd64-new.iso, The files test01.cfg and grub.cfg are not found. I suspect API "add_file" does not work for some kind of ISO files or in some python version.
zouy@zouy-a02 ~ % ls -al /Users/zouy/Documents/ total 20562064 drwx------+ 26 zouy staff 832 Oct 13 10:11 . drwxr-xr-x+ 25 zouy staff 800 Oct 13 10:11 .. -rw-r--r--@ 1 zouy staff 8196 Oct 13 10:09 .DS_Store drwxr-xr-x@ 6 zouy staff 192 Oct 13 09:35 .beacon -rw-r--r-- 1 zouy staff 0 Sep 28 14:15 .localized -rw-r--r--@ 1 zouy staff 961 Sep 29 17:56 grub.cfg -rw-r--r-- 1 zouy staff 4 Sep 30 11:00 test01.cfg -rwx---rw-@ 1 zouy staff 2785017856 Aug 10 2020 ubuntu-20.04.1-desktop-amd64.iso -rw-r--r-- 1 zouy staff 3867139584 Oct 13 10:11 ubuntu-20.04.5-desktop-amd64-new.iso -rwx---rw-@ 1 zouy staff 3864182784 Sep 2 11:25 ubuntu-20.04.5-desktop-amd64.iso -rw-rw-rw-@ 1 zouy staff 2136 Jul 18 20:18 ubuntu.seed
Env: zouy@zouy-a02 ~ % pip3 list pycdlib Package Version pip 22.2.2 pycdlib 1.13.0 PyYAML 6.0 setuptools 63.4.3 six 1.16.0 wheel 0.37.1 zouy@zouy-a02 ~ % python3 --version Python 3.10.6
Best regards Yuhua Zou
So after looking at this and thinking about it, I think I know what is going on.
What I think is happening is that you are creating the new files, but only in the ISO9660/Rock Ridge context. That is, you are never specifying the joliet_path
, so when Windows (or something else that prefers Joliet) goes to use it, the new files aren't there.
To get the behavior you want, you'll want to use the following:
zouy@zouy-a02 ~ % /usr/local/bin/pycdlib-explorer ~/Documents/ubuntu-20.04.5-desktop-amd64.iso
(pycdlib) add_file /TEST01.CFG;1 /Users/zouy/Documents/test01.cfg rr_name=test01.cfg joliet_path=/test01.cfg
(pycdlib) add_file /GRUB.CFG;1 /Users/zouy/Documents/grub.cfg rr_name=grub.cfg joliet_path=/grub.cfg
(pycdlib) write /Users/zouy/Documents/ubuntu-20.04.5-desktop-amd64-new.iso
(pycdlib) exit
Given that, I don't think this is a bug in pycdlib, so I'm going to close this out. If the above still doesn't work for you, please feel free to reopen and I'll take another look.
function "add_file" does not work with some kind of ISO file such as ubuntu-20.04.1-desktop-amd64.iso and ubuntu-20.04.5-desktop-amd64.iso (Rock Ridge ISO)
1. I write a python script to modify ISO using package pycdlib. Following the debug info, I find "add_file" does not work for the ISO ubuntu-20.04.1-desktop-amd64.iso and ubuntu-20.04.5-desktop-amd64.iso. The function "add_file" does not throw exception.
Piece of code as follows:
2. I use the tools pycdlib-explorer to add a file to ISO ubuntu-20.04.1-desktop-amd64.iso and it does not work too. zouy@zouy-a02 ~ % /usr/local/bin/pycdlib-explorer Usage: /usr/local/bin/pycdlib-explorer
zouy@zouy-a02 ~ %
zouy@zouy-a02 ~ % /usr/local/bin/pycdlib-explorer ~/Documents/ubuntu-20.04.1-desktop-amd64.iso
(pycdlib) add_file /TEST01.CFG;1 /Users/zouy/Documents/test01.cfg rr_name=test01.cfg
(pycdlib) write /Users/zouy/Documents/ubuntu-20.04.1-desktop-amd64-new.iso
(pycdlib) exit
Env: zouy@zouy-a02 ~ % pip3 list pycdlib Package Version pip 22.2.2 pycdlib 1.13.0 PyYAML 6.0 setuptools 63.4.3 six 1.16.0 wheel 0.37.1 zouy@zouy-a02 ~ % python3 --version Python 3.10.6
Would some one please help me with it ? Thanks very much.