Scripts: Various fixes

master
Pierre Neidhardt 2014-08-19 11:06:03 +02:00
parent d89348233a
commit dec80c219f
9 changed files with 29 additions and 11 deletions

View File

@ -1,5 +1,10 @@
#!/usr/bin/env zsh
## This is a home-made network manager. Systems running systemd and dhcpcd are
## better off running the dhcpcd daemon with
## /etc/wpa_supplicant/wpa_supplicant.conf configured if needed. See
## dhcpcd-run-hooks(8).
## Deps: wpa_supplicant, ccrypt (optional)
## We need to use wpa_supplicant's unencrypted config file. We store it in a

View File

@ -71,7 +71,15 @@ for i ; do
continue
fi
OUTPUT="${i%.*}-compressed.pdf"
case "$i" in
*/*) ;;
*) i="./$i" ;;
esac
DIRNAME="${i%/*}"
BASENAME="${i##*/}"
EXTNAME="${BASENAME##*.}"
BASENAME="${BASENAME%.*}"
OUTPUT="$DIRNAME/$BASENAME-compressed.pdf"
if [ -e "$OUTPUT" ] && ! $OPT_OVERWRITE; then
echo "$OUTPUT alredy present. Skipping."
continue

View File

@ -20,7 +20,7 @@ if [ "$(uname)" = "FreeBSD" ]; then
fi
## TeXlive
if type tlmgr >/dev/null 2>&1; then
if command -v tlmgr >/dev/null 2>&1; then
## We use <TAB> in the sed expressions.
TEXLIVE_BASIC="$(mktemp)"
tlmgr info collection-basic --list | sed -n '/^ /{s/ //g;p;}' | sort >"$TEXLIVE_BASIC"

View File

@ -14,7 +14,7 @@ fi
## We need a temp file is case both files are in the same folder. We use the
## unsecure option since we do not want to create a empty file in
## advance. Indeed, creating a file with mktemp is problematic for folders since
## non-GNU mv can only move _into_ an exisintg folder. But we do not overwrite
## non-GNU mv can only move _into_ an existing folder. But we do not overwrite
## if file exists.
TEMPFILE="$(mktemp -u "$1.XXXXXX")"

View File

@ -5,7 +5,7 @@ if [ $# -eq 0 ] || [ "$1" = "-h" ]; then
Usage: ${0##*/} FOLDERS
Set file/directory owner and permissions according to current umask for current
used.
user.
EOF
exit
fi

View File

@ -1,6 +1,6 @@
#!/bin/sh
if ! command -v mediainfo >/dev/null; then
if ! command -v mediainfo >/dev/null 2>&1; then
echo "mediainfo required."
exit
fi

View File

@ -11,7 +11,7 @@ WARNING: It will fail for encodings other the one explicitly supported below.
EOF
fi
if ! command -v recode >/dev/null; then
if ! command -v recode >/dev/null 2>&1; then
echo "recode needed."
exit
fi

View File

@ -10,7 +10,7 @@ or "oe" instead of "œ".
EOF
fi
if ! command -v recode >/dev/null; then
if ! command -v recode >/dev/null 2>&1; then
echo "recode needed."
exit
fi

View File

@ -17,13 +17,18 @@ fi
for i ; do
while read -r FILE; do
FILE_NOEXT="${FILE##*/}"
FILE_NOEXT="${FILE_NOEXT%.*}"
FILE_PATH="${FILE%/*}"
case FILE in
*/*) ;;
*)
FILE="./$FILE" ;;
esac
DIRNAME="${FILE%/*}"
BASENAME="${FILE##*/}"
BASENAME="${BASENAME%.*}"
rm -v $(for j in \
aux bbl blg cp cps fn glg glo gls idx ilg ind ky lof log maf mt mtc nav out pg snm synctex.gz synctex tns toc tp vr vrs xdy
do
echo "$FILE_PATH/$FILE_NOEXT.$j"
echo "$DIRNAME/$BASENAME.$j"
done) 2>/dev/null
done <<EOF
$(find "$i" -type f \( -name "*.tex" -o -name "*.texi" \) )