_ 2013MAY01 EDIT:
_ Changed the order of the arguments, according to the first beta. When executed with no arguments, a simple help is displayed. The arguments are increasingly optional, so it is possible to provide just the "pmagic-extracted" path and the script should work, asking confirmation from the user._ First beta attached to post #12, reply #11._ Beta2 attached to post #15
_ Beta3 attached to post #22
; post #12
and post #15
are still relevant (read them)
I am seeking help here to put together a pm2ubcd.sh script to customize UBCD with an updated version of PMagic. Since PMagic releases are much more frequent than UBCD's ones, this should simplify the task for users, in a similar way as other scripts in UBCD. If it works as expected, Victor can hopefully add it to the next release of UBCD.
Here are the minimal conditions and goals:
_ The script would be located under
_ The task of downloading and extracting the content of (Pmagic's and UBCD's) ISO images is up to the user.
_ The script should not care about the specific version or variant of PMagic. The user might want to use an older version of PMagic, or a newer one, or a different variant (i586, i686, x86_64).
_ The script should work on UBCD v5.2.1. Older versions of UBCD won't be supported by the script.
_ Similarly to other scripts in UBCD, the arguments needed by the script would be: 1
3_ "iso_filename=" parameter (to modify PMagic's syslinux.cfg); 2
1_ Path where the content of the PMagic ISO image is located (already extracted by the user); 3
2_ Path where the content of UBCD is located (already extracted by the user).
There could be an alternative way to the first argument. Instead of the user having to provide the "iso_filename=" argument, it could (potentially) be read from other files in "
". For the time being, I'm inclined to request this parameter from the user.
_ The script should
1_ Delete the prior squashfs PMagic file(s) such as
Any other (modules, scripts, personal, configuration) files are not to be touched.
3_ Copy (overwriting files and merging
pmagic-extracted/pmagic/ ==>> ubcd-extracted/pmagic/
pmagic-extracted/boot/ ==>> ubcd-extracted/pmagic/boot/
4_ Delete unnecessary files (or exclude them from the previous "copy" step):
5_ Using "sed" and other "auxiliary tools" in a similar way as used in other scripts already included in UBCD, the new pm2ubcd.sh script should edit
==>> F<digit> /pmagic/boot/syslinux/message*.txt
==>> initrd=/pmagic/initrd.img iso_filename=ubcd521.iso
which in fact is dependent on the first argument of the script but I used here "
" just for clarity.
6_ Finally, executing the script without options should offer help about the script (let's leave this condition for later discussion).
The above conditions cover i586, i686 and dual x32/x64 variants of PMagic and UBCD v5.2.x.
The following are "parts and pieces" of the above condition #5 of the pm2ubcd.sh script, in alpha stage; has NOT been tested, and it may possibly contain pseudo-code.
# Change the working directory to the root directory of the extracted iso.
# Get all syslinux config files from /pmagic/boot/syslinux/, that need to be edited.
SYSLINUX_CONFIGFILES_PMAGIC=`find ./pmagic/boot/syslinux/ -name '*.cfg'`
# 'Point to /pmagic/boot/syslinux/ where appropriate:'
for SYSLINUX_CONFIGFILE_PMAGIC in $SYSLINUX_CONFIGFILES_PMAGIC; do
sed 's|^F[[:digit:]] \(.*\)\message\(.*\)\.txt|^F[[:digit:]] /pmagic/boot/syslinux/message\2\.txt'
# NEED TO ESTABLISH ISO_FILENAME VARIABLE FROM SCRIPT FIRST ARGUMENT
# 'Add iso_filename parameter'
# for SYSLINUX_CONFIGFILE_PMAGIC in $SYSLINUX_CONFIGFILES_PMAGIC; do
# sed 's| initrd=/pmagic/initrd.img | initrd=/pmagic/initrd.img iso_filename=ubcd521.iso'
I would like to request help to put together the complete script, respecting all the aforementioned conditions / steps.
Suggestions, ideas, improvements, code... are all welcome.