2013-01-09 11:41:04 +01:00
|
|
|
#!/usr/bin/env zsh
|
|
|
|
################################################################################
|
|
|
|
## Package List Generator
|
|
|
|
## 2013-01-09
|
|
|
|
################################################################################
|
2013-06-25 22:56:10 +02:00
|
|
|
## This script used to save the file list of my home config. However this is
|
2013-01-09 11:41:04 +01:00
|
|
|
## quiet cumbersome to maintain, especially in sync with a VCS. Since VCS can do
|
|
|
|
## the same job much more easily, I do not feel the need anymore to use this
|
2013-06-25 22:56:10 +02:00
|
|
|
## script for backup purpose. Still it remains useful to create lists of system
|
|
|
|
## packages and TeX Live.
|
2013-01-09 11:41:04 +01:00
|
|
|
|
|
|
|
## Git can create a bundle with:
|
|
|
|
##
|
|
|
|
## git bundle create --all
|
|
|
|
##
|
2013-01-09 14:02:25 +01:00
|
|
|
## and can list files with:
|
2013-01-09 11:41:04 +01:00
|
|
|
##
|
|
|
|
## git ls-files
|
2013-01-09 14:02:25 +01:00
|
|
|
##
|
|
|
|
## Getting a .tar archive is still quiet easy with Git:
|
|
|
|
##
|
|
|
|
## tar cvJf archive.tar.xz $(cd $HOME && git ls-files)
|
2013-01-09 11:41:04 +01:00
|
|
|
|
|
|
|
## This script should be compatible with ksh, bash and zsh. Issue with sh
|
2013-06-25 22:56:10 +02:00
|
|
|
## however: we use the <(...) syntax.
|
2013-01-09 11:41:04 +01:00
|
|
|
|
|
|
|
## Variables
|
2013-05-21 21:57:54 +02:00
|
|
|
HOST="$(hostname)"
|
2013-01-09 11:41:04 +01:00
|
|
|
|
|
|
|
## Arch Linux
|
|
|
|
if [ -e "/usr/bin/pacman" ]; then
|
2013-05-21 21:57:54 +02:00
|
|
|
ARCH_PKG_OFFICIAL="$HOME/.pkg-arch-official-${HOST}"
|
|
|
|
ARCH_PKG_AUR="$HOME/.pkg-arch-aur-${HOST}"
|
2013-01-09 11:41:04 +01:00
|
|
|
|
|
|
|
PKG_LOCAL='pacman -Qq | sort'
|
|
|
|
PKG_FOREIGN='pacman -Qmq | sort'
|
|
|
|
|
2013-05-21 21:57:54 +02:00
|
|
|
comm -3 <(eval "${PKG_LOCAL}") <(eval "${PKG_FOREIGN}") >"${ARCH_PKG_OFFICIAL}"
|
|
|
|
eval "${PKG_FOREIGN}" >"${ARCH_PKG_AUR}"
|
2013-01-09 11:41:04 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
## FreeBSD
|
|
|
|
if [ "$(uname)" = "FreeBSD" ]; then
|
2013-05-21 21:57:54 +02:00
|
|
|
pkg_info | cut -f1 -d' ' >"$HOME/.pkg-freebsd-${HOST}"
|
2013-01-09 11:41:04 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
## TeXlive
|
|
|
|
if type tlmgr >/dev/null 2>&1; then
|
|
|
|
HOST=$(hostname)
|
|
|
|
|
|
|
|
## We use <TAB> in the sed expressions.
|
|
|
|
TEXLIVE_BASIC="$(tlmgr info collection-basic --list | sed -n '/^ /{s/ //g;p;}' | sort)"
|
|
|
|
TEXLIVE_ALL="$(tlmgr info --only-installed | grep -v 'x86_64\|amd64' | cut -d' ' -f2 | cut -f1 -d':' | sort)"
|
|
|
|
|
|
|
|
comm -3 <(echo "$TEXLIVE_BASIC") <(echo "$TEXLIVE_ALL") | sed 's/ //g' | \
|
|
|
|
grep -vi 'collection-basic\|scheme-minimal\|texlive-common\|texlive-docindex\|texlive-en' >"$HOME/.pkg-texlive-$(uname)-${HOST}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
## Cleaning
|
|
|
|
cd "${OLDPATH}"
|