Skip to content

Instantly share code, notes, and snippets.

@KellerFuchs
Last active September 20, 2017 15:14
Show Gist options
  • Save KellerFuchs/7e8016c532517a3dfea06053fd8a41b5 to your computer and use it in GitHub Desktop.
Save KellerFuchs/7e8016c532517a3dfea06053fd8a41b5 to your computer and use it in GitHub Desktop.
etckeeper-less branch
#!/usr/bin/env bash
function silent_ssh {
local connectionString="$1"
local commands="$2"
if [ -z "$commands" ]; then
commands=`cat`
fi
ssh -T $connectionString "$commands"
}
silent_ssh [email protected] <<'EOF' | sort -u | tee z_custom.list
dpkg-query -W -f='${Conffiles}\n' '*' \
| awk 'OFS=" "{print $2,$1}' \
| LANG=C md5sum -c 2>/dev/null \
| awk -F': ' '$2 !~ /OK$/{print $1}' \
| sed 's/^\/etc\///g'
find /etc \
-xdev \
-type f \
\( -exec grep -xq "{}" /var/lib/dpkg/info/*.list \; -or -print \) \
| grep -v '/etc/.git' \
| sed 's/^\/etc\///g'
EOF
#!/usr/bin/env bash
set -x
filter_dir=$(dirname $0)
_remove_files=$(grep -vf \
"${filter_dir}/z_custom.list" \
<(git log --pretty=format: --name-only --diff-filter=A | sort -u)
)
IFS=$'\r\n' GLOBIGNORE='*' command eval 'remove_files=(${_remove_files})'
unset _remove_files
ignore_dirs=(
X11 xml xdg staff-group-for-usr-local sane.d
rcS.d rc6.d rc1.d rc0.d rc.local
python python3 procmailrc php5 papersize openntpd nova-agent.env
motd modules-load.d modules mailcap mailcap.order logcheck
kernel-img.conf iscsi iproute2 inputrc inittab initramfs-tools
init.d ImageMagick-6 hosts.allow hosts.deny gtk-3.0 ghostscript
gconf fonts etckeeper .etckeeper .gitignore devscripts.conf default/bitlbee
default/console-setup default/grub default/hddtemp default/kexec
default/keyboard default/saned default/sysstat dbus-1 cruft
ca-certificates.conf bitlbee bash_completion.d audit at-spi2 apparmor.d
adduser.conf
)
git filter-branch --force --prune-empty \
--index-filter "git rm --ignore-unmatch --cached -r ${ignore_dirs[*]} ${remove_files[*]}"
adduser.conf
adjtime
aliases
aliases.db
apparmor.d/local/system_tor
apparmor.d/local/usr.sbin.sssd
apparmor.d/local/usr.sbin.unbound
apt/apt.conf.d/00CDMountPoint
apt/apt.conf.d/00InstallRecommends
apt/apt.conf.d/00trustcdrom
apt/apt.conf.d/01autoremove-kernels
apt/preferences
apt/preferences.d/ansible
apt/preferences.d/firejail
apt/preferences.d/gnupg
apt/preferences.d/.keep
apt/preferences.d/kernel
apt/preferences.d/mosh
apt/preferences.d/openntpd
apt/preferences.d/unbound
apt/sources.list
apt/sources.list~
apt/sources.list.d/tor.list
apt/sources.list.d/weechat.list
apt/trusted.gpg
apt/trusted.gpg.d/weechat.gpg
at-spi2/accessibility.conf
audit/audit.rules
ca-certificates.conf
ca-certificates.conf.dpkg-old
console-setup/cached_Lat15-Fixed16.psf.gz
console-setup/cached_UTF-8_del.kmap.gz
cron.daily/clean-lurkers
crontab
dbus-1/system.d/org.freedesktop.ColorManager.conf
DEADJOE
default/bitlbee
default/console-setup
default/ferm
default/grub
default/grub.ucf-dist
default/haveged
default/haveged.dpkg-dist
default/hddtemp
default/kexec
default/keyboard
default/locale
default/rcS
default/saned
default/sysstat
default/useradd
devscripts.conf
emacs24/site-start.d/00debian-vars.elc
environment
.etckeeper
etckeeper/commit.d/99push
etckeeper/etckeeper.conf
etckeeper/post-install.d/00package-list
ferm/ferm.conf
ferm/ferm.conf.dpkg-dist
firejail/7z.profile
firejail/abrowser.profile
firejail/amarok.profile
firejail/ark.profile
firejail/atom-beta.profile
firejail/atom.profile
firejail/atool.profile
firejail/atril.profile
firejail/audacity.profile
firejail/aweather.profile
firejail/bleachbit.profile
firejail/bless.profile
firejail/brasero.profile
firejail/brave.profile
firejail/cherrytree.profile
firejail/chromium.profile
firejail/claws-mail.profile
firejail/corebird.profile
firejail/cpio.profile
firejail/cryptocat.profile
firejail/Cryptocat.profile
firejail/cyberfox.profile
firejail/default.profile
firejail/dillo.profile
firejail/disable-common.inc
firejail/disable-common.inc.dpkg-dist
firejail/disable-common.local
firejail/disable-devel.local
firejail/disable-passwdmgr.inc
firejail/disable-passwdmgr.inc.dpkg-dist
firejail/disable-passwdmgr.local
firejail/disable-programs.inc
firejail/disable-programs.inc.dpkg-dist
firejail/disable-programs.local
firejail/display.profile
firejail/dolphin.profile
firejail/dragon.profile
firejail/elinks.profile
firejail/emacs.profile
firejail/empathy.profile
firejail/enchant.profile
firejail/eog.profile
firejail/evince.profile
firejail/evolution.profile
firejail/exiftool.profile
firejail/fbreader.profile
firejail/feh.profile
firejail/file.profile
firejail/file-roller.profile
firejail/filezilla.profile
firejail/firefox.profile
firejail/firejail.config
firejail/firejail.config.dpkg-dist
firejail/firejail-default
firejail/flashpeak-slimjet.profile
firejail/flowblade.profile
firejail/fossamail.profile
firejail/FossaMail.profile
firejail/franz.profile
firejail/gajim.profile
firejail/gedit.profile
firejail/gimp.profile
firejail/git.profile
firejail/git.profile.dpkg-dist
firejail/gjs.profile
firejail/gnome-2048.profile
firejail/gnome-books.profile
firejail/gnome-calculator.profile
firejail/gnome-chess.profile
firejail/gnome-clocks.profile
firejail/gnome-contacts.profile
firejail/gnome-documents.profile
firejail/gnome-maps.profile
firejail/gnome-mplayer.profile
firejail/gnome-music.profile
firejail/gnome-photos.profile
firejail/gnome-weather.profile
firejail/goobox.profile
firejail/google-chrome-beta.profile
firejail/google-chrome.profile
firejail/google-chrome-unstable.profile
firejail/gpa.profile
firejail/gpg-agent.profile
firejail/gpg.profile
firejail/gpredict.profile
firejail/gthumb.profile
firejail/guayadeque.profile
firejail/gwenview.profile
firejail/gzip.profile
firejail/highlight.profile
firejail/icecat.profile
firejail/icedove.profile
firejail/img2txt.profile
firejail/inkscape.profile
firejail/inox.profile
firejail/jd-gui.profile
firejail/jitsi.profile
firejail/k3b.profile
firejail/kate.profile
firejail/keepass2.profile
firejail/keepass.profile
firejail/keepassx2.profile
firejail/keepassx.profile
firejail/kmail.profile
firejail/konversation.profile
firejail/less.profile
firejail/lollypop.profile
firejail/luminance-hdr.profile
firejail/lxterminal.profile
firejail/lynx.profile
firejail/mediainfo.profile
firejail/multimc5.profile
firejail/mumble.profile
firejail/mupdf.profile
firejail/mupdf.profile.dpkg-dist
firejail/mutt.profile
firejail/mutt.profile.dpkg-dist
firejail/nautilus.profile
firejail/netsurf.profile
firejail/odt2txt.profile
firejail/okular.profile
firejail/opera-beta.profile
firejail/opera.profile
firejail/palemoon.profile
firejail/pdfsam.profile
firejail/pdftotext.profile
firejail/pidgin.profile
firejail/pithos.profile
firejail/pix.profile
firejail/pluma.profile
firejail/psi-plus.profile
firejail/qbittorrent.profile
firejail/qemu-launcher.profile
firejail/qemu-system-x86_64.profile
firejail/qpdfview.profile
firejail/qtox.profile
firejail/quiterss.profile
firejail/qupzilla.profile
firejail/qutebrowser.profile
firejail/ranger.profile
firejail/rhythmbox.profile
firejail/rtorrent.profile
firejail/seamonkey.profile
firejail/server.profile
firejail/simple-scan.profile
firejail/skanlite.profile
firejail/slack.profile
firejail/snap.profile
firejail/spotify.profile
firejail/ssh-agent.profile
firejail/start-tor-browser.profile
firejail/strings.profile
firejail/synfigstudio.profile
firejail/tar.profile
firejail/telegram.profile
firejail/thunderbird.profile
firejail/tracker.profile
firejail/transmission-cli.profile
firejail/transmission-gtk.profile
firejail/transmission-qt.profile
firejail/transmission-show.profile
firejail/uget-gtk.profile
firejail/unrar.profile
firejail/unzip.profile
firejail/uudeview.profile
firejail/vim.profile
firejail/virtualbox.profile
firejail/VirtualBox.profile
firejail/vivaldi.profile
firejail/vivaldi.profile.dpkg-dist
firejail/w3m.profile
firejail/weechat.profile
firejail/wesnoth.profile
firejail/wget.profile
firejail/whitelist-common.inc
firejail/whitelist-common.inc.dpkg-dist
firejail/whitelist-common.local
firejail/wire.profile
firejail/Wire.profile
firejail/wireshark.profile
firejail/xed.profile
firejail/xfburn.profile
firejail/xiphos.profile
firejail/xonotic-glx.profile
firejail/xonotic.profile
firejail/xonotic-sdl.profile
firejail/xpdf.profile
firejail/xplayer.profile
firejail/xpra.profile
firejail/xviewer.profile
firejail/xzdec.profile
firejail/zathura.profile
firejail/zoom.profile
fstab
fstab.sample
gconf/2/path
gconf/gconf.xml.defaults/%gconf-tree.xml
gconf/gconf.xml.mandatory/%gconf-tree.xml
gemrc
gnupg/hashbang-admins.gpg
gnupg/README.md
group
group-
gshadow
gshadow-
gtk-3.0/im-multipress.conf
hashbangctl.conf
hashbang/welcome
hashbang/welcome.notmux
hashbang/welcome.post
hashbang/welcome.pre
hashbang/welcome.tmux
hostname
hosts
hosts.allow
hosts.deny
init.d/.depend.boot
init.d/.depend.start
init.d/.depend.stop
init.d/saned
init.d/xe-linux-distribution
initramfs-tools/modules
initramfs-tools/scripts/repartition-drive
inittab
inputrc
iscsi/iscsid.conf
.java/.systemPrefs/.system.lock
.java/.systemPrefs/.systemRootModFile
kernel-img.conf
ld.so.cache
ld.so.preload
LICENSE.md
locale.gen
localtime
login.defs
logrotate.conf
luarocks/config-5.1.lua
luarocks/config-5.2.lua
luarocks/config-5.3.lua
machine-id
mailcap
mailname
man/man7/hashbang.7
manpath.config
modules
motd
msmtprc
msmtprc.ucf-dist
network/interfaces
network/interfaces.example
networks
nova-agent.env
npmrc
nslcd.conf
nsswitch.conf
oidentd.conf
oidentd.conf.dpkg-dist
openntpd/ntpd.conf
packages.txt
pam.d/atd
pam.d/chsh
pam.d/common-account
pam.d/common-auth
pam.d/common-password
pam.d/common-session
pam.d/common-session-noninteractive
pam.d/cron
pam.d/login
pam.d/sshd
pam.d/sudo
pam.d/systemd-user
papersize
passwd
passwd-
php5/cgi/php.ini
php5/cli/php.ini
php5/fpm/php.ini
php5/mods-available/curl.ini
php5/mods-available/mysqli.ini
php5/mods-available/mysql.ini
php5/mods-available/opcache.ini
php5/mods-available/pdo.ini
php5/mods-available/pdo_mysql.ini
php5/mods-available/pdo_sqlite.ini
php5/mods-available/sqlite3.ini
postfix/dynamicmaps.cf
postfix/main.cf
postfix/master.cf
procmailrc
profile
profile.d/dotfiles.sh
profile.d/go.sh
profile.d/local_path.sh
profile.d/luarocks_aliases.sh
profile.d/npm.sh
profile.d/nvm.sh
profile.d/user_ruby_bin_directory.sh
profile.d/wall.sh
profile.d/z_manpath.sh
.pwd.lock
python3/debian_config
python/debian_config
rc.local
README.md
resolvconf/resolv.conf.d/base
resolvconf/resolv.conf.d/original
resolvconf/resolv.conf.d/tail
rsyslog.conf
sane.d/abaton.conf
sane.d/agfafocus.conf
sane.d/apple.conf
sane.d/artec.conf
sane.d/artec_eplus48u.conf
sane.d/avision.conf
sane.d/bh.conf
sane.d/canon630u.conf
sane.d/canon.conf
sane.d/canon_dr.conf
sane.d/canon_pp.conf
sane.d/cardscan.conf
sane.d/coolscan2.conf
sane.d/coolscan3.conf
sane.d/coolscan.conf
sane.d/dc210.conf
sane.d/dc240.conf
sane.d/dc25.conf
sane.d/dell1600n_net.conf
sane.d/dll.conf
sane.d/dll.d/libsane-extras
sane.d/dmc.conf
sane.d/epjitsu.conf
sane.d/epson2.conf
sane.d/epson.conf
sane.d/fujitsu.conf
sane.d/genesys.conf
sane.d/geniusvp2.conf
sane.d/gphoto2.conf
sane.d/gt68xx.conf
sane.d/hp3900.conf
sane.d/hp4200.conf
sane.d/hp5400.conf
sane.d/hp.conf
sane.d/hpsj5s.conf
sane.d/hs2p.conf
sane.d/ibm.conf
sane.d/kodakaio.conf
sane.d/kodak.conf
sane.d/leo.conf
sane.d/lexmark.conf
sane.d/ma1509.conf
sane.d/magicolor.conf
sane.d/matsushita.conf
sane.d/microtek2.conf
sane.d/microtek.conf
sane.d/mustek.conf
sane.d/mustek_pp.conf
sane.d/mustek_usb.conf
sane.d/nec.conf
sane.d/net.conf
sane.d/p5.conf
sane.d/pie.conf
sane.d/pixma.conf
sane.d/plustek.conf
sane.d/plustek_pp.conf
sane.d/qcam.conf
sane.d/ricoh.conf
sane.d/rts8891.conf
sane.d/s9036.conf
sane.d/saned.conf
sane.d/sceptre.conf
sane.d/sharp.conf
sane.d/sm3840.conf
sane.d/snapscan.conf
sane.d/sp15c.conf
sane.d/st400.conf
sane.d/stv680.conf
sane.d/tamarack.conf
sane.d/teco1.conf
sane.d/teco2.conf
sane.d/teco3.conf
sane.d/test.conf
sane.d/u12.conf
sane.d/umax1220u.conf
sane.d/umax.conf
sane.d/umax_pp.conf
sane.d/v4l.conf
sane.d/xerox_mfp.conf
security/limits.conf
security/namespace.conf
security/namespace.init
security/opasswd
shadow
shadow-
shells
skel/.bash_logout
skel/.bashrc
skel/Mail/new/msg.welcome
skel/.profile
skel/Public/index.html
ssh/ssh_config
ssh/sshd_config
ssh/ssh_host_dsa_key
ssh/ssh_host_dsa_key.pub
ssh/ssh_host_ecdsa_key
ssh/ssh_host_ecdsa_key.pub
ssh/ssh_host_ed25519_key
ssh/ssh_host_ed25519_key.pub
ssh/ssh_host_rsa_key
ssh/ssh_host_rsa_key.pub
ssl/certs/ca-certificates.crt
ssl/certs/ssl-cert-snakeoil.pem
ssl/private/ssl-cert-snakeoil.key
sssd/sssd.conf
staff-group-for-usr-local
subgid
subgid-
subuid
subuid-
sudoers
sudoers.d/hashbangctl
sysctl.conf
sysctl.d/10-dmsg.conf
systemd/journald.conf
systemd/system/[email protected]
systemd/system/[email protected]
systemd/system/crontab.target
systemd/system/[email protected]
timezone
tmpfiles.d/namespaces
tor/torsocks.conf
tor/torsocks.conf.dpkg-dist
udev/rules.d/70-persistent-net.rules
unbound/unbound.conf.d/debian.conf
unbound/unbound.conf.d/harden.conf
unbound/unbound.conf.d/prefetch.conf
unbound/unbound_control.key
unbound/unbound_control.pem
unbound/unbound_server.key
unbound/unbound_server.pem
X11/Xsession.d/90qt-a11y
xdg/autostart/at-spi-dbus-bus.desktop
xml/catalog
xml/catalog.old
xml/docutils-common.xml
xml/docutils-common.xml.old
xml/xml-core.xml
xml/xml-core.xml.old
zsh/zprofile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment