_ 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
2013MAY13 EDIT:
_ Beta3 attached to post #22
2013JUN25 EDIT:
_ pm2ubcd2013JUN25 attached to post #43
2013JUL29 EDIT:
_ pm2ubcd2013JUL29 attached to post #44
Older posts:
post #43 ; post #22 and 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
ubcd-extracted/ubcd/tools/linux/pm2ubcd/, named
pm2ubcd.sh.
_ 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:
13_ "iso_filename=" parameter (to modify PMagic's syslinux.cfg);
21_ Path where the content of the PMagic ISO image is located (already extracted by the user);
32_ 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 "
ubcd-extracted". 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
Code: Select all
ubcd-extracted/pmagic/pmodules/PMAGIC_*.SQFS
2_ Move
ubcd-extracted/pmagic/boot/syslinux/*.cfgto
ubcd-extracted/pmagic/boot/syslinux/*_<MOVE_DATE__MOVE_TIME>.cfg.old
3_ Copy (overwriting files and merging directories):
Code: Select all
pmagic-extracted/pmagic/ ==>> ubcd-extracted/pmagic/
Code: Select all
pmagic-extracted/boot/ ==>> ubcd-extracted/pmagic/boot/
Code: Select all
ubcd-extracted/pmagic/boot/syslinux/*.c32
ubcd-extracted/pmagic/boot/syslinux/isohybrid
ubcd-extracted/pmagic/boot/syslinux/isolinux*.*
ubcd-extracted/pmagic/boot/syslinux/mbr.bin
ubcd-extracted/pmagic/boot/syslinux/memdisk
ubcd-extracted/pmagic/boot/syslinux/*.cfgas follows:
5.1_
Code: Select all
F<digit> *message*.txt
==>> F<digit> /pmagic/boot/syslinux/message*.txt
Code: Select all
initrd=/pmagic/initrd.img
==>> initrd=/pmagic/initrd.img iso_filename=ubcd521.iso
ubcd521.iso" 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.
Code: Select all
# Change the working directory to the root directory of the extracted iso.
SCRIPTDIR=`dirname "${0}"`
cd "${SCRIPTDIR}/../../../../"
# 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'
done
# 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'
# done
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.
TIA,
Ady.