summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/debian-build8
-rwxr-xr-xbin/debian-dev-setup17
-rwxr-xr-xbin/debian-keyring-setup25
-rwxr-xr-xbin/dependencies45
-rwxr-xr-xbin/deploy62
-rwxr-xr-xbin/mrconfig28
-rwxr-xr-xbin/post-receive17
-rwxr-xr-xbin/provision30
-rwxr-xr-xbin/submodules31
-rwxr-xr-xbin/subtrees41
-rwxr-xr-xbin/symlinks24
11 files changed, 50 insertions, 278 deletions
diff --git a/bin/debian-build b/bin/debian-build
new file mode 100755
index 0000000..529d81a
--- /dev/null
+++ b/bin/debian-build
@@ -0,0 +1,8 @@
+#!/bin/bash
+#
+# Simpler debian builder.
+#
+
+# Placeholder
+echo "TODO"
+exit 1
diff --git a/bin/debian-dev-setup b/bin/debian-dev-setup
new file mode 100755
index 0000000..cc88ad9
--- /dev/null
+++ b/bin/debian-dev-setup
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# Setup development environment.
+#
+
+# Default provisioner
+if [ -x "/vagrant/puppet/bin/provision" ]; then
+ /vagrant/puppet/bin/provision
+elif [ -x "/home/user/code/debian/puppet/bin/provision" ]; then
+ /home/user/code/debian/puppet/bin/provision
+fi
+
+# Parameter
+PACKAGES="/var/data/apps/distros/debian/packages"
+
+# Required folders
+mkdir -p $PACKAGES
diff --git a/bin/debian-keyring-setup b/bin/debian-keyring-setup
new file mode 100755
index 0000000..7e00e89
--- /dev/null
+++ b/bin/debian-keyring-setup
@@ -0,0 +1,25 @@
+#!/bin/bash
+#
+# Setup a local debian-keyring repository.
+#
+
+# Parameters
+CWD="`pwd`"
+
+# Make sure the keyring repository is initialized
+git submodule update --init || exit 1
+
+# Go there
+cd keyring
+
+# Build the keyring
+make || exit 1
+
+# Symlink
+ln -s output/keyrings/debian-keyring.gpg output/keyrings/debian-keyring.gpg/trustedkeys.gpg || exit 1
+ln -s output/keyrings output/.gnupg || exit 1
+
+# Write devscripts configuration
+cat <<EOF > output/.devscripts
+DSCVERIFY_KEYRINGS="/usr/share/keyrings/debian-keyring.gpg:/usr/share/keyrings/debian-maintainers.gpg:$CWD/keyrings/debian-keyring.gpg"
+EOF
diff --git a/bin/dependencies b/bin/dependencies
deleted file mode 100755
index 4330730..0000000
--- a/bin/dependencies
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/bash
-#
-# Puppet bootstrap dependencies.
-#
-
-# Parameters
-BASENAME="`basename $0`"
-DEPLOY_DEPENDENCIES="rsync puppet-common hiera-eyaml"
-DEVELOP_DEPENDENCIES="git mr whois hiera-eyaml"
-
-# Additional wheezy dependencies if not using puppet-common from wheezy-backports
-#if [ "`head -c 1 /etc/debian_version`" == '7' ]; then
-# DEPLOY_DEPENDENCIES="$DEPLOY_DEPENDENCIES ruby-hiera-puppet"
-#fi
-
-# Set sudo config
-if [ "`whoami`" != 'root' ]; then
- SUDO="sudo"
-
- if ! sudo -n true; then
- echo "Please set passwordless sudo."
- exit 1
- fi
-fi
-
-# Install a package, thanks to the Hydra Suite.
-function provision_package {
- if [ -z "$1" ]; then
- return
- fi
-
- dpkg -s $1 &> /dev/null
-
- if [ "$?" == "1" ]; then
- echo "Installing package $1..."
- DEBIAN_FRONTEND=noninteractive $SUDO apt-get install $1 -y
- fi
-}
-
-# Ensure basic packages are installed.
-if [ "$BASENAME" == "dependencies" ]; then
- for package in $DEVELOP_DEPENDENCIES; do
- provision_package $package
- done
-fi
diff --git a/bin/deploy b/bin/deploy
deleted file mode 100755
index 22065dc..0000000
--- a/bin/deploy
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/bin/bash
-#
-# Deploy configuration using puppet.
-#
-
-# Parameters
-DIRNAME="`dirname $0`"
-BASEDIR="$DIRNAME/.."
-
-# Determine hostname
-if [ ! -z "$1" ]; then
- FQDN="$1"
-else
- FQDN="`cat /etc/hostname`"
-fi
-
-# Set manifest
-PUPPET_MANIFEST="$BASEDIR/manifests/nodes/$FQDN.pp"
-if [ ! -e "$PUPPET_MANIFEST" ]; then
- PUPPET_MANIFEST="$BASEDIR/manifests/nodes/default.pp"
-fi
-
-# Check manifest
-if [ ! -e "$PUPPET_MANIFEST" ]; then
- echo "No manifest found for $FQDN"
- exit 1
-fi
-
-# Install dependencies
-source $DIRNAME/dependencies
-
-# Ensure additional dependencies are installed.
-for package in $DEPLOY_DEPENDENCIES; do
- provision_package $package
-done
-
-# Parameters that needs dependencies installed
-DIST="`facter lsbdistcodename`"
-
-# Apply patches
-if [ -d "$BASEDIR/puppet/files/patches/$DIST" ]; then
- (
- # Patches should be generated relativelly to the root folder
- cd /
-
- # Only apply if needed
- # Thanks https://unix.stackexchange.com/questions/55780/check-if-a-file-or-folder-has-been-patched-already
- for patch in `ls $BASEDIR/puppet/files/patches/$DIST`; do
- patch -p0 -N --dry-run --silent < $BASEDIR/puppet/files/patches/$DIST/$patch &> /dev/null
- # If the patch has not been applied then the $? which is the exit status
- # for last command would have a success status code = 0
- if [ "$?" == "0" ]; then
- # Apply the patch
- patch -p0 -N < $BASEDIR/puppet/files/patches/$DIST/$patch
- fi
- done
- )
-fi
-
-# Run puppet apply
-PUPPET_OPTS="--confdir=$BASEDIR --modulepath=$BASEDIR/modules"
-LC_ALL=C $SUDO puppet apply $PUPPET_OPTS $PUPPET_MANIFEST
diff --git a/bin/mrconfig b/bin/mrconfig
deleted file mode 100755
index 48815c1..0000000
--- a/bin/mrconfig
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/bash
-#
-# Build a mrconfig for the needed modules.
-#
-
-# Parameters
-GIT="git.fluxo.info"
-URL="https://$GIT/projects.list"
-CWD="`pwd`"
-WORK="`dirname $0`/.."
-
-# Create a new config
-cd $WORK
-rm -f .mrconfig
-touch .mrconfig
-
-# Fetch repository list and updtate mrconfig
-curl --stderr - $URL | grep "^puppet-" | cut -d ' ' -f 1 | sed -e 's/\.git$//' | while read module; do
- folder="`echo $module | sed -e 's/^puppet-//'`"
-
- if [ "$folder" != "bootstrap" ]; then
- echo "Processing $folder..."
- mr config puppet/modules/$folder checkout="git clone https://$GIT/$module $folder"
- fi
-done
-
-# Teardown
-cd $CWD
diff --git a/bin/post-receive b/bin/post-receive
deleted file mode 100755
index e6baa07..0000000
--- a/bin/post-receive
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-cd ..
-unset GIT_DIR
-
-if [ -d ".git/annex" ]; then
- git annex sync
-else
- #git reset HEAD
- git checkout -f
-fi
-
-git submodule sync --recursive
-git submodule update --init --recursive
-
-cd -
-exec git update-server-info
diff --git a/bin/provision b/bin/provision
deleted file mode 100755
index 99cb862..0000000
--- a/bin/provision
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/bash
-#
-# Simple shell provisioner for Vagrant instances.
-#
-
-# Parameters
-DIRNAME="`dirname $0`"
-
-# Load dependencies
-source $DIRNAME/dependencies
-
-# Ensure the system is updated.
-$SUDO apt-get update && DEBIAN_FRONTEND=noninteractive $SUDO apt-get dist-upgrade -y && $SUDO apt-get autoremove -y && $SUDO apt-get clean
-
-# Ensure additional dependencies are installed.
-for package in $DEPLOY_DEPENDENCIES; do
- provision_package $package
-done
-
-# Link hiera configuration if needed.
-if [ ! -h "/etc/puppet/hiera.yaml" ]; then
- $SUDO rm -f /etc/puppet/hiera.yaml
- $SUDO ln -s $DIRNAME/../config/hiera.yaml /etc/puppet/hiera.yaml
-fi
-
-# Link puppet configuration if needed.
-if [ ! -h "/etc/puppet/puppet.conf" ] && [ -e "$DIRNAME/../puppet.conf" ]; then
- $SUDO rm -f /etc/puppet/puppet.conf
- $SUDO ln -s $DIRNAME/../puppet.conf /etc/puppet/puppet.conf
-fi
diff --git a/bin/submodules b/bin/submodules
deleted file mode 100755
index 3abc46d..0000000
--- a/bin/submodules
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-#
-# Setup submodules.
-#
-
-# Parameters
-DIRNAME="`dirname $0`"
-
-# Usage
-function usage {
- echo "Usage: $1 add-submodules <DIR>"
- exit $2
-}
-
-# Get module list
-repos="`grep = $DIRNAME/../.mrconfig | cut -d = -f 2 | cut -d ' ' -f 4`"
-
-# Add submodules
-for repo in $repos; do
- module="`basename $repo .git | sed -e s/^puppet-//`"
- if [ ! -d "modules/$module" ]; then
- echo "Processing puppet module $module..."
- git submodule add -f $repo modules/$module
- elif [ -e "modules/$module/.git" ]; then
- # The puppet module exists and is a git submodule, so update it
- ( cd module/$module && git pull origin master )
- fi
-done
-
-# Update all modules
-git submodule update --init
diff --git a/bin/subtrees b/bin/subtrees
deleted file mode 100755
index 1858a48..0000000
--- a/bin/subtrees
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/bash
-#
-# Setup subtrees.
-#
-
-# Parameters
-DIRNAME="`dirname $0`"
-
-# Usage
-function usage {
- echo "Usage: $1 add-submodules <DIR>"
- exit $2
-}
-
-# Check for git-subtree
-if ! which git-subtree &> /dev/null; then
- echo "fatal: please install git-subtree"
- exit 1
-fi
-
-# Get module list
-repos="`grep = $DIRNAME/../.mrconfig | cut -d = -f 2 | cut -d ' ' -f 4`"
-
-# Add subtrees
-for repo in $repos; do
- module="`basename $repo .git | sed -e s/^puppet-//`"
- if [ ! -d "modules/$module" ]; then
- echo "Processing puppet module $module..."
- git remote add $module $repo
- git subtree add --prefix modules/$module $module master --squash
- elif [ ! -d "modules/$module/.git" ]; then
- # The puppet module exists and is a subtree, so update it
- if ! git remote | grep -qe "^$module$"; then
- git remote add $module $repo
- fi
-
- # Update subtrees
- git fetch $module master
- git subtree pull --prefix modules/$module $module master --squash
- fi
-done
diff --git a/bin/symlinks b/bin/symlinks
deleted file mode 100755
index 0a221c4..0000000
--- a/bin/symlinks
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-#
-# Setup symlinks.
-#
-
-# Parameters
-BASENAME="`basename $0`"
-MODULES="$1"
-
-# Check parameters
-if [ -z "$MODULES" ]; then
- echo "Usage: $BASENAME <submodules-folder>"
- exit 1
-elif [ ! -e "$MODULES" ]; then
- echo "Not found: $MODULES"
-fi
-
-# Add module symlinks using absolute folders
-for module in `ls $MODULES`; do
- if [ "$module" != "bootstrap" ]; then
- path="`cd $MODULES/$module && pwd`"
- ( cd modules &> /dev/null && ln -sf $path )
- fi
-done