#!/bin/sh #--------------------------------------------------------------- # Project : Mandrake Linux # Module : spec-helper # File : spec-helper # Version : $Id$ # Author : Frederic Lepied # Created On : Wed Feb 9 16:25:21 2000 #--------------------------------------------------------------- if [ -z "$RPM_BUILD_ROOT" ]; then echo "no RPM_BUILD_ROOT variable; exiting." 1>&2 exit 0 fi if [ ! -d $RPM_BUILD_ROOT ]; then exit 0 fi SPEC_HELPER_ROOT=${SPEC_HELPER_ROOT=/usr/share/spec-helper} PATH=$SPEC_HELPER_ROOT:$PATH export PATH # usage usage() { echo "usage: spec-helper [-l|-c|-m|-s|-L|-g|-p|-i|-mo|-M]" 1>&2 echo "-c don't clean up files" 1>&2 echo "-m don't compress files" 1>&2 echo "-s don't strip files" 1>&2 echo "-l don't fix full link as relative." 1>&2 echo "-L don't build lib symlinks." 1>&2 echo "-g don't grpintify init scripts." 1>&2 echo "-p don't fix pam.d configs." 1>&2 echo "-i don't delete info dir." 1>&2 echo "-mo don't fix bad translations." 1>&2 echo "-M don't translate menus." 1>&2 } # handle options while [ $# != 0 ]; do case $1 in -c) DONT_CLEANUP=1;; -m) DONT_COMPRESS=1;; -s) DONT_STRIP=1;; -l) DONT_RELINK=1;; -L) DONT_SYMLINK_LIBS=1;; -g) DONT_GPRINTIFY=1;; -p) DONT_FIX_PAMD_CONFIGS=1;; -i) DONT_REMOVE_INFO_DIR=1;; -mo) DONT_FIX_MO=1;; -M) DONT_TRANSLATE_MENU=1;; *) usage; exit 1;; esac shift done test -z "$DONT_CLEANUP" && echo -n "Cleaning files..." && clean_files && echo "done" test -z "$DONT_COMPRESS" && echo -n "Compressing files..." && compress_files && echo "done" test -z "$DONT_STRIP" && echo -n "Stripping files..." && strip_files && echo "done" test -z "$DONT_RELINK" && echo -n "Relativisation of symlinks..." && relative_me_babe && echo "done" test -z "$DONT_CLEAN_PERL" && echo -n "Clean perl..." && clean_perl && echo "done" test -z "$DONT_SYMLINK_LIBS" && echo -n "Building libraries symlinks..." && lib_symlinks && echo "done" if test -z "$DONT_GPRINTIFY"; then scripts= for f in `ls $RPM_BUILD_ROOT/etc/rc.d/init.d/* $RPM_BUILD_ROOT/etc/init.d/* 2> /dev/null`; do test -f $f && egrep -q '[[:space:]]*\.[[:space:]]+.*/functions' $f && scripts="$scripts $f" done if [ -n "$scripts" ]; then echo -n "Gprintifying init scripts..." && gprintify.py $scripts && echo "done" fi fi if test -z "$DONT_FIX_PAMD_CONFIGS"; then configs=`ls $RPM_BUILD_ROOT/etc/pam.d/* 2> /dev/null` if [ -n "$configs" ]; then echo -n "Fixing pam.d config files..." perl -pi -e "s,/(lib|lib64)/security/,," $configs echo "done" fi fi dir=$RPM_BUILD_ROOT/usr/share/info/dir if test -z "$DONT_REMOVE_INFO_DIR" -a -f $dir -a ! -L $dir; then echo -n "Removing info dir..." && rm -f $dir && echo done fi if test -z "$DONT_FIX_MO" -a -n "$(ls $RPM_BUILD_ROOT/usr/share/locale/ko/LC_MESSAGES/*.mo 2> /dev/null)"; then echo -n "Fixing translations..." && fix-mo && echo done fi if test -z "$DONT_TRANSLATE_MENU" -a -d $RPM_BUILD_ROOT/usr/lib/menu; then echo "Translating menus:" && translate_menu.pl $RPM_BUILD_ROOT/usr/lib/menu/* && echo done fi exit 0 # spec-helper ends here