tar tvzf AcmeScripts-1.26-scripts.tar.gz
drwxr-xr-x 508/100 0 2014-03-11 12:21 AcmeScripts-1.26/jms/ drwxr-xr-x 508/100 0 2014-03-11 12:21 AcmeScripts-1.26/logs/
(i.e. all the content is under AcmeScripts-1.26)
This is bloody maven who packages my scripts this way, no clue why.
When I untar the tarball, I want to get rid of the AcmeScripts-1.26 subfolder, and untar all the content in a /opt/oracle/acmescripts/ folder (without having a /opt/oracle/acmescripts/AcmeScripts-1.26/ )
I have tried everything, but all attempt failed.
This untars under /opt/oracle/acmescripts/AcmeScripts-1.26/:
tar xvzf AcmeScripts-1.26-scripts.tar.gz -C /opt/oracle/acmescripts/ AcmeScripts-1.26/*
this does the same:
tar xvzf AcmeScripts-1.26-scripts.tar.gz -C /opt/oracle/acmescripts/
There doesn't seem to be an option to untar the content of AcmeScripts-1.26-scripts.tar.gz/AcmeScripts-1.26/* directly to /opt/oracle/acmescripts/. I need to do it in 2 additional steps:
mv /opt/oracle/acmescripts/AcmeScripts-1.26/* /opt/oracle/acmescripts/
rmdir /opt/oracle/acmescripts/AcmeScripts-1.26/
Which I don't find ideal. I would rather have something like
tar xvzf AcmeScripts-1.26-scripts.tar.gz -C /opt/oracle/acmescripts/ -D AcmeScripts-1.26/
(don't try it, the -D option doesn't exist)
The workaround is to simply deploy the scripts to /opt/oracle/acmescripts_staging/AcmeScripts-1.26, and then create a symbolic link between /opt/oracle/acmescripts_staging/AcmeScripts-1.26 and /opt/oracle/acmescripts/ :
ln -s /opt/oracle/acmescripts_staging/AcmeScripts-1.26 /opt/oracle/acmescripts/
Of course when you deploy a new version of the scripts, you have to:
a) remove the previous link
b) remove /opt/oracle/acmescripts_staging/AcmeScripts-1.26
c) create the new link
ln -s /opt/oracle/acmescripts_staging/AcmeScripts-1.27 /opt/oracle/acmescripts/
which requires some coordination and making sure it all fits together. Not all that simple.
I am a bit disappointed by tar, I always found it a underdesigned utility.
(this must be some La Brea tar pit ad)
No comments:
Post a Comment