pkggen: POSIX version, removed the stupid code
parent
0b0feea15e
commit
d9d48a3898
|
@ -1,43 +1,17 @@
|
|||
#!/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.
|
||||
#!/bin/sh
|
||||
|
||||
## 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.
|
||||
## Create lists of system- and TeX Live packages.
|
||||
|
||||
## Variables
|
||||
HOST="$(hostname)"
|
||||
PKG_ROOT="$HOME/.pkg"
|
||||
mkdir -p "$PKG_ROOT"
|
||||
|
||||
## 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}"
|
||||
if [ -n "$(command -v pacman)" ]; then
|
||||
## Note: the "-n" option was added between 2012 and 2013.
|
||||
pacman -Qnq | sort >"$PKG_ROOT/arch-official-${HOST}"
|
||||
pacman -Qmq | sort >"$PKG_ROOT/arch-aur-${HOST}"
|
||||
fi
|
||||
|
||||
## FreeBSD
|
||||
|
@ -47,15 +21,22 @@ 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)"
|
||||
TEXLIVE_BASIC="$(mktemp)"
|
||||
tlmgr info collection-basic --list | sed -n '/^ /{s/ //g;p;}' | sort >"$TEXLIVE_BASIC"
|
||||
|
||||
comm -3 <(echo "$TEXLIVE_BASIC") <(echo "$TEXLIVE_ALL") | sed 's/ //g' | \
|
||||
TEXLIVE_ALL="$(mktemp)"
|
||||
tlmgr info --only-installed | grep -v 'x86_64\|amd64' | cut -d' ' -f2 | cut -f1 -d':' | sort >"$TEXLIVE_ALL"
|
||||
|
||||
comm -3 "$TEXLIVE_BASIC" "$TEXLIVE_ALL" | sed 's/ //g' | \
|
||||
grep -vi 'collection-basic\|scheme-minimal\|texlive-common\|texlive-docindex\|texlive-en' >"$PKG_ROOT/texlive-$(uname)-${HOST}"
|
||||
|
||||
rm "$TEXLIVE_ALL" "$TEXLIVE_BASIC"
|
||||
fi
|
||||
|
||||
## Cleaning
|
||||
cd "${OLDPATH}"
|
||||
## Zsh version
|
||||
# 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}"
|
||||
|
|
Loading…
Reference in New Issue