commit 947a42616ef55d57f41c30e62aa907da3618b34b
Author: root <root@RafaDebian.gobex.pri>
Date:   Mon Jul 4 14:35:03 2016 +0200

    linex-ubuntu-puppet: Subidas las fuentes originales

diff --git a/ubuntu/xenial/all/linex-ubuntu-puppet/debian/changelog b/ubuntu/xenial/all/linex-ubuntu-puppet/debian/changelog
new file mode 100644
index 0000000..056e175
--- /dev/null
+++ b/ubuntu/xenial/all/linex-ubuntu-puppet/debian/changelog
@@ -0,0 +1,15 @@
+linex-ubuntu-puppet (1.2) linex; urgency=medium
+
+  * Cambio del nombre del paquete de de linex-workstation-puppet a linex-ubuntu-puppet. 
+    Cambiado el fichero escuela2.0.
+    Añadido el fichero de puppet.conf
+    Añadidos Divert a los ficheros de configuracion.
+  * Bloqueada la sincronización de plugins.
+
+ -- Rafael J. García Perdigón <rafael.garciap@gobex.es>  Mon, 25 Jan 2016 12:15:40 +0100
+
+linex-ubuntu-puppet (1.0) linex; urgency=low
+
+  * Initial Release. Metapackage to install puppet for linex workstations.
+
+ -- Rafael J. García Perdigón <rafael.garciap@gobex.es>  Fri, 19 Sep 2014 10:10:03 +0200
diff --git a/ubuntu/xenial/all/linex-ubuntu-puppet/debian/compat b/ubuntu/xenial/all/linex-ubuntu-puppet/debian/compat
new file mode 100644
index 0000000..45a4fb7
--- /dev/null
+++ b/ubuntu/xenial/all/linex-ubuntu-puppet/debian/compat
@@ -0,0 +1 @@
+8
diff --git a/ubuntu/xenial/all/linex-ubuntu-puppet/debian/control b/ubuntu/xenial/all/linex-ubuntu-puppet/debian/control
new file mode 100644
index 0000000..b3af211
--- /dev/null
+++ b/ubuntu/xenial/all/linex-ubuntu-puppet/debian/control
@@ -0,0 +1,14 @@
+Source: linex-ubuntu-puppet
+Section: x11
+Priority: optional
+Maintainer: Rafael Jesús García Perdigón <rafael.garciap@gobex.es>
+Build-Depends: debhelper (>= 8.0.0)
+Standards-Version: 3.9.4
+
+Package: linex-ubuntu-puppet
+Architecture: all
+Depends: ${misc:Depends}, puppet, puppet-common, pkgsync
+Description: Configuración del cliente puppet 
+ Instalación de las dependencias del cliente de puppet, 
+ junto con la configuración necesaria para dicho cliente 
+ en el entorno de un centro educativo.
diff --git a/ubuntu/xenial/all/linex-ubuntu-puppet/debian/copyright b/ubuntu/xenial/all/linex-ubuntu-puppet/debian/copyright
new file mode 100644
index 0000000..6d796f6
--- /dev/null
+++ b/ubuntu/xenial/all/linex-ubuntu-puppet/debian/copyright
@@ -0,0 +1,28 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: lingobex-desktop-theme
+
+Files: *
+Copyright: 2014 Gobierno de Extremadura
+License: GPL-3.0+
+
+Files: debian/*
+Copyright: 2014 Gobierno de Extremadura
+License: GPL-3.0+
+
+License: GPL-3.0+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+ .
+ This package is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ .
+ On Debian systems, the complete text of the GNU General
+ Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
+
diff --git a/ubuntu/xenial/all/linex-ubuntu-puppet/debian/install b/ubuntu/xenial/all/linex-ubuntu-puppet/debian/install
new file mode 100644
index 0000000..73752c9
--- /dev/null
+++ b/ubuntu/xenial/all/linex-ubuntu-puppet/debian/install
@@ -0,0 +1 @@
+usr
diff --git a/ubuntu/xenial/all/linex-ubuntu-puppet/debian/linex-ubuntu-puppet.links b/ubuntu/xenial/all/linex-ubuntu-puppet/debian/linex-ubuntu-puppet.links
new file mode 100644
index 0000000..6009bb0
--- /dev/null
+++ b/ubuntu/xenial/all/linex-ubuntu-puppet/debian/linex-ubuntu-puppet.links
@@ -0,0 +1,6 @@
+/usr/share/linex-ubuntu-puppet/escuela2.0 /etc/escuela2.0
+/usr/share/linex-ubuntu-puppet/puppet.conf /etc/puppet/puppet.conf
+/usr/share/linex-ubuntu-puppet/leefichero.rb /usr/lib/ruby/vendor_ruby/facter/leefichero.rb
+/usr/share/linex-ubuntu-puppet/sinc_puppet /usr/sbin/sinc_puppet
+/usr/share/linex-ubuntu-puppet/sincpuppet /etc/init.d/sincpuppet
+
diff --git a/ubuntu/xenial/all/linex-ubuntu-puppet/debian/postinst b/ubuntu/xenial/all/linex-ubuntu-puppet/debian/postinst
new file mode 100644
index 0000000..daf8b72
--- /dev/null
+++ b/ubuntu/xenial/all/linex-ubuntu-puppet/debian/postinst
@@ -0,0 +1,15 @@
+#!/bin/bash
+set -e
+
+  update-rc.d sincpuppet defaults
+  invoke-rc.d sincpuppet start
+
+mkdir -p /etc/pkgsync
+touch /etc/pkgsync/mayhave
+touch /etc/pkgsync/maynothave
+
+  invoke-rc.d puppet stop
+  update-rc.d -f puppet remove
+
+exit 0
+
diff --git a/ubuntu/xenial/all/linex-ubuntu-puppet/debian/postrm b/ubuntu/xenial/all/linex-ubuntu-puppet/debian/postrm
new file mode 100644
index 0000000..d6f16ff
--- /dev/null
+++ b/ubuntu/xenial/all/linex-ubuntu-puppet/debian/postrm
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+set -e
+
+PKG="linex-ubuntu-puppet"
+SHAREDIR="/usr/share/linex-ubuntu-puppet"
+
+remove_divert() {
+    diverter=$(dpkg-divert --listpackage $1)
+    if [ "$diverter" = "linex-ubuntu-puppet" ]; then
+        dpkg-divert --package linex-ubuntu-puppet --rename --remove $1
+    fi
+}
+
+
+if [ "$1" = remove ]; then
+  remove_divert /etc/puppet/puppet.conf
+
+fi
+
+if [ "$1" = purge ]; then
+        update-rc.d sincpuppet remove
+fi
+exit 0
+
diff --git a/ubuntu/xenial/all/linex-ubuntu-puppet/debian/preinst b/ubuntu/xenial/all/linex-ubuntu-puppet/debian/preinst
new file mode 100644
index 0000000..94b0244
--- /dev/null
+++ b/ubuntu/xenial/all/linex-ubuntu-puppet/debian/preinst
@@ -0,0 +1,17 @@
+#!/bin/bash
+set -e
+
+PKG="linex-ubuntu-puppet"
+SHAREDIR="/usr/share/linex-ubuntu-puppet"
+
+divert() {
+    diverted_file=$1
+
+    dpkg-divert --package "$PKG" --add --rename \
+        --divert "${diverted_file}-pre-$PKG" $diverted_file
+}
+
+divert /etc/puppet/puppet.conf
+
+exit 0
+
diff --git a/ubuntu/xenial/all/linex-ubuntu-puppet/debian/rules b/ubuntu/xenial/all/linex-ubuntu-puppet/debian/rules
new file mode 100755
index 0000000..b760bee
--- /dev/null
+++ b/ubuntu/xenial/all/linex-ubuntu-puppet/debian/rules
@@ -0,0 +1,13 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+%:
+	dh $@ 
diff --git a/ubuntu/xenial/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/escuela2.0 b/ubuntu/xenial/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/escuela2.0
new file mode 100644
index 0000000..4dbdfaa
--- /dev/null
+++ b/ubuntu/xenial/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/escuela2.0
@@ -0,0 +1 @@
+use=ubuntu
diff --git a/ubuntu/xenial/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/leefichero.rb b/ubuntu/xenial/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/leefichero.rb
new file mode 100644
index 0000000..3805412
--- /dev/null
+++ b/ubuntu/xenial/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/leefichero.rb
@@ -0,0 +1,18 @@
+# Archivo /usr/lib/ruby/vendor_ruby/facter/leefichero.rb
+# Se utiliza para leer fichero /etc/escuela2.0 y anadir variables a facter
+
+if File.exists?("/etc/escuela2.0")
+   File.open("/etc/escuela2.0").each do |line|
+      var = nil
+      value = nil
+
+      var = $1 and val = $2 if line =~ /^(.+)=(.+)$/
+
+      if var != nil && val != nil
+         Facter.add(var) do
+            setcode { val }
+         end
+      end
+   end
+end
+####
diff --git a/ubuntu/xenial/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/puppet.conf b/ubuntu/xenial/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/puppet.conf
new file mode 100644
index 0000000..ee0bdc1
--- /dev/null
+++ b/ubuntu/xenial/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/puppet.conf
@@ -0,0 +1,18 @@
+[main]
+logdir=/var/log/puppet
+vardir=/var/lib/puppet
+ssldir=/var/lib/puppet/ssl
+rundir=/var/run/puppet
+factpath=$vardir/lib/facter
+templatedir=$confdir/templates
+prerun_command=/etc/puppet/etckeeper-commit-pre
+postrun_command=/etc/puppet/etckeeper-commit-post
+server=puppetinstituto
+pluginsync=false
+
+[master]
+# These are needed when the puppetmaster is run by passenger
+# and can safely be removed if webrick is used.
+ssl_client_header = SSL_CLIENT_S_DN 
+ssl_client_verify_header = SSL_CLIENT_VERIFY
+
diff --git a/ubuntu/xenial/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/sinc_puppet b/ubuntu/xenial/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/sinc_puppet
new file mode 100755
index 0000000..fa3e040
--- /dev/null
+++ b/ubuntu/xenial/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/sinc_puppet
@@ -0,0 +1,61 @@
+#!/bin/bash
+#Modificado: 22/10/2015
+
+uno=$(stat -c %Y  /var/log/syslog)
+dos=$(stat -c %Y /var/lib/puppet/state/state.yaml)
+dife=$((uno-dos))
+
+dpkg --configure -a && apt-get -yf install >/dev/null 2>&1
+
+echo "La última sincronización con PUPPET fué hace: "$(($dife / 3600)) "horas" | logger -t $0
+
+CUENTA=0
+
+#ip link | grep "state UP"
+GW=`ip route | grep default | cut -f3 -d" "`
+ping -c 1 $GW >/dev/null 2>&1
+until [ $? -eq "0" ]; do
+	if [ $CUENTA -lt 5 ]; then
+		echo "No se detecta ninguna interfaz de red levantada. Nuevo intento en 60 segundo ..." | logger -t $0
+		CUENTA=`expr $CUENTA + 1`
+	fi
+	sleep 60
+	#ip link | grep "state UP"
+	GW=`ip route | grep default | cut -f3 -d" "`
+	ping -c 1 $GW >/dev/null 2>&1
+done
+
+ping -c 1 servidor >/dev/null 2>&1
+ERROR=$?
+MAX=0
+until [ $ERROR -eq "0" ] || [ $MAX -eq "5" ]; do
+	echo "Falló Ping al servidor Puppet. Nuevo intento en 30 segundos....." | logger -t $0
+	MAX=`expr $MAX + 1`
+	sleep 30
+	ping -c 1 servidor >/dev/null 2>&1
+	ERROR=$?
+done
+if [ $MAX -eq "5" ]; then
+	echo "Imposible contactar con el servidor..... exit 5" | logger -t $0
+	exit 5
+fi
+
+#Si ha estado más de 12 horas sin sincronizar con puppet
+if [ $dife -gt  43200 ]; then
+	echo "Conexión con servidor de puppet. Esperando entre 0 y 5 minutos para puppet....." | logger -t $0
+	sleep $(($(od -dN2 /dev/urandom | sed -n 's/[^ ]* //p')%300))
+	#puppetd -t
+	puppet agent --enable
+	puppet agent --test >/dev/null 2>&1
+	while [ $? -eq "1" ]; do
+         rm -f /var/lib/puppet/state/puppetdlock
+ 	 rm -rf /var/lib/puppet/ssl
+	 echo "FALLO Puppet. Nuevo intento en 30 segundos" | logger -t $0
+	 sleep 30
+	 #puppetd -t
+	 puppet agent --enable
+	 puppet agent --test >/dev/null 2>&1
+	done
+fi
+echo "Sistema PUPPET correcto" | logger -t $0
+
diff --git a/ubuntu/xenial/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/sincpuppet b/ubuntu/xenial/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/sincpuppet
new file mode 100755
index 0000000..8103907
--- /dev/null
+++ b/ubuntu/xenial/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/sincpuppet
@@ -0,0 +1,51 @@
+#!/bin/bash
+### BEGIN INIT INFO
+# Provides: sincpuppet
+# Required-Start: $local_fs $network
+# Required-Stop:
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Daemon to synchronize puppet
+# Description: daemon to synchronize puppet.
+### END INIT INFO
+# When the machine has unavailable network, nslcd slow down everything trying to take ldap info.
+# This daemon try to recognize that unavailability and stop nslcd daemon until network is available again.
+
+SINCPUPPET_BIN=/usr/sbin/sinc_puppet
+SINCPUPPET_DESC="Daemon to synchronize puppet"
+
+[ -x "$SINCPUPPET_BIN" ] || exit 0
+
+. /lib/lsb/init-functions
+
+
+start() {
+ # set up state directory
+
+  log_daemon_msg "Starting $SINCPUPPET_DESC" "SincPuppet"
+  $SINCPUPPET_BIN &
+  log_end_msg $?
+
+}
+
+stop() {
+  log_daemon_msg "Stopping $SINCPUPPET_DESC" "SincPuppet"
+  killall sinc_puppet
+  log_end_msg $?
+
+}
+
+case "$1" in
+    start)
+        start
+        ;;
+    stop)
+        stop
+        ;;
+    *)
+        echo "Usage: $0 {start|stop|restart|status}"
+        exit 2
+esac
+
+
+exit 0
