getgrav / grav

Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS powered by PHP, Markdown, Twig, and Symfony
https://getgrav.org
MIT License
14.59k stars 1.41k forks source link

Deployment: installation from zip package improvement #3644

Open Sogl opened 2 years ago

Sogl commented 2 years ago

I use Deployer php tool for Grav deploy. My task for download zip:

task('grav:download_zip', function () {
    // get by url
    run('wget -O {{release_path}}/grav_latest.zip https://getgrav.org/download/core/grav-admin/latest');
    // unzip it in same directory
    run('unzip {{release_path}}/grav_latest.zip -d {{release_path}}');
    // move all grav-admin files (+ dotfiles dotfolders) 
    run('mv {{release_path}}/grav-admin/* {{release_path}}/grav-admin/.[!.]*  {{release_path}}');
    // remove zip and extracted folder
    run('rm -r {{release_path}}/grav_latest.zip {{release_path}}/grav-admin');
    // delete all in user except plugins
    run('find {{release_path}}/user -mindepth 1 -maxdepth 1 -name plugins -prune -o -exec rm -rf {} \;');
});

I want to get rid of moving files command. This problem exists because Grav zip root contains grav-admin folder. But unzip don't support strip root folder. Many questions about this in SO:

--strip-components=1 supports by tar and bsdtar:

I see two ways:

  1. Put Grav installation to zip without root folder.
  2. Add extra archive options like tar.gz etc.

About the second option the first thing that comes to my mind is the Node.js download page:

image

Any thoughts?

rhukster commented 2 years ago

on my own servers, with my own scripts, I actually just install libarchive-tools which contains bsdtar and use the bsdtar as you outlined:

bsdtar --strip-components=1 -xvf grav-admin.zip

I have no clue what you can do if you can't install other packages.. I think you might me forced to unzip to a tmp folder and then copy all files. If you use this syntax below (notice the .) you will not have to move regular files and hidden files separately:

cp -r /tmp/grav-admin/. /home/<user>/web
Sogl commented 2 years ago

I have no clue what you can do if you can't install other packages

Shared hosting is enough for my project now. If I exceed the load limit, I will move to a VPS.

Is there a chance to get Grav in the tar.gz archive?