#!/bin/bash # Original... # Copyright (c) 2000 Matthias S. Benkmann
# You may do everything with this code except misrepresent its origin. # PROVIDED `AS IS' WITH ABSOLUTELY NO WARRANTY OF ANY KIND! # Copyright (C) 2014 Steve Youngs # Optionally nuke locale directories. watchdir=/usr/share/locale DAISY_CHAIN="" for p in $(type -ap mkdir) ; do if [ ! $p -ef $0 ]; then DAISY_CHAIN=$p break fi done if [ ! -n "$DAISY_CHAIN" ]; then echo 1>&2 '***' Cannot find real ${0##*/} command exit 1 fi if [ $(id -u) == 0 ]; then echo 1>&2 '***' $(dirname $0) should not be in root\'s \$PATH echo 1>&2 '***' Call '"'$DAISY_CHAIN $@'"' directly. exit 1 fi cmdline="$@" dirs="" for((i=$#; $i>0;)) do a="$1" shift 1; i=$(($i-1)) case "$a" in ($watchdir/*) dirs="$dirs ""$(expr $a : "$watchdir/\(.*\)")" set -- "$@" "$a" ;; (*) set -- "$@" "$a" ;; esac done $DAISY_CHAIN "$@" || exit $? test z"$dirs" != z && echo 1>&2 '***' mkdir "$cmdline" for dir in $dirs ; do cumuldir="" for d in $(echo $dirs | sed 's#/# #g' -) ; do cumuldir=$cumuldir$d/ if [ $SUPPRESSLOCALEDIR -eq 0 ]; then echo 1>&2 '***' Possible root intervention required echo 1>&2 '***' install -vdm1775 -oroot -ginstall $watchdir/$cumuldir else echo 1>&2 '***' Locale directory creation suppressed echo 1>&2 '***' $watchdir/$cumuldir rm -rf $watchdir/$cumuldir fi done done exit 0 # Local variables: # sh-basic-offset: 4 # End: