alfresco-ubuntu-install
alfresco-ubuntu-install copied to clipboard
Moduliarize (use includes) script
The script is becoming large. For better maintainability try to use modules and include them. This also opens up the option to create upgrade versions of the scripts, i.e you can use the script to upgrade LibreOffice or Tomcat easily.
Possibly first create a downloader script alfinit.sh. This will download alfinstall.sh and all includes. Possible locations /opt/alfresco/scripts/alfinstall.sh /opt/alfresco/scripts/include/downloadurl.sh /opt/alfresco/scripts/include/tomcat.sh /opt/alfresco/scripts/include/alfresco.sh /opt/alfresco/scripts/include/(module).sh
The alfinit.sh script itself can then be invoked again to update the basic alfinstall.sh script and the modules. The alfinstall.sh script can then be invoked with "upgrade" as parameter.
Here is a possible modularization pattern http://stackoverflow.com/questions/78497/design-patterns-or-best-practices-for-shell-scripts
I can help with this or at least clean up the script. I will submit a PR in the next few days.
Hi, can you work from the experimental branch for this?
Sure, can do. I have already done this in a script but it has been changed to suit one of our servers and I also use it in Docker, to test.
Can I maybe use getopts so we can do run the script like alfinstall.sh -s 123.456.78.90 -r 123.456.78.91
so that share is served on 123.456.78.90
and the repo is on 123.456.78.91
? That way, scripts like this can be used in Docker without requiring user interaction.
Another option could be to have an "answers.txt" file that gets pulled in: Not sure how this plays with Docker.
So, if answers.txt
could look something like:
export SHARE_HOSTNAME=123.456.78.90
export REPO_HOSTNAME=123.456.78.91
that would work fine with or without Docker. I can just source answers.txt
into alfinstall.sh
and those variables would be available to the script.
I might actually allow the user to specify the path to answers.txt
as an argument. That way, based on their environment, they can specify different configs.
Should this work for 14.04 or 16.04? Some of the package names are different across the two versions.
I didn't have a whole bunch of time the other day but I started on it today and got this done so far.
Our config file would look like that.
It would be used like:
curl -sL https://example.org/alfinit.sh | sudo -E bash -s -- -c /path/to/config.conf -
That's pretty much how NPM and a few other tools are installed.
If you have any suggestions, let me know.
PS: It's not properly tested so I'm sure it's quite buggy.
I also added Docker so that it can be tested in an isolated environment.