Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Education
geogebra
install-geogebra-icons-oxygen
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File install-geogebra-icons-oxygen of Package geogebra
#!/bin/bash #--------------------------------------------- # Script to install GeoGebra application icons for Oxygen Icon Theme # # @author Christian Schött <schoett@gmx.de> #--------------------------------------------- #--------------------------------------------- # Used environment variables: # # NAME=<name of geogebra start script> # If unset, 'geogebra' will be used. (Example: 'geogebra5-beta') # # INSTALL=<path of install macro> # If unset, './install-sh' will be used. (Distributors may want to set their own install macro.) # # CHMOD=<path of chmod macro> # If unset, 'chmod' will be used. (Distributors may want to set their own chmod macro.) # # BINDIR=<path for executable binary files> # If unset, 'usr/bin' will be used. # # DATADIR=<path for data files> # If unset, '/usr/share' will be used. # # DOCDIR=<path for doc files> # If unset, '/usr/share/doc/packages' will be used. # # LICENSEDIR=<path for license files> # If unset, "$DOCDIR" will be used. # # CREATE_UNINSTALLER=<boolean> # If unset, 'false' will be used. (Distributors normally have their own uninstaller.) # # VERBOSE_MODE=<boolean> # If unset, 'false' will be used. # # PREFIX=<path> # If unset, '' will be used. #--------------------------------------------- # If $NAME not set, use 'geogebra'. if [ -z "$NAME" ]; then NAME='geogebra' fi #--------------------------------------------- # If $INSTALL not set, use './install-sh'. if [ -z "$INSTALL" ]; then INSTALL="./install-sh" fi #--------------------------------------------- # If $CHMOD not set, use 'chmod'. if [ -z "$CHMOD" ]; then CHMOD="chmod" fi #--------------------------------------------- # If $BINDIR not set, use '/usr/bin'. if [ -z "$BINDIR" ]; then BINDIR="/usr/bin" fi #--------------------------------------------- # If $DATADIR not set, use '/usr/share'. if [ -z "$DATADIR" ]; then DATADIR="/usr/share" fi #--------------------------------------------- # If $LICENSEDIR not set, but $DOCDIR set, use "$DOCDIR". if [ -z "$LICENSEDIR" -a -n "$DOCDIR" ]; then LICENSEDIR="$DOCDIR" fi #--------------------------------------------- # If $DOCDIR not set, use '/usr/share/doc/packages'. if [ -z "$DOCDIR" ]; then DOCDIR='/usr/share/doc/packages' fi #--------------------------------------------- # If $LICENSEDIR not set, use "$DOCDIR". if [ -z "$LICENSEDIR" ]; then LICENSEDIR="$DOCDIR" fi #--------------------------------------------- # If $CREATE_UNINSTALLER not set, use 'false'. if [ -z "$CREATE_UNINSTALLER" ]; then CREATE_UNINSTALLER='false' fi #--------------------------------------------- # If $VERBOSE_MODE not set, use 'false'. if [ -z "$VERBOSE_MODE" ]; then VERBOSE_MODE='false' fi #--------------------------------------------- # If $PREFIX not set, use ''. if [ -z "$PREFIX" ]; then PREFIX='' fi #--------------------------------------------- # Define usage function. function func_usage { cat << _USAGE Usage: install-geogebra-icons-oxygen [Options] Install GeoGebra application icons for Oxygen Icon Theme Options: --help Print this help message --name=<name of geogebra start script> If unset, '$NAME' will be used. (Example: 'geogebra5-beta') --install=<path of install macro> If unset, '$INSTALL' will be used. --chmod=<path of chmod macro> If unset, '$CHMOD' will be used. --bindir=<path for executable binary files> If unset, '$BINDIR' will be used. --datadir=<path for data files> If unset, '$DATADIR' will be used. --docdir=<path for doc files> If unset, '$DOCDIR' will be used. --licensedir=<path for license files> If unset, '$LICENSEDIR' will be used. --create_uninstaller=<boolean> If unset, '$CREATE_UNINSTALLER' will be used. --verbose_mode=<boolean> If unset, '$VERBOSE_MODE' will be used. --prefix=<path> If unset, '$PREFIX' will be used. _USAGE } #--------------------------------------------- # Check for options. for i in "$@"; do case "$i" in --help | --hel | --he | --h ) func_usage; exit 0 ;; esac if [ $(expr match "$i" '.*--name=') -ne 0 ]; then NAME=${i:7} shift $((1)) elif [ $(expr match "$i" '.*--install=') -ne 0 ]; then INSTALL=${i:10} shift $((1)) elif [ $(expr match "$i" '.*--chmod=') -ne 0 ]; then CHMOD=${i:8} shift $((1)) elif [ $(expr match "$i" '.*--bindir=') -ne 0 ]; then BINDIR=${i:9} shift $((1)) elif [ $(expr match "$i" '.*--datadir=') -ne 0 ]; then DATADIR=${i:10} shift $((1)) elif [ $(expr match "$i" '.*--docdir=') -ne 0 ]; then DOCDIR=${i:9} shift $((1)) elif [ $(expr match "$i" '.*--licensedir=') -ne 0 ]; then LICENSEDIR=${i:13} shift $((1)) elif [ $(expr match "$i" '.*--create_uninstaller=') -ne 0 ]; then CREATE_UNINSTALLER=${i:21} shift $((1)) elif [ $(expr match "$i" '.*--verbose_mode=') -ne 0 ]; then VERBOSE_MODE=${i:15} shift $((1)) elif [ $(expr match "$i" '.*--prefix=') -ne 0 ]; then PREFIX=${i:9} shift $((1)) fi done #--------------------------------------------- # Install everything. INSTALLED_DIRECTORIES=() INSTALLED_FILES=() function install_dir { if [ ! -w "$PREFIX$1" ]; then "$INSTALL" -d -m 755 "$PREFIX$1" fi INSTALLED_DIRECTORIES[${#INSTALLED_DIRECTORIES[*]}]="$1" } function install_file { if [ -d "$PREFIX$2" ]; then "$INSTALL" -m 644 "$1" "$PREFIX$2" INSTALLED_FILES[${#INSTALLED_FILES[*]}]="$2/`basename $1`" else "$INSTALL" -m 644 "$1" "$PREFIX$2" INSTALLED_FILES[${#INSTALLED_FILES[*]}]="$2" fi } install_dir "$LICENSEDIR" install_dir "$LICENSEDIR/$NAME-icons-oxygen" install_file 'icons/oxygen/COPYING' "$LICENSEDIR/$NAME-icons-oxygen" install_dir "$DOCDIR" install_dir "$DOCDIR/$NAME-icons-oxygen" install_file 'icons/oxygen/README' "$DOCDIR/$NAME-icons-oxygen" install_dir "$DATADIR" install_dir "$DATADIR/icons" install_dir "$DATADIR/icons/oxygen" for SIZE in 16x16 22x22 32x32 48x48 64x64 128x128 256x256; do install_dir "$DATADIR/icons/oxygen/$SIZE" install_dir "$DATADIR/icons/oxygen/$SIZE/apps" install_file "icons/oxygen/$SIZE/apps/geogebra.png" "$DATADIR/icons/oxygen/$SIZE/apps/$NAME.png" done # Create uninstall script, if $CREATE_UNINSTALLER is not set 'false': if [ "$CREATE_UNINSTALLER" != 'false' ]; then install_dir "$BINDIR" cat > "$PREFIX$BINDIR/uninstall-$NAME-icons-oxygen" << EOF #!/bin/bash #--------------------------------------------- # Script to uninstall GeoGebra application icons for Oxygen Icon Theme #--------------------------------------------- # Define usage function: function func_usage { cat << _USAGE Usage: uninstall-$NAME-icons-oxygen [Options] Uninstall GeoGebra application icons for Oxygen Icon Theme Options: --help Print this help message --force Uninstall without asking questions _USAGE } # Check for options: FORCE='false' for i in "\$@"; do case "\$i" in --help | --hel | --he | --h ) func_usage; exit 0 ;; esac if [ "\$i" = '--force' ]; then FORCE='true' fi done # Ask to continue, if option --force is not used: if [ "\$FORCE" = 'false' ]; then KDIALOG_possible='false' QDBUS_possible='false' ZENITY_possible='false' XDIALOG_possible='false' if [ "\$UID" != "0" ]; then KDIALOG_possible='true' QDBUS_possible='false' ZENITY_possible='false' XDIALOG_possible='false' type -P kdialog &>/dev/null || KDIALOG_possible='false' if [ "\$KDIALOG_possible" = 'true' ]; then QDBUS_possible='true' type -P qdbus &>/dev/null || QDBUS_possible='false' else ZENITY_possible='true' type -P zenity &>/dev/null || ZENITY_possible='false' if [ "\$ZENITY_possible" = 'false' ]; then XDIALOG_possible='true' type -P Xdialog &>/dev/null || XDIALOG_possible='false' fi fi fi ANSWER=1 if [ "\$KDIALOG_possible" = 'true' ]; then kdialog --caption "GeoGebra application icons for Oxygen Icon Theme" --icon "$DATADIR/icons/hicolor/64x64/apps/$NAME.png" --warningcontinuecancel "This will uninstall GeoGebra application icons for Oxygen Icon Theme." ANSWER=\$? elif [ "\$ZENITY_possible" = 'true' ]; then zenity --title="GeoGebra application icons for Oxygen Icon Theme" --window-icon="$DATADIR/icons/hicolor/64x64/apps/$NAME.png" --warning --text="This will uninstall GeoGebra application icons for Oxygen Icon Theme." ANSWER=\$? elif [ "\$XDIALOG_possible" = 'true' ]; then Xdialog --title "GeoGebra application icons for Oxygen Icon Theme" --yesno "This will uninstall GeoGebra application icons for Oxygen Icon Theme.\n\nDo you want to continue?" 0 0 ANSWER=\$? else echo "This will uninstall GeoGebra application icons for Oxygen Icon Theme." tput bold read -p "Do you want to continue? [y/n]: " tput sgr0 case "\$REPLY" in y | Y | yes | Yes | YES ) ANSWER=0 ;; esac fi if [ \$ANSWER != 0 ]; then exit 0 fi fi # Uninstall files and show progressbar during uninstallation, if possible and option --force is not used: if [ "\$KDIALOG_possible" = 'true' -a "\$QDBUS_possible" = 'true' -a "\$FORCE" = 'false' ]; then DBUSREF=\`kdialog --caption "GeoGebra application icons for Oxygen Icon Theme" --progressbar "Uninstalling GeoGebra application icons for Oxygen Icon Theme." 1\` fi INSTALLED_FILES=(${INSTALLED_FILES[*]}) for ((i=\${#INSTALLED_FILES[@]}-1; i>=0; i--)); do if [ -w "\${INSTALLED_FILES[\$i]}" ]; then rm -f "\${INSTALLED_FILES[\$i]}" fi done INSTALLED_DIRECTORIES=(${INSTALLED_DIRECTORIES[*]}) for ((i=\${#INSTALLED_DIRECTORIES[@]}-1; i>=0; i--)); do case "\${INSTALLED_DIRECTORIES[\$i]}" in "$BINDIR" | "$DATADIR" | "$DOCDIR" | "$LICENSEDIR" ) continue ;; esac if [ -w "\${INSTALLED_DIRECTORIES[\$i]}" ]; then rmdir --ignore-fail-on-non-empty "\${INSTALLED_DIRECTORIES[\$i]}" fi done if [ "\$KDIALOG_possible" = 'true' -a "\$QDBUS_possible" = 'true' -a "\$FORCE" = 'false' ]; then qdbus \$DBUSREF Set "" value 1 >/dev/null qdbus \$DBUSREF setLabelText "Uninstallation completed." >/dev/null qdbus \$DBUSREF close >/dev/null fi # Selfdestruction: if [ -w "$BINDIR/uninstall-$NAME-icons-oxygen" ]; then rm -f "$BINDIR/uninstall-$NAME-icons-oxygen" fi EOF INSTALLED_FILES[${#INSTALLED_FILES[*]}]="$BINDIR/uninstall-$NAME-icons-oxygen" "$CHMOD" u+x "$PREFIX$BINDIR/uninstall-$NAME-icons-oxygen" fi # List pathes of installed files, if $VERBOSE_MODE is not set 'false': if [ "$VERBOSE_MODE" != 'false' ]; then echo "`tput smul`Files of package '$NAME-icons-oxygen'`tput sgr0`" for FILEPATH in ${INSTALLED_FILES[*]}; do if [ -e "$PREFIX$FILEPATH" ]; then echo "$FILEPATH" fi done fi
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor