TheChymera / mkstage4

Bash Utility for Creating Stage 4 Tarballs
GNU General Public License v3.0
104 stars 22 forks source link

Multiple custom options not recognized #50

Open sabalinux opened 11 months ago

sabalinux commented 11 months ago

Hi

Multiple custom options error

Adding more than 1 custom option , tar command doesn't recognized them : (i.e.: adding --totals -v --strip-components=2) to the mkstage commnd options

I got under single quote a unique option that tar not recognized:

Running mkstage4 : mkstage4 -t /mnt/bind-home test-home --totals -v --strip-components=2

mkstage4 output : '[...] --exclude=/mnt/bind-home/usr/portage/*' '--totals -v --strip-components=2' -f /run/media/nykay/Backup-1/tar/test-home.tar.bz2 /mnt/bind-home/ tar: unrecognized option '--totals -v --strip-components=2' Try 'tar --help' or 'tar --usage' for more information.

'--totals -v --strip-components=2' line is interpreted just like unique option

I solved removing double quotes from mkstage4 script to the ${OPTIONS[@]} array tar "${TAR_OPTIONS[@]}" "${INCLUDES[@]}" "${EXCLUDES[@]}" ${OPTIONS[@]} -f "$STAGE4_FILENAME" "${TARGET}"

and to the echo for the printed output echo 'tar' "${TAR_OPTIONS[@]}" "${INCLUDES[@]}" "${EXCLUDES[@]}" ${OPTIONS[@]} -f "$STAGE4_FILENAME" "${TARGET}"

So TAR can recognized the single custom option now

edit : or update "Shifts pointer to read custom tar options"


for custom_opts in $@ ; do OPTIONS+=("$custom_opts") ; done ((${#OPTIONS[@]} == 1)) && [ -z "${OPTIONS[0]}" ] && unset OPTIONS

Got this ok : --exclude=/mnt/bind-home/usr/portage/* --totals -v --strip-components=2 -f /run/media/nykay/Backup-1/tar/test-home.tar.bz2 /mnt/bind-home/

hope to helpful