# This file is part of the src2pkg program: # Copyright 2005-2008 Gilbert Ashley # src2pkg is released under the GNU General Public License Version 2 ### compress_man_pages compress_man_pages() { if [[ "$FAILED" = "" ]] && [[ "$CORRECT_MANS" = "YES" ]] ; then # Movebadly placed man-pages if [[ -d $PKG_DIR/usr/share/man ]] && [[ "$CORRECT_MANS" = "YES" ]] ; then [[ -L $PKG_DIR/usr/man ]] && rm -f $PKG_DIR/usr/man ( cd $PKG_DIR/usr/share && mv man .. &> /dev/null ) rm -rf $PKG_DIR/usr/share/man echo $CYAN"NOTICE! "$NORMAL"Moving man pages installed under usr/share/man to usr/man" fi # Move badly placed info pages if [[ -d $PKG_DIR/usr/share/info ]] && [[ "$CORRECT_MANS" = "YES" ]] ; then [[ -L $PKG_DIR/usr/info ]] && rm -f $PKG_DIR/usr/info ( cd $PKG_DIR/usr/share && mv info .. &> /dev/null ) rm -rf $PKG_DIR/usr/share/info echo $CYAN"NOTICE! "$NORMAL"Moving info pages installed under usr/share/info to usr/info" fi # remove the info/dir file if present [[ -e $PKG_DIR/usr/info/dir ]] && rm -f $PKG_DIR/usr/info/dir [[ -e $PKG_DIR/usr/local/info/dir ]] && rm -f $PKG_DIR/usr/local/info/dir # remove the usr/share dir if empty if [[ $(ls $PKG_DIR/usr/share/ 2> /dev/null) = "" ]] ; then echo $BLUE"Removing empty usr/share after moving man-pages -"$NORMAL rm -rf $PKG_DIR/usr/share fi # make a more thorough check for man-pages if there still aren't any in the package if ! [[ -d $PKG_DIR/usr/man ]] && [[ "$CORRECT_MANS" = "YES" ]] ; then for mansuffix in 1 1x 3 5 8 ; do if [[ -f ${SRC_DIR}/${NAME}.${mansuffix} ]] ; then mkdir -p $PKG_DIR/usr/man/man$mansuffix cp $SRC_DIR/$NAME.$mansuffix $PKG_DIR/usr/man/man$mansuffix FOUND_MANS=1 fi if [[ -f ${SRC_DIR}/debian/${NAME}.${mansuffix} ]] ; then mkdir -p $PKG_DIR/usr/man/man$mansuffix cp $SRC_DIR/debian/$NAME.$mansuffix $PKG_DIR/usr/man/man$mansuffix FOUND_MANS=1 fi done if [[ -f $SRC_DIR/$NAME.man ]] ; then mkdir -p $PKG_DIR/usr/man/man1 cp $SRC_DIR/$NAME.man $PKG_DIR/usr/man/man1/$NAME.1 FOUND_MANS=1 fi if [[ $FOUND_MANS ]] ; then echo $CYAN"NOTICE - "$NORMAL"No man-pages installed by $MAKEFILE" echo $BLUE"Found man-pages in SRC_DIR -"$NORMAL" Installing in PKG_DIR." fi fi [[ $SAVE_SPACE -gt 0 ]] && MAN_COMPRESS="bzip2" cd $PKG_DIR ; # decompress any existing zipped man-pages, make non-executable and re-compress find . -path './*/man*/*' -name '*.gz' -a -type f | xargs -r gunzip &> /dev/null find . -path './*/local/man*/*' -name '*.gz' -a -type f | xargs -r gunzip &> /dev/null find . -path './*/man*/*' -name '*.bz2' -a -type f | xargs -r bunzip2 &> /dev/null find . -path './*/local/man*/*' -name '*.bz2' -a -type f | xargs -r bunzip2 &> /dev/null find . -path './*/man*/*' -type f | xargs -r chmod 644 find . -path './*/local/man*/*' -type f | xargs -r chmod 644 find . -path './*/man*/*' -type l | xargs -r chmod 755 find . -path './*/local/man*/*' -type l | xargs -r chmod 755 # find . -path './*/man*/*' -name '*.[1-9]' | xargs -r $MAN_COMPRESS find . -path './*/man*/*' -type f | xargs -r $MAN_COMPRESS &> /dev/null && MANSCOMPRESSED=1 find . -path './*/local/man*/*' -type f | xargs -r $MAN_COMPRESS &> /dev/null && MANSCOMPRESSED=1 # do the same for info pages find . -path './usr/info/*' -name '*.gz' -a -type f | xargs -r gunzip &> /dev/null find . -path './usr/local/info/*' -name '*.gz' -a -type f | xargs -r gunzip &> /dev/null find . -path './usr/info/*' -name '*.bz2' -a -type f | xargs -r bunzip2 &> /dev/null find . -path './usr/local/info/*' -name '*.bz2' -a -type f | xargs -r bunzip2 &> /dev/null find . -path './usr/info/*' -type f | xargs -r chmod 644 find . -path './usr/local/info/*' -type f | xargs -r chmod 644 find . -path './usr/info/*' -type l | xargs -r chmod 755 find . -path './usr/local/info/*' -type l | xargs -r chmod 755 # find . -path './usr/info/*' -name '*.info' -o -name '*.info-[0-9]' -o -name '*.info-[0-9][0-9]' | xargs -r $MAN_COMPRESS find . -path './*/info/*' -type f | xargs -r $MAN_COMPRESS &> /dev/null && INFOSCOMPRESSED=1 find . -path './*/local/info/*' -type f | xargs -r $MAN_COMPRESS &> /dev/null && INFOSCOMPRESSED=1 if [[ $(find . -path './*/man*/*' -name '*.*') != "" ]] ; then echo $BLUE"Compressing man pages - "$GREEN"Done"$NORMAL fi if [[ $(find . -path './*/info/*' -name '*.*') != "" ]] ; then echo $BLUE"Compressing info pages - "$GREEN"Done"$NORMAL fi # check directory perms if [[ -d $PKG_DIR/usr/man ]] ; then chmod 755 $PKG_DIR/usr/man ( cd $PKG_DIR/usr/man && find -type d | xargs -r chmod 755 ) fi # check directory perms [[ -d $PKG_DIR/usr/info ]] && chmod 755 $PKG_DIR/usr/man fi }