#!/bin/bash Import GoboLinux function Install_Unmanaged_Files() { Parameters "$@" unmanagedfilesfile sourcedir local kernelversion="`readlink $goboModules/Current 2> /dev/null`" [ ! "$kernelversion" ] && kernelversion="$(uname -r)" if [ -f "$unmanagedfilesfile" ] then grep -E -v "^(\./|/|)Programs" "$unmanagedfilesfile" | while read line do local dname=$(dirname "${goboPrefix}/$line") mkdir -p "${dname}" Quiet cp -a "${sourcedir}/${line}" "${dname}/" done if grep -q "${goboModules}" "$unmanagedfilesfile" then Log_Normal "Calculating kernel module dependencies..." depmod -ae ${kernelversion} fi fi } function Uninstall_Unmanaged_Files() { Parameters "$@" unmanagedfilesfile interactive local kernelversion="`readlink $goboModules/Current 2> /dev/null`" [ ! "$kernelversion" ] && kernelversion="$(uname -r)" if [ -f "${unmanagedfilesfile}" ] then for line in $(grep -E -v "^(\./|/|)Programs" "$unmanagedfilesfile") do local dname=$(dirname "${goboPrefix}$line") if [ -n "${interactive}" ] then if Ask "Remove ${goboPrefix}${line}?" then rm -fr "${goboPrefix}${line}" else continue fi elif [ -d "${goboPrefix}${line}" ] then Log_Verbose "${goboPrefix}${line}" rmdir "${goboPrefix}${line}" 2>/dev/null || echo "${goboPrefix}${line}" else Log_Verbose "${goboPrefix}${line}" rm -f "${goboPrefix}${line}" fi Quiet rmdir "${dname}" done if grep -q "${goboModules}" "$unmanagedfilesfile" then Log_Normal "Calculating kernel module dependencies..." depmod -ae ${kernelversion} fi fi } function Rebuild_GDK_Pixbuf_Loaders() { if Executable_Exists_In_Path "gdk-pixbuf-query-loaders" then loadersfile="${goboSettings}/gtk-2.0/gdk-pixbuf.loaders" gdk-pixbuf-query-loaders | $sudo_exec dd of=${loadersfile} 2> /dev/null fi } function Rebuild_MIME_Database() { if Executable_Exists_In_Path "update-mime-database" then mimedirectory="${goboVariable}/lib/xdg/mime" if ! $sudo_exec mkdir -p ${mimedirectory} && ! $sudo_exec test -w ${mimedirectory} then [ -n "${XDG_DATA_HOME}" ] && mimedirectory="${XDG_DATA_HOME}/mime" || mimedirectory="$HOME/.local/share/mime" fi Assert_Dir ${mimedirectory} Is_Directory ${mimedirectory}/packages || $sudo_exec ln -s ${goboShared}/mime/packages ${mimedirectory} Log_Normal "Rebuilding MIME database..." $sudo_exec update-mime-database ${mimedirectory} &>/dev/null fi } function Rebuild_Desktop_Database() { if Executable_Exists_In_Path "update-desktop-database" then desktopdirectory="${goboVariable}/lib/xdg" if ! $sudo_exec mkdir -p $desktopdirectory && ! $sudo_exec test -w ${desktopdirectory} then [ -n "${XGD_DATA_HOME}" ] && desktopdirectory="${XDG_DATA_HOME}" || desktopdirectory="$HOME/.local/share" fi Assert_Dir ${desktopdirectory} Is_Directory ${desktopdirectory}/applications || ln -s ${goboShared}/applications ${desktopdirectory} Log_Normal "Rebuilding desktop database..." update-desktop-database ${desktopdirectory} fi } function Rebuild_Font_Cache() { if Executable_Exists_In_Path "fc-cache" then Log_Normal "Updating font cache..." fc-cache fi } function Add_To_XML_Catalog() { target="${1}" xmldatafile="${target}/Resources/XmlCatalogData" if Executable_Exists_In_Path "xmlcatalog" then while read data do type="$(echo ${data} | cut -d';' -f1)" orig="$(echo ${data} | cut -d';' -f2)" eval repl="$(echo ${data} | cut -d';' -f3)" eval catalog="$(echo ${data} | cut -d';' -f4)" [ -f "${catalog}" ] || { Assert_Dir $(dirname "${catalog}"); xmlcatalog --noout --create "${catalog}"; } xmlcatalog --noout --add ${type} "${orig}" "${repl}" "${catalog}" done < "${xmldatafile}" fi } function Update_Scrollkeeper_Database() { if Executable_Exists_In_Path "scrollkeeper-update" then Log_Normal "Updating scrollkeeper catalog..." scrollkeeper-update -q &>/dev/null fi } function Remove_From_XML_Catalog() { target="${1}" xmldatafile="${target}/Resources/XmlCatalogData" if Executable_Exists_In_Path "xmlcatalog" then while read data do orig="$(echo ${data} | cut -d';' -f2)" eval catalog="$(echo ${data} | cut -d';' -f4)" [ -f "${catalog}" ] && xmlcatalog --noout --del "${orig}" "${catalog}" done < "${xmldatafile}" fi } function Uninstall_GConf_Schemas() { Parameters "$@" application_name if Executable_Exists_In_Path "gconftool-2" then export GCONF_CONFIG_SOURCE=$(gconftool-2 --get-default-source) gconftool-2 --makefile-uninstall-rule ${goboPrograms}/${application_name}/Settings/gconf/schemas/*.schemas >/dev/null killall -HUP gconfd-2 &> /dev/null fi } function Install_GConf_Schemas() { Parameters "$@" application_name if Executable_Exists_In_Path "gconftool-2" then export GCONF_CONFIG_SOURCE=$(gconftool-2 --get-default-source) gconftool-2 --makefile-install-rule ${goboPrograms}/${application_name}/Settings/gconf/schemas/*.schemas >/dev/null killall -HUP gconfd-2 &> /dev/null fi }