committing changes in /etc made by "-bash"
Package changes:
This commit is contained in:
@@ -128,7 +128,7 @@ elif [ "$VCS" = bzr ] && [ -d .bzr ]; then
|
||||
if [ -n "$logfile" ]; then
|
||||
bzr commit $BZR_COMMIT_OPTIONS -F "$logfile"
|
||||
else
|
||||
bzr commit $BZR_COMMIT_OPTIONS
|
||||
bzr commit --quiet $BZR_COMMIT_OPTIONS
|
||||
fi
|
||||
elif [ "$VCS" = darcs ] && [ -d _darcs ]; then
|
||||
if [ -z "$USER" ]; then
|
||||
|
||||
45
etckeeper/etckeeper.conf.rpmnew
Normal file
45
etckeeper/etckeeper.conf.rpmnew
Normal file
@@ -0,0 +1,45 @@
|
||||
# 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"
|
||||
|
||||
# Etckeeper includes both a cron job and a systemd timer, which each
|
||||
# can commit exiting changes to /etc automatically once per day.
|
||||
# To enable the systemd timer, run: systemctl enable etckeeper.timer
|
||||
# The cron job is enabled by default; to disable it, uncomment this next line.
|
||||
#AVOID_DAILY_AUTOCOMMITS=1
|
||||
|
||||
# Uncomment the following to avoid special file warning
|
||||
# (the option is enabled automatically for daily autocommits 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, pacman-g2, yum, dnf, zypper, apk, xbps, emerge, cave, etc)
|
||||
HIGHLEVEL_PACKAGE_MANAGER=dnf
|
||||
|
||||
# The low-level package manager that's being used.
|
||||
# (dpkg, rpm, pacman, pacmatic, pacman-g2, apk, xbps, cave, qlist, etc)
|
||||
LOWLEVEL_PACKAGE_MANAGER=rpm
|
||||
|
||||
# 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=""
|
||||
@@ -12,6 +12,37 @@ case "$VCS" in
|
||||
#!/bin/sh
|
||||
# pre-commit hook for etckeeper, to store metadata and do sanity checks
|
||||
set -e
|
||||
|
||||
################################################################################
|
||||
# Do not run etckeeper inside linked worktrees. An additional worktree can be
|
||||
# very useful for resolving *.rpmsave/*.rpmnew files where you are able to merge
|
||||
# and check out older versions without changing the whole content of /etc.
|
||||
# However while doing such work, avoid modifying .etckeeper since only the /etc
|
||||
# directory should track permissions.
|
||||
#
|
||||
#
|
||||
# $ cd /etc
|
||||
# $ git worktree list
|
||||
# /etc 2984704 [main]
|
||||
# /root/etc.worktree aeae148 [main.worktree]
|
||||
# $ git rev-parse --git-dir
|
||||
# .git
|
||||
# $ cd /root/etc.worktree
|
||||
# $ git rev-parse --git-dir
|
||||
# /etc/.git/worktrees/etc.worktree
|
||||
# $
|
||||
#
|
||||
################################################################################
|
||||
|
||||
# Using 'rev-parse' + 'grep' rather than for instance parsing output from
|
||||
# 'worktree list' since the worktree command is not present in older git version
|
||||
# and parsing it would be slightly more complex.
|
||||
if git rev-parse --git-dir | grep -q /.git/worktrees
|
||||
then
|
||||
# Inside worktree, do nothing.
|
||||
exit
|
||||
fi
|
||||
|
||||
etckeeper pre-commit -d `pwd`
|
||||
EOF
|
||||
chmod +x .git/hooks/pre-commit
|
||||
|
||||
@@ -17,7 +17,7 @@ else
|
||||
# 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
|
||||
grep -E '(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
|
||||
@@ -28,5 +28,11 @@ else
|
||||
pkg info -E "*"
|
||||
elif [ "$LOWLEVEL_PACKAGE_MANAGER" = apk ]; then
|
||||
apk info -v | sort
|
||||
elif [ "$LOWLEVEL_PACKAGE_MANAGER" = xbps ]; then
|
||||
xbps-query -l | awk '{print $2}' | sed -r 's/-([^-]+)$/ \1/g;'
|
||||
elif [ "$LOWLEVEL_PACKAGE_MANAGER" = qlist ]; then
|
||||
qlist -ICv
|
||||
elif [ "$LOWLEVEL_PACKAGE_MANAGER" = cave ]; then
|
||||
cave print-packages -r installed
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -49,6 +49,9 @@ get_changed_packages () {
|
||||
if [ "$LOWLEVEL_PACKAGE_MANAGER" = pkgng ]; then
|
||||
get_changes | sed 's/^/\/etc\//;s/\s*$//' | xargs -d '\n' pkg which --quiet | rev | cut -d'-' -f2- | rev
|
||||
fi
|
||||
if [ "$LOWLEVEL_PACKAGE_MANAGER" = xbps ]; then
|
||||
get_changes | sed 's/^/\/etc\//;s/\s*$//' | xargs -d '\n' xbps-query -o | cut -d':' -f1
|
||||
fi
|
||||
}
|
||||
|
||||
if etckeeper unclean; then
|
||||
@@ -66,7 +69,7 @@ if etckeeper unclean; then
|
||||
get_changed_packages | sort | uniq > $pl.found-pkgs
|
||||
if [ -s $pl.found-pkgs ]; then
|
||||
sed -i 's/^/^[-+]/;s/$/ /' $pl.found-pkgs
|
||||
etckeeper list-installed | diff -U0 $pl.pre-install - | tail -n+4 | egrep '^[-+]' | grep -f $pl.found-pkgs > $pl.found-packages
|
||||
etckeeper list-installed | diff -U0 $pl.pre-install - | tail -n+4 | grep -E '^[-+]' | grep -f $pl.found-pkgs > $pl.found-packages
|
||||
if [ -s $pl.found-packages ]; then
|
||||
echo "Packages with configuration changes:"
|
||||
cat $pl.found-packages || true
|
||||
@@ -74,7 +77,7 @@ if etckeeper unclean; then
|
||||
fi
|
||||
fi
|
||||
echo "Package changes:"
|
||||
etckeeper list-installed | diff -U0 $pl.pre-install - | tail -n+4 | egrep '^[-+]' || true
|
||||
etckeeper list-installed | diff -U0 $pl.pre-install - | tail -n+4 | grep -E '^[-+]' || true
|
||||
) | etckeeper commit --stdin
|
||||
else
|
||||
etckeeper commit "$(printf "$message")"
|
||||
|
||||
@@ -105,8 +105,16 @@ writefile () {
|
||||
comment "new versions of conffiles, stored by apk"
|
||||
ignore "*.apk-new"
|
||||
nl
|
||||
elif [ "$LOWLEVEL_PACKAGE_MANAGER" = "xbps" ]; then
|
||||
comment "new versions of conffiles, stored by xbps"
|
||||
ignore "*.new-*_[0-9]*"
|
||||
nl
|
||||
elif [ "$LOWLEVEL_PACKAGE_MANAGER" = "qlist" -o "$LOWLEVEL_PACKAGE_MANAGER" = "cave" ]; then
|
||||
comment "new and old versions of conffiles, stored by emerge"
|
||||
ignore "._cfg*"
|
||||
nl
|
||||
fi
|
||||
|
||||
|
||||
comment "old versions of files"
|
||||
ignore "*.old"
|
||||
# Not currently ignored as admins tend to rely on these files.
|
||||
|
||||
Reference in New Issue
Block a user