[Lunar-commits] <moonbase-other> etckeeper: Initial import

Stefan Wold ratler at lunar-linux.org
Sun Dec 8 11:35:01 CET 2013


commit d4fa7727db4e50380364266a6876f46990e95180
Author: Stefan Wold <ratler at lunar-linux.org>
Date: Sat, 23 Nov 2013 04:18:07 -0800
URL: https://github.com/lunar-linux/moonbase-other/commit/d4fa7727db4e50380364266a6876f46990e95180

etckeeper: Initial import
---
  utils/etckeeper/60-lunar-list-installed   | +5/-0     
  utils/etckeeper/BUILD                     | +10/-0    
  utils/etckeeper/CONFIGURE                 | +10/-0    
  utils/etckeeper/DEPENDS                   | +3/-0     
  utils/etckeeper/DETAILS                   | +12/-0    
  utils/etckeeper/POST_INSTALL              | +1/-0     
  utils/etckeeper/PRE_BUILD                 | +7/-0     
  utils/etckeeper/plugin.d/etckeeper.plugin | +35/-0    
  8 files changed, 83 insertions(+)

--- /dev/null
+++ b/utils/etckeeper/60-lunar-list-installed
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+if [ "$LOWLEVEL_PACKAGE_MANAGER" = "lunar" ]; then
+  lvu installed | sort | awk -F'[: ]' '{ print $1" "$4 }'
+fi
--- /dev/null
+++ b/utils/etckeeper/BUILD
@@ -0,0 +1,10 @@
+if [[ "${ETCSCM:-git}" != "git" ]]; then
+  if [[ "$ETCSCM" == "hg" ]] && module_installed mercurial; then
+    sedit 's;^VCS=.*;#&;g;/VCS="hg"/s;^#;;' etckeeper.conf
+  elif [[ "$ETCSCM" == "bzr" ]] && module_installed bzr; then
+    sedit 's;^VCS=.*;#&;g;/VCS="bzr"/s;^#;;' etckeeper.conf
+  fi
+fi &&
+prepare_install &&
+make install &&
+install -Dm 0755 $SCRIPT_DIRECTORY/60-lunar-list-installed /etc/etckeeper/list-installed.d/60-lunar-list-installed
--- /dev/null
+++ b/utils/etckeeper/CONFIGURE
@@ -0,0 +1,10 @@
+if [ -n "$RECONFIGURE" ]; then
+  if query "Do you want to change etckeeper SCM backend (currently: ${ETCSCM:-git})?" n; then
+    RESULT=$(dialog --title "Change default etckeeper SCM" \
+                    --stdout \
+                    --menu "" 0 0 0 git GIT hg Mercurial bzr Bazaar-NG)
+    if [ -n "$RESULT" ]; then
+      set_module_config ETCSCM $RESULT
+    fi
+  fi
+fi
--- /dev/null
+++ b/utils/etckeeper/DEPENDS
@@ -0,0 +1,3 @@
+depends git
+optional_depends bzr "" "" "for bzr backend support"
+optional_depends mercurial "" "" "for mercurial backend support"
--- /dev/null
+++ b/utils/etckeeper/DETAILS
@@ -0,0 +1,12 @@
+          MODULE=etckeeper
+         VERSION=1.10
+          SOURCE=${MODULE}-${VERSION}.tar.bz2
+      SOURCE_URL=git://git.kitenet.net/etckeeper:1.10
+SOURCE_DIRECTORY=$BUILD_DIRECTORY/$MODULE-$VERSION
+        WEB_SITE="http://kitenet.net/~joey/code/etckeeper/"
+         ENTERED=20131123
+         UPDATED=20131123
+           SHORT="Utility to let /etc be stored in a git, hg or bzr repository"
+cat <<EOF
+Utility to let /etc be stored in a git, hg or bzr repository.
+EOF
--- /dev/null
+++ b/utils/etckeeper/POST_INSTALL
@@ -0,0 +1 @@
+etckeeper init
--- /dev/null
+++ b/utils/etckeeper/PRE_BUILD
@@ -0,0 +1,7 @@
+default_pre_build &&
+
+# Disable the different package managers
+sedit 's;^HIGHLEVEL_PACKAGE.*;HIGHLEVEL_PACKAGE_MANAGER=lin;;s;^LOWLEVEL_PACK.*;LOWLEVEL_PACKAGE_MANAGER="lunar";' etckeeper.conf &&
+
+# Set default user or it error out sometimes
+sedit 's;^USER=;&root;' commit.d/50vcs-commit
--- /dev/null
+++ b/utils/etckeeper/plugin.d/etckeeper.plugin
@@ -0,0 +1,35 @@
+#!/bin/bash
+#############################################################
+#                                                           #
+# etckeeper.plugin - SCM handling of /etc                   #
+#                                                           #
+#############################################################
+#                                                           #
+# Copyright 2013 by Stefan Wold under GPLv2                 #
+#                                                           #
+#############################################################
+
+
+plugin_etckeeper_pre_hook()
+{
+  debug_msg "plugin_etckeeper_pre_hook ($@)"
+  # Save uncommited changes before the module has installed
+  # new files in /etc
+  etckeeper pre-install 
+
+  return 2
+}
+
+plugin_etckeeper_commit_changes()
+{
+  debug_msg "plugin_etckeeper_commit_changes ($@)"
+  # Commit changes in /etc
+  etckeeper post-install
+
+  return 2
+}
+
+plugin_register BUILD_PRE_BUILD plugin_etckeeper_pre_hook
+plugin_register BUILD_POST_INSTALL plugin_etckeeper_commit_changes
+plugin_register BUILD_PRE_REMOVE plugin_etckeeper_pre_hook
+plugin_register BUILD_POST_REMOVE plugin_etckeeper_commit_changes




More information about the Lunar-commits mailing list