#!/bin/bash source /etc/init.d/functions.sh TYPE="check" usage() { CMD=$(basename build-compiz-fusion) echo "${CMD} - tool to install compiz-fusion from xeffects overlay" echo "" echo "usage: ${CMD} " echo "" echo "options are:" echo " -u --upgrade" upgrade existing compiz-fusion echo " -i --install" install compiz fusion echo " -s --stage n stage number to start when upgrade" echo " 1 = core, 2 = core plugins," echo " 3 = metapackage, 4 = extra plugins" echo " -1 --one upgrade single stage only" echo "" } if [ -z "${1}" ]; then usage exit 1 fi while [ -n "${1}" ]; do case "${1}" in -u|--upgrade) TYPE="upgrade" ;; -i|--install) TYPE="install" ;; -s|--stage) shift STAGE="${1}" ;; -1|--one) ONESTAGE=1 ;; -h|--help) usage exit 0 ;; *) usage exit 1 ;; esac shift done if [ "${TYPE}" == "upgrade" ]; then if [ -z "${STAGE}" ]; then STAGE=1 fi # STAGE 1 CORE if [ "${STAGE}" -lt 2 ]; then einfo "Stage 1: Building compiz-fusion core and dependencies" if eselect opengl show | grep -q 'nvidia'; then OPENGL_SET="nvidia" eselect opengl set xorg-x11 fi if eselect opengl show | grep -q 'ati'; then OPENGL_SET="ati" eselect opengl set xorg-x11 fi CONFIG_BACKEND="" if emerge -pvo compiz-fusion | grep compiz-fusion | grep -q 'gnome'; then CONFIG_BACKEND="${CONFIG_BACKEND} compizconfig-backend-gconf" elif emerge -pvo compiz-fusion | grep compiz-fusion | grep -q 'kde'; then CONFIG_BACKEND="${CONFIG_BACKEND} compizconfig-backend-kconfig" fi emerge -av1 \ compiz \ compiz-bcop \ emerald \ libcompizconfig \ ${CONFIG_BACKEND} \ compizconfig-python \ ccsm \ || exit 1 if [ -n "${OPENGL_SET}" ]; then eselect opengl set ${OPENGL_SET} fi fi [ "${ONESTAGE}" = "1" ] && exit 0 # STAGE 2 PLUGINS if [ "${STAGE}" -lt 3 ]; then einfo "Stage 2: Building core plugins and themes" emerge -av1 \ emerald-themes \ compiz-fusion-plugins-main \ compiz-fusion-plugins-extra \ || exit 1 fi [ "${ONESTAGE}" = "1" ] && exit 0 # STAGE 3 META if [ "${STAGE}" -lt 4 ]; then einfo "Stage 3: Building compiz-fusion meta" emerge -av \ compiz-fusion \ || exit 1 fi [ "${ONESTAGE}" = "1" ] && exit 0 # STAGE 4 EXTRA if [ "${STAGE}" -lt 5 ]; then einfo "Stage 4: Building compiz-fusion extra plugins and apps" emerge -av \ fusion-icon \ compiz-fusion-plugins-atlantis \ compiz-fusion-plugins-threed \ compiz-fusion-plugins-unsupported \ compiz-fusion-plugins-wallpaper \ || exit 1 fi exit 0 elif [ "${TYPE}" == "install" ]; then eval "$(emerge --info | grep 'ACCEPT_KEYWORDS')" eval "$(emerge --info | grep 'PORTDIR')" if [ -z "${ACCEPT_KEYWORDS}" ]; then eerror "Cannot determine \$ACCEPT_KEYWORDS" exit 1 else einfo "ACCEPT_KEYWORDS=\"${ACCEPT_KEYWORDS}\"" fi if [ -z "${PORTDIR}" ]; then eerror "Cannot determine \$PORTDIR" exit 1 else einfo "PORTDIR=\"${PORTDIR}\"" fi einfo "Installing layman" emerge -av app-portage/layman einfo "Add make.conf layman overlay" echo "source ${PORTDIR}/local/layman/make.conf" >> /etc/make.conf einfo "Add gentoo-xeffects overlay" layman -a xeffects einfo "Installing flagedit" emerge -av app-portage/flagedit einfo "Updating package.use and package.keywords" flagedit x11-base/xorg-server +dri -- ~${ACCEPT_KEYWORDS} flagedit x11-base/xgl -- ~${ACCEPT_KEYWORDS} flagedit x11-drivers/nvidia-drivers -- ~${ACCEPT_KEYWORDS} flagedit x11-drivers/ati-drivers -- ~${ACCEPT_KEYWORDS} flagedit x11-wm/metacity -- ~${ACCEPT_KEYWORDS} flagedit dev-cpp/libsexymm -- ~${ACCEPT_KEYWORDS} flagedit x11-libs/libX11 -- ~${ACCEPT_KEYWORDS} flagedit x11-libs/cairo +glitz +newspr +svg -- ~${ACCEPT_KEYWORDS} flagedit x11-libs/libXft +newspr -- ~${ACCEPT_KEYWORDS} flagedit media-libs/mesa +motif -- ~${ACCEPT_KEYWORDS} flagedit x11-wm/compiz +svg -- '**' flagedit x11-libs/compiz-bcop -- '**' flagedit x11-wm/emerald -- '**' flagedit x11-libs/libcompizconfig -- '**' flagedit x11-libs/compizconfig-backend-gconf -- '**' flagedit x11-libs/compizconfig-backend-kconfig -- '**' flagedit dev-python/compizconfig-python -- '**' flagedit x11-apps/ccsm -- '**' flagedit x11-themes/emerald-themes -- '**' flagedit x11-plugins/compiz-fusion-plugins-extra -- '**' flagedit x11-plugins/compiz-fusion-plugins-main -- '**' flagedit x11-wm/compiz-fusion -- '**' flagedit x11-apps/fusion-icon -- '**' flagedit x11-plugins/compiz-fusion-plugins-atlantis -- '**' flagedit x11-plugins/compiz-fusion-plugins-threed -- '**' flagedit x11-plugins/compiz-fusion-plugins-unsupported -- '**' flagedit x11-plugins/compiz-fusion-plugins-wallpaper -- '**' if eselect opengl show | grep -q 'nvidia'; then einfo "Temporary change opengl lib to xorg-x11" OPENGL_SET="nvidia" eselect opengl set xorg-x11 fi if eselect opengl show | grep -q 'ati'; then einfo "Temporary change opengl lib to xorg-x11" OPENGL_SET="ati" eselect opengl set xorg-x11 fi einfo "Emerge compiz-fusion base and other packages with new USE flag" emerge -av --deep --newuse compiz-fusion if [ -n "${OPENGL_SET}" ]; then einfo "Restoring opengl setting" eselect opengl set ${OPENGL_SET} fi einfo "Emerge compiz-fusion extra plugins and apps" emerge -av fusion-icon compiz-fusion-plugins-atlantis compiz-fusion-plugins-threed compiz-fusion-plugins-unsupported compiz-fusion-plugins-wallpaper einfo "Setup compiz-manager executable" wget -O /usr/local/bin/compiz-manager 'http://gitweb.opencompositing.org/?p=users/kristian/compiz-scripts;a=blob_plain;f=manager/compiz-manager;hb=HEAD' chmod +x /usr/local/bin/compiz-manager einfo "Setup start-compiz-manager executable" echo '#!/bin/bash' > /usr/local/bin/start-compiz-manager echo 'LD_LIBRARY_PATH=/usr/lib/opengl/xorg-x11/lib /usr/local/bin/compiz-manager' >> /usr/local/bin/start-compiz-manager chmod +x /usr/local/bin/start-compiz-manager einfo "Install complete" echo "" ewarn "Please see http://gentoo-wiki.com/HOWTO_compiz-fusion" ewarn "and http://http://wiki.gentoo-xeffects.org/Main_Page" ewarn "How to start compiz-fusion and setup XGL/AIGLX" ewarn "For information how to setup AIGLX or XGL, Please see" ewarn " http://gentoo-wiki.com/HOWTO_AIGLX" ewarn " http://wiki.gentoo-xeffects.org/AIGLX" ewarn " http://gentoo-wiki.com/HOWTO_XGL" ewarn " http://wiki.gentoo-xeffects.org/XGL" ewarn "Nvidia Users please also see" ewarn " http://gentoo-wiki.com/HOWTO_nVidia_GL_Desktop_Effects" ewarn "" ewarn "To start compiz-fusion, run commmand 'compiz-manager'" ewarn "inside X but please read wiki at link above before" ewarn "" ewarn "Your may need to use 'start-compiz-manager' instead of" ewarn "compiz-manager, it contains some fixupds to for " ewarn "white/black screen bug or you may use command " ewarn "LD_LIBRARY_PATH=/usr/lib/opengl/xorg-x11/lib compiz-manager" echo "" einfo "Later for update use '${0} --upgrade' for update compiz-fusion" einfo "emerge -u compiz-fusion won't work" fi