Blob Blame History Raw
#!/bin/sh

###############################################
# Set WenQuanYi Zen Hei Default Display Styles
# 
# Qianqian Fang <fangq at nmr.mgh.harvard.edu>
###############################################

FAVAIL=/usr/share/fontconfig/conf.avail
FCONF=/etc/fonts/conf.d
BMPCONF=65-0-wqy-zenhei-sharp.conf
AACONF=65-0-wqy-zenhei.conf

if [ $UID -ne 0 ]; then
    echo 1>&2 Please run $0 as root user.
    exit 2
fi

if [ $# -ne 1 ]; then
     echo 1>&2 Usage: $0 \[aa\|bitmap\|bitmapfull\]
     exit 2
fi

if [ $1 = "aa" -o $1 = "bitmap" -o $1 = "bitmapfull" ]; then
    if [ $1 == "aa" ]; then
	    if [ -f "$FAVAIL/$AACONF" ]; then
		    ln -sf $FAVAIL/$AACONF $FCONF/$AACONF
		    rm -f $FCONF/$BMPCONF
	    else
        	echo $FAVAIL/$AACONF does not exist!
		    exit 2
	    fi
	fi

    if [ $1 = "bitmap" -o $1 = "bitmapfull" ]; then
        if [ -f "$FAVAIL/$BMPCONF" ]; then
            ln -sf $FAVAIL/$BMPCONF $FCONF/$BMPCONF
            rm -f $FCONF/$AACONF
        else
            echo $FAVAIL/$BMPCONF does not exist!
            exit 2
        fi
     fi
else
     echo $1 is not a valid option
fi

exit 0