--- /dev/null
+# The VCS to use.
+#VCS="hg"
+VCS="git"
+#VCS="bzr"
+#VCS="darcs"
+
+# Options passed to git commit when run by etckeeper.
+GIT_COMMIT_OPTIONS=""
+
+# Options passed to hg commit when run by etckeeper.
+HG_COMMIT_OPTIONS=""
+
+# Options passed to bzr commit when run by etckeeper.
+BZR_COMMIT_OPTIONS=""
+
+# Options passed to darcs record when run by etckeeper.
+DARCS_COMMIT_OPTIONS="-a"
+
+# Uncomment to avoid etckeeper committing existing changes
+# to /etc automatically once per day.
+#AVOID_DAILY_AUTOCOMMITS=1
+
+# Uncomment the following to avoid special file warning
+# (the option is enabled automatically by cronjob regardless).
+#AVOID_SPECIAL_FILE_WARNING=1
+
+# Uncomment to avoid etckeeper committing existing changes to
+# /etc before installation. It will cancel the installation,
+# so you can commit the changes by hand.
+#AVOID_COMMIT_BEFORE_INSTALL=1
+
+# The high-level package manager that's being used.
+# (apt, pacman-g2, yum, dnf, zypper etc)
+#HIGHLEVEL_PACKAGE_MANAGER=apt
+
+# Gentoo specific:
+# For portage this is emerge
+# For paludis this is cave
+HIGHLEVEL_PACKAGE_MANAGER=emerge
+
+# The low-level package manager that's being used.
+# (dpkg, rpm, pacman, pacman-g2, etc)
+#LOWLEVEL_PACKAGE_MANAGER=dpkg
+
+# Gentoo specific:
+# For portage this is qlist
+# For paludis this is cave
+LOWLEVEL_PACKAGE_MANAGER=qlist
+
+# To push each commit to a remote, put the name of the remote here.
+# (eg, "origin" for git). Space-separated lists of multiple remotes
+# also work (eg, "origin gitlab github" for git).
+PUSH_REMOTE=""
#!/bin/sh
if [ -n "$PUSH_REMOTE" ]; then
if [ "$VCS" = git ] && [ -d .git ]; then
- git push "$PUSH_REMOTE" master || true
+ for REMOTE in $PUSH_REMOTE; do
+ git push "$REMOTE" master || true
+ done
elif [ "$VCS" = hg ] && [ -d .hg ]; then
- hg push "$PUSH_REMOTE" || true
+ for REMOTE in $PUSH_REMOTE; do
+ hg push "$REMOTE" || true
+ done
else
echo "PUSH_REMOTE not yet supported for $VCS" >&2
fi
#!/bin/sh
-# Output to stdout a *sorted* list of all currently installed
-# (or removed but still with config-files) packages, in the
-# format "package version\n" (or something similar).
-if [ "$LOWLEVEL_PACKAGE_MANAGER" = dpkg ]; then
- dpkg-query -W -f '${Status}\t${Package} ${Version}\n' | \
- egrep '(ok installed|ok config-files)' | cut -f2,3
-elif [ "$LOWLEVEL_PACKAGE_MANAGER" = rpm ]; then
- rpm -qa --qf "%|epoch?{%{epoch}}:{0}|:%{name}-%{version}-%{release}.%{arch}\n" | sort
-elif [ "$LOWLEVEL_PACKAGE_MANAGER" = pacman ]; then
- pacman -Q
-elif [ "$LOWLEVEL_PACKAGE_MANAGER" = qlist ]; then
- qlist -ICv
+if [ "$1" = fmt ]; then
+ # If the list format changes, change the fmt
+ if [ "$LOWLEVEL_PACKAGE_MANAGER" = dpkg ]; then
+ echo 2
+ else
+ echo ""
+ fi
+else
+ # Output to stdout a *sorted* list of all currently installed
+ # (or removed but still with config-files) packages, in the
+ # format "package version\n" (or something similar).
+ if [ "$LOWLEVEL_PACKAGE_MANAGER" = dpkg ]; then
+ dpkg-query -W -f '${Status}\t${Package} ${Version} ${Architecture}\n' | \
+ egrep '(ok installed|ok config-files)' | cut -f2,3
+ elif [ "$LOWLEVEL_PACKAGE_MANAGER" = rpm ]; then
+ rpm -qa --qf "%|epoch?{%{epoch}}:{0}|:%{name}-%{version}-%{release}.%{arch}\n" | sort
+ elif [ "$LOWLEVEL_PACKAGE_MANAGER" = pacman ]; then
+ pacman -Q
+ elif [ "$LOWLEVEL_PACKAGE_MANAGER" = qlist ]; then
+ qlist -ICv
+ elif [ "$LOWLEVEL_PACKAGE_MANAGER" = cave ]; then
+ cave print-packages -r installed
+ fi
fi
#!/bin/sh
set -e
-
+
pl="/var/cache/etckeeper/packagelist"
if etckeeper unclean; then
message="committing changes in /etc after $HIGHLEVEL_PACKAGE_MANAGER run"
- if [ -e $pl.pre-install ]; then
+ set +e
+ if [ -e $pl.pre-install ] && [ "$(cat $pl.fmt 2>/dev/null || true)" = "$(etckeeper list-installed fmt)" ]; then
(
echo "$message"
echo
else
etckeeper commit "$(printf "$message")"
fi
+ status=$?
+ set -e
+
+ if [ "$status" != 0 ]; then
+ echo "warning: etckeeper failed to commit changes in /etc using $VCS" >&2
+ fi
fi
-if [ -e $pl.pre-install ]; then
- rm -f $pl.pre-install
-fi
+rm -f $pl.pre-install $pl.fmt
}
if [ "$VCS" = bzr ] || [ "$VCS" = darcs ]; then
- special=$(find . -not -type d -not -type f -not -type l | exclude_internal) || true
- hardlinks=$(find . -type f -not -links 1 | exclude_internal ) || true
+ special=$(find . ! -type d ! -type f ! -type l | exclude_internal) || true
+ hardlinks=$(find . -type f ! -links 1 | exclude_internal ) || true
elif [ "$VCS" = hg ]; then
- special=$(find . -not -type d -not -type f -not -type l | exclude_internal) || true
- hardlinks=$(find . -type f -not -links 1 -exec hg status {} \; | exclude_internal ) || true
+ special=$(find . ! -type d ! -type f ! -type l | exclude_internal) || true
+ hardlinks=$(find . -type f ! -links 1 -exec hg status {} \; | exclude_internal ) || true
elif [ "$VCS" = git ]; then
- special=$(find . -not -type d -not -type f -not -type l -exec git ls-files --exclude-standard --cached --others {} \; | exclude_internal) || true
- hardlinks=$(find . -type f -not -links 1 -exec git ls-files --exclude-standard --cached --others {} \; | exclude_internal) || true
+ special=$(find . ! -type d ! -type f ! -type l -exec git ls-files --exclude-standard --cached --others {} \; | exclude_internal) || true
+ hardlinks=$(find . -type f ! -links 1 -exec git ls-files --exclude-standard --cached --others {} \; | exclude_internal) || true
else
special=""
fi
grep -Evf "$listfile"
;;
git)
- git ls-files --others --ignore --exclude-standard --directory > "$listfile" || true
+ (git ls-files -oi --exclude-standard; git ls-files -oi --exclude-standard --directory) | sort | uniq > "$listfile" || true
sed 's/^\.\///' | grep -xFvf "$listfile"
;;
esac
# This list will be later used when committing.
mkdir -p /var/cache/etckeeper/
etckeeper list-installed > /var/cache/etckeeper/packagelist.pre-install
+etckeeper list-installed fmt > /var/cache/etckeeper/packagelist.fmt
#!/bin/sh
set -e
-if [ "$1" = "fail-debconf" ]; then
- . /usr/share/debconf/confmodule
- db_subst etckeeper/commit_failed VCS "$VCS"
- db_input critical etckeeper/commit_failed || true
- db_go || true
- db_reset etckeeper/commit_failed || true
- exit 0
-fi
-
if etckeeper unclean; then
if [ "$AVOID_COMMIT_BEFORE_INSTALL" = 1 ]; then
echo "" >&2
exit 1
fi
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
- echo "error: etckeeper failed to commit changes in /etc using $VCS"
- exit 1
- fi
+ echo "warning: etckeeper failed to commit changes in /etc using $VCS" >&2
fi
fi
exit 0
else
realfile="$file"
- if which tempfile >/dev/null 2>&1 || type -p tempfile >/dev/null 2>&1; then
+ if which tempfile >/dev/null 2>&1 || type tempfile >/dev/null 2>&1; then
tempfile="tempfile"
- elif which mktemp >/dev/null 2>&1 || type -p mktemp >/dev/null 2>&1; then
+ elif which mktemp >/dev/null 2>&1 || type mktemp >/dev/null 2>&1; then
tempfile="mktemp"
else
echo "etckeeper warning: can't find tempfile or mktemp" >&2
file=$($tempfile)
otherentries=
skipping=
- while read line; do
+ while read -r line; do
if echo "$line" | grep -q "$managed_by_etckeeper"; then
if [ ! "$skipping" ]; then
skipping=1
ignore "*.pacorig"
ignore "*.pacsave"
nl
- elif [ "$LOWLEVEL_PACKAGE_MANAGER" = "qlist" ]; then
+ elif [ "$LOWLEVEL_PACKAGE_MANAGER" = "qlist" -o "$LOWLEVEL_PACKAGE_MANAGER" = "cave" ]; then
comment "new and old versions of conffiles, stored by emerge"
- ignore "*._cfg*"
+ ignore "._cfg*"
nl
fi
ignore "cups/subscriptions.conf"
ignore "cups/subscriptions.conf.O"
ignore "fake-hwclock.data"
+ ignore "check_mk/logwatch.state"
nl
comment "editor temp files"
fi
fi
realfile="$file"
- if which tempfile >/dev/null 2>&1 || type -p tempfile >/dev/null 2>&1; then
+ if which tempfile >/dev/null 2>&1 || type tempfile >/dev/null 2>&1; then
tempfile="tempfile"
- elif which mktemp >/dev/null 2>&1 || type -p mktemp >/dev/null 2>&1; then
+ elif which mktemp >/dev/null 2>&1 || type mktemp >/dev/null 2>&1; then
tempfile="mktemp"
else
echo "etckeeper warning: can't find tempfile or mktemp" >&2
file=$($tempfile)
(
skipping=
- while read line; do
+ while read -r line; do
if echo "$line" | grep -q "$managed_by_etckeeper"; then
if [ ! "$skipping" ]; then
skipping=1