62 lines
1.9 KiB
Bash
Executable File
62 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env zsh
|
|
################################################################################
|
|
## Package List Generator
|
|
## 2013-01-09
|
|
################################################################################
|
|
## This script used to save the file list of my home config. However this is
|
|
## 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
|
|
## script for backup purpose. Still it remains useful to create lists of system
|
|
## packages and TeX Live.
|
|
|
|
## Git can create a bundle with:
|
|
##
|
|
## git bundle create --all
|
|
##
|
|
## and can list files with:
|
|
##
|
|
## git ls-files
|
|
##
|
|
## Getting a .tar archive is still quiet easy with Git:
|
|
##
|
|
## tar cvJf archive.tar.xz $(cd $HOME && git ls-files)
|
|
|
|
## This script should be compatible with ksh, bash and zsh. Issue with sh
|
|
## however: we use the <(...) syntax.
|
|
|
|
## Variables
|
|
HOST="$(hostname)"
|
|
PKG_ROOT="$HOME/.pkg"
|
|
|
|
## Arch Linux
|
|
if [ -e "/usr/bin/pacman" ]; then
|
|
ARCH_PKG_OFFICIAL="$PKG_ROOT/arch-official-${HOST}"
|
|
ARCH_PKG_AUR="$PKG_ROOT/arch-aur-${HOST}"
|
|
|
|
PKG_LOCAL='pacman -Qq | sort'
|
|
PKG_FOREIGN='pacman -Qmq | sort'
|
|
|
|
comm -3 <(eval "${PKG_LOCAL}") <(eval "${PKG_FOREIGN}") >"${ARCH_PKG_OFFICIAL}"
|
|
eval "${PKG_FOREIGN}" >"${ARCH_PKG_AUR}"
|
|
fi
|
|
|
|
## FreeBSD
|
|
if [ "$(uname)" = "FreeBSD" ]; then
|
|
pkg_info | cut -f1 -d' ' >"$PKG_ROOT/freebsd-${HOST}"
|
|
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' >"$PKG_ROOT/texlive-$(uname)-${HOST}"
|
|
fi
|
|
|
|
## Cleaning
|
|
cd "${OLDPATH}"
|