[Git][noosfero/noosfero][master] 2 commits: script-noosfero-plugins: install debian dependencies

Rodrigo Souto gitlab at mg.gitlab.com
Tue Jun 20 16:01:37 BRT 2017


Rodrigo Souto pushed to branch master at Noosfero / noosfero


Commits:
f1c3884a by Rodrigo Souto at 2017-06-13T14:08:27-03:00
script-noosfero-plugins: install debian dependencies

The script checks if the system is a debian-based SO and if there is
list of debian-dependencies on the plugin's root directory. If so, it
installs the dependencies before the plugin install.

- - - - -
5bf48787 by Rodrigo Souto at 2017-06-20T18:59:14+00:00
Merge branch 'debian-dependencies-plugin-install' into 'master'

script-noosfero-plugins: install debian dependencies

See merge request !1238
- - - - -


2 changed files:

- + script/debian-install
- script/noosfero-plugins


Changes:

=====================================
script/debian-install
=====================================
--- /dev/null
+++ b/script/debian-install
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+update=false
+
+echo "=> Verifying debian dependencies..."
+
+install () {
+  if ! dpkg -s $1 &> /dev/null; then
+    if ! $update; then
+      echo "=> Updating repositories..."
+      sudo apt-get update > /dev/null
+      update=true
+    fi
+
+    echo "=> Installing $1..."
+    if ! sudo apt-get install -y $1; then
+      exit 1
+    fi
+  fi
+}
+
+for package in `cat $1`
+do
+  install $package
+done
+
+echo "=> Done!"


=====================================
script/noosfero-plugins
=====================================
--- a/script/noosfero-plugins
+++ b/script/noosfero-plugins
@@ -20,6 +20,7 @@ base_plugins_dir="$NOOSFERO_DIR/baseplugins"
 available_plugins=$(find -L "$available_plugins_dir" -maxdepth 1 -mindepth 1 -type d -not -name 'template' -printf '%f\n' | sort)
 enabled_plugins=$(find -L "$enabled_plugins_dir" -maxdepth 1 -mindepth 1 -type d -printf '%f\n' | sort)
 base_plugins=$(find -L "$base_plugins_dir" -maxdepth 1 -mindepth 1 -type d -printf '%f\n' | sort)
+debian_install="$NOOSFERO_DIR/script/debian-install"
 
 # operation defaults
 quiet=false
@@ -111,6 +112,12 @@ _enable(){
     fi
     installation_ok=true
     installation_file="$source/install.rb"
+    debian_dependencies="$source/debian-dependencies"
+
+    if [ -f /etc/debian_version ] && [ -f "$debian_dependencies" ] && ! $debian_install $debian_dependencies; then
+      installation_ok=false
+    fi
+
     if ! run $installation_file; then
       installation_ok=false
     else



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/b5d61912b6ceb97c6cee4b7d242f55cba46158a8...5bf48787a1cd31139152ea903f0113d82c8df23c

---
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/b5d61912b6ceb97c6cee4b7d242f55cba46158a8...5bf48787a1cd31139152ea903f0113d82c8df23c
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20170620/524bf54b/attachment-0001.html>


More information about the Noosfero-dev mailing list