Option to run the installer script once.
This commit is contained in:
parent
f0e747a1c8
commit
3a5ad8eb66
|
@ -44,6 +44,8 @@ r_packages_git_base_dir: /srv/r_updater
|
||||||
r_packages_files_prefix: ''
|
r_packages_files_prefix: ''
|
||||||
r_packages_updater_also_upgrades_installed_packages: true
|
r_packages_updater_also_upgrades_installed_packages: true
|
||||||
r_packages_updater_for_github_only: true
|
r_packages_updater_for_github_only: true
|
||||||
|
# Set this to true if you want to run the installer once, and then never after the first execution
|
||||||
|
r_packages_updater_run_once: false
|
||||||
# They need to be flat text files
|
# They need to be flat text files
|
||||||
# 1 package per line
|
# 1 package per line
|
||||||
#r_debian_packages_list_url
|
#r_debian_packages_list_url
|
||||||
|
|
|
@ -1,46 +1,58 @@
|
||||||
---
|
---
|
||||||
- name: Manage the subversion repository
|
- name: r-packages-updater | Manage the subversion repository
|
||||||
block:
|
|
||||||
- name: Create the R packages updater SVN base directory
|
|
||||||
file:
|
|
||||||
dest: '{{ r_packages_svn_base_dir }}'
|
|
||||||
state: directory
|
|
||||||
|
|
||||||
when:
|
when:
|
||||||
- r_cran_install_from_sources
|
- r_cran_install_from_sources
|
||||||
- r_packages_updater
|
- r_packages_updater
|
||||||
- r_package_updater_via_subversion
|
- r_package_updater_via_subversion
|
||||||
tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_github', 'r_cran_pkgs', 'r_github_pkgs', 'r_packages_updater' ]
|
tags: ['r_software', 'r_pkg', 'r_plugins', 'r_plugins_github', 'r_cran_pkgs', 'r_github_pkgs', 'r_packages_updater']
|
||||||
|
|
||||||
- name: Manage the git repository of the packages lists
|
|
||||||
block:
|
block:
|
||||||
- name: Remove the R packages updater SVN base directory
|
- name: r-packages-updater | Create the R packages updater SVN base directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
dest: '{{ r_packages_svn_base_dir }}/RPackagesManagement'
|
dest: '{{ r_packages_svn_base_dir }}'
|
||||||
state: absent
|
|
||||||
|
|
||||||
- name: Create the R packages updater git base directory
|
|
||||||
file:
|
|
||||||
dest: '{{ r_packages_git_base_dir }}'
|
|
||||||
state: directory
|
state: directory
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0755"
|
||||||
|
|
||||||
|
- name: r-packages-updater | Manage the git repository of the packages lists
|
||||||
when:
|
when:
|
||||||
- r_cran_install_from_sources
|
- r_cran_install_from_sources
|
||||||
- r_packages_updater
|
- r_packages_updater
|
||||||
- r_package_updater_via_git
|
- r_package_updater_via_git
|
||||||
tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_github', 'r_cran_pkgs', 'r_github_pkgs', 'r_packages_updater' ]
|
tags: ['r_software', 'r_pkg', 'r_plugins', 'r_plugins_github', 'r_cran_pkgs', 'r_github_pkgs', 'r_packages_updater']
|
||||||
|
block:
|
||||||
|
- name: r-packages-updater | Remove the R packages updater SVN base directory
|
||||||
|
ansible.builtin.file:
|
||||||
|
dest: '{{ r_packages_svn_base_dir }}/RPackagesManagement'
|
||||||
|
state: absent
|
||||||
|
|
||||||
- block:
|
- name: r-packages-updater | Create the R packages updater git base directory
|
||||||
- name: Install the R packages updater script
|
ansible.builtin.file:
|
||||||
template:
|
dest: '{{ r_packages_git_base_dir }}'
|
||||||
|
state: directory
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0755"
|
||||||
|
|
||||||
|
- name: r-packages-updater | Scripts that install/update R packages
|
||||||
|
tags: ['r_software', 'r_pkg', 'r_plugins', 'r_plugins_github', 'r_cran_pkgs', 'r_github_pkgs', 'r_packages_updater']
|
||||||
|
block:
|
||||||
|
- name: r-packages-updater | Install the R packages updater script
|
||||||
|
ansible.builtin.template:
|
||||||
src: 'update_r_packages.sh.j2'
|
src: 'update_r_packages.sh.j2'
|
||||||
dest: '/usr/local/bin/update_r_packages'
|
dest: '/usr/local/bin/update_r_packages'
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: '0755'
|
mode: '0755'
|
||||||
|
|
||||||
- name: Cron job that installs new R packages, if any
|
- name: r-packages-updater | Cron jobs that install/update R packages
|
||||||
cron:
|
when:
|
||||||
|
- r_cran_install_from_sources
|
||||||
|
- r_packages_updater
|
||||||
|
tags: ['r_software', 'r_pkg', 'r_plugins', 'r_plugins_github', 'r_cran_pkgs', 'r_github_pkgs', 'r_packages_updater']
|
||||||
|
block:
|
||||||
|
- name: r-packages-updater | Cron job that installs new R packages, if any
|
||||||
|
ansible.builtin.cron:
|
||||||
name: "install new R packages"
|
name: "install new R packages"
|
||||||
user: root
|
user: root
|
||||||
cron_file: install-r-packages
|
cron_file: install-r-packages
|
||||||
|
@ -49,8 +61,8 @@
|
||||||
job: "/usr/local/bin/update_r_packages install >/var/log/install_r_packages 2>&1"
|
job: "/usr/local/bin/update_r_packages install >/var/log/install_r_packages 2>&1"
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Cron job that upgrades existing R packages and installs new ones, if any
|
- name: r-packages-updater | Cron job that upgrades existing R packages and installs new ones, if any
|
||||||
cron:
|
ansible.builtin.cron:
|
||||||
name: "Upgrade installed R packages"
|
name: "Upgrade installed R packages"
|
||||||
user: root
|
user: root
|
||||||
cron_file: upgrade-r-packages
|
cron_file: upgrade-r-packages
|
||||||
|
@ -60,30 +72,30 @@
|
||||||
state: present
|
state: present
|
||||||
when: r_packages_updater_also_upgrades_installed_packages
|
when: r_packages_updater_also_upgrades_installed_packages
|
||||||
|
|
||||||
when:
|
- name: r-packages-updater | Remove the update scripts
|
||||||
- r_cran_install_from_sources
|
|
||||||
- r_packages_updater
|
|
||||||
tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_github', 'r_cran_pkgs', 'r_github_pkgs', 'r_packages_updater' ]
|
|
||||||
|
|
||||||
- block:
|
|
||||||
- name: Remove the R packages updater script
|
|
||||||
file: dest=/usr/local/bin/update_r_packages state=absent
|
|
||||||
|
|
||||||
- name: Remove the R packages updater SVN base directory
|
|
||||||
file: dest={{ r_packages_svn_base_dir }} state=absent
|
|
||||||
|
|
||||||
- name: Remove the cron job that installs new R packages
|
|
||||||
file: dest=/etc/cron.d/install-r-packages state=absent
|
|
||||||
|
|
||||||
- name: Remove the cron job that upgrades existing R packages and installs new ones
|
|
||||||
file: dest=/etc/cron.d/upgrade-r-packages state=absent
|
|
||||||
|
|
||||||
when: not r_packages_updater
|
when: not r_packages_updater
|
||||||
tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_github', 'r_cran_pkgs', 'r_github_pkgs', 'r_packages_updater' ]
|
tags: ['r_software', 'r_pkg', 'r_plugins', 'r_plugins_github', 'r_cran_pkgs', 'r_github_pkgs', 'r_packages_updater']
|
||||||
|
block:
|
||||||
|
- name: r-packages-updater | Remove the R packages updater SVN base directory
|
||||||
|
ansible.builtin.file:
|
||||||
|
dest: "{{ r_packages_svn_base_dir }}"
|
||||||
|
state: absent
|
||||||
|
|
||||||
- block:
|
- name: r-packages-updater | Remove the cron job that installs new R packages
|
||||||
- name: Disable the cron job that upgrades already installed R packages
|
ansible.builtin.file:
|
||||||
file: dest=/etc/cron.d/upgrade-r-packages state=absent
|
dest: /etc/cron.d/install-r-packages
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: r-packages-updater | Remove the cron job that upgrades existing R packages and installs new ones
|
||||||
|
ansible.builtin.file:
|
||||||
|
dest: /etc/cron.d/upgrade-r-packages
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: r-packages-updater | Disable the cron job that updates the R packages
|
||||||
when: not r_packages_updater_also_upgrades_installed_packages
|
when: not r_packages_updater_also_upgrades_installed_packages
|
||||||
tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_github', 'r_cran_pkgs', 'r_github_pkgs', 'r_packages_updater' ]
|
tags: ['r_software', 'r_pkg', 'r_plugins', 'r_plugins_github', 'r_cran_pkgs', 'r_github_pkgs', 'r_packages_updater']
|
||||||
|
block:
|
||||||
|
- name: r-packages-updater | Disable the cron job that upgrades already installed R packages
|
||||||
|
ansible.builtin.file:
|
||||||
|
dest: /etc/cron.d/upgrade-r-packages
|
||||||
|
state: absent
|
||||||
|
|
|
@ -42,6 +42,11 @@ UPDATER_DEFAULT_BEHAVIOUR="github_only"
|
||||||
{% else %}
|
{% else %}
|
||||||
UPDATER_DEFAULT_BEHAVIOUR="everything"
|
UPDATER_DEFAULT_BEHAVIOUR="everything"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if r_packages_updater_run_once %}
|
||||||
|
INSTALLER_BEHAVIOUR="once"
|
||||||
|
{% else %}
|
||||||
|
INSTALLER_BEHAVIOUR="always"
|
||||||
|
{% endif %}
|
||||||
# - debian packages list format:
|
# - debian packages list format:
|
||||||
# one package per line
|
# one package per line
|
||||||
DEB_PKGS_SKIP=0
|
DEB_PKGS_SKIP=0
|
||||||
|
@ -317,6 +322,14 @@ function r_github_pkgs() {
|
||||||
usage
|
usage
|
||||||
get_args
|
get_args
|
||||||
init_env
|
init_env
|
||||||
|
if [ "$INSTALLER_BEHAVIOUR" == "once" ] ; then
|
||||||
|
if [ -d $R_PKGS_BASE_DIR/$R_PKGS_DIR ] ; then
|
||||||
|
logger "update_r_packages: The script run once already. Doing nothing."
|
||||||
|
cleanup
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $R_PKGS_FROM_GIT == 'True' ] ; then
|
if [ $R_PKGS_FROM_GIT == 'True' ] ; then
|
||||||
get_data_files_from_git
|
get_data_files_from_git
|
||||||
if [ $GIT_UPDATE_STATUS -ne 1 -a "$ACTION" == "install" ] ; then
|
if [ $GIT_UPDATE_STATUS -ne 1 -a "$ACTION" == "install" ] ; then
|
||||||
|
|
Loading…
Reference in New Issue