summaryrefslogtreecommitdiff
path: root/pre-install.d
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-01-15 14:21:46 -0500
committerJoey Hess <joey@kodama.kitenet.net>2008-01-15 14:21:46 -0500
commitc8f16796c6c72251814626ccf911d8f025cc60f3 (patch)
tree17c99c0cc0570d2167ceb3cf888d60df304a757a /pre-install.d
parent45fa1c5a4d911503b545df62c4e276807063dc4e (diff)
* Convert the directory parameter of etckeeper into "-d directory".
* Pass other patameters on from etckeeper to the .d scripts. * Stop using run-parts for various reasons. * Split out a commit.d that contains committing code that's used by both the pre-install.d and post-install.d scripts. * Split out an unclean.d that tests if the WC contains uncommitted changes. * Add preinst code to remove old post-install.d scripts.
Diffstat (limited to 'pre-install.d')
-rwxr-xr-xpre-install.d/50uncommitted-changes29
1 files changed, 2 insertions, 27 deletions
diff --git a/pre-install.d/50uncommitted-changes b/pre-install.d/50uncommitted-changes
index bc33ff9..4e573dc 100755
--- a/pre-install.d/50uncommitted-changes
+++ b/pre-install.d/50uncommitted-changes
@@ -1,14 +1,6 @@
#!/bin/sh
set -e
-unclean() {
- if [ "$VCS" = git ]; then
- [ -d .git ] && ! LANG=C git-status 2>&1 | grep -q "working directory clean"
- elif [ "$VCS" = hg ]; then
- [ -d .hg ] && ! hg status 2>&1 | wc -l | grep -q "^0$"
- fi
-}
-
status() {
if [ "$VCS" = git ]; then
git status
@@ -17,23 +9,6 @@ status() {
fi
}
-commit() {
- message="$1"
-
- if [ "$VCS" = git ]; then
- git add .
- for file in $(git ls-files --deleted); do
- if [ ! -d "$file" ]; then
- git rm --quiet "$file"
- fi
- done
- git commit $GIT_COMMIT_OPTIONS -m "$message"
- elif [ "$VCS" = hg ]; then
- hg addremove .
- hg commit $HG_COMMIT_OPTIONS -m "$message"
- fi
-}
-
if [ "$1" = "ask-debconf" ]; then
. /usr/share/debconf/confmodule
db_capb escape
@@ -60,7 +35,7 @@ elif [ "$1" = "fail-debconf" ]; then
db_reset etckeeper/commit_failed || true
fi
-if unclean; then
+if etckeeper unclean; then
docommit="true"
if [ -e /usr/share/debconf/confmodule ]; then
if $0 ask-debconf; then
@@ -70,7 +45,7 @@ if unclean; then
fi
fi
if [ "$docommit" = true ]; then
- if ! commit "saving uncommitted changes in /etc prior to $HIGHLEVEL_PACKAGE_MANAGER run"; then
+ if ! etckeeper commit "saving uncommitted changes in /etc prior to $HIGHLEVEL_PACKAGE_MANAGER run"; then
if [ -e /usr/share/debconf/confmodule ]; then
$0 fail-debconf
else