您尚未登录。

#1 2012-08-31 22:36:35

roadgo
会员
注册时间: 2012-04-07
帖子: 380

google-earth字体不对,还没有图像

PKGBUILD

pkgname=google-earth
pkgver=201209
_pkgver=stable_current
pkgrel=1
pkgdesc="Get the world’s geographic information at your fingertips."
arch=('i686' 'x86_64')
license=("Custom")
url="http://www.google.com/earth/index.html"
depends=()
#makedepdends=('deb2targz' 'tar')
source=("${pkgname}_${_pkgver}_amd64.deb")
sha1sums=('fa1f410eaf94a14c8e47594dc0618b0bf7cfb8bb')
install=${pkgname}.install 

if [ "${CARCH}" = 'x86_64' ]; then
  depends=()
else	
  depends=()
fi

package()
{
    cd "${srcdir}"
   
    tar -axf data.tar.lzma  -C "${pkgdir}"
}

google-earth.install

#!/bin/bash

ksv_xdg_dirs=${XDG_DATA_DIRS:-/usr/share}
ksv_xdg_dir=
ksv_def_icon_theme=icons/hicolor

ksv_kml_mimes=('application-vnd.google-earth.kml+xml' 'product_logo_32.png' )
ksv_kmz_mimes=('application-vnd.google-earth.kmz' 'product_logo_32.png'  )

function ks_install_icon()
{
	local context=$1
	shift
	local mode=$1
	shift

	local png=
	local mime=
	local nextIsPng=0
	for item in $@
	do
		if [ "" = "${item}" ] ; then
			continue
		fi
		if [ ${nextIsPng} -eq 1 ] ; then
			png=${item}
			for i in 48 32 22 16; do
				if [ -e "${ksv_xdg_dir}/${ksv_def_icon_theme}/${i}x${i}/${context}/${png}" ] ; then
					xdg-icon-resource install --noupdate --mode ${mode} --context ${context} --size ${i} "${ksv_xdg_dir}/${ksv_def_icon_theme}/${i}x${i}/${context}/${png}" ${mime}
				fi
			done
			nextIsPng=0
		else
			mime=${item}
			nextIsPng=1
		fi
	done
}

function ks_config_default_mime_open()
{
	local desktop=$1
	shift

	local png=
	local mime=
	local nextIsPng=0
	for item in $@
	do
		if [ "" = "${item}" ] ; then
			continue
		fi
		if [ ${nextIsPng} -eq 1 ] ; then
			png=${item}
			nextIsPng=0
		else
			mime=${item/application-/application/}
			nextIsPng=1
		fi
	done
}

function ks_init()
{
	set -e
	for i in `echo "${ksv_xdg_dirs}" | sed 's/:/ /g'`
	do
		if [ -w ${i}/${ksv_def_icon_theme} ] ; then
			ksv_xdg_dir="${i}"
		fi
	done
}

function ks_config_menu()
{
	
	if [ -f "${ksv_xdg_dir}/applications/google-earth.desktop" ] ; then
		xdg-mime install --novendor --mode system "${ksv_xdg_dir}/mime/packages/google-earth.xml"

		xdg-desktop-menu install --noupdate --novendor --mode system "${ksv_xdg_dir}/applications/google-earth.desktop"
		
		xdg-desktop-menu forceupdate --mode system

		ks_install_icon "mimetypes" "system" "${ksv_kml_mimes[*]}" "${ksv_kmz_mimes[*]}"
		xdg-icon-resource forceupdate --mode system

		ks_config_default_mime_open "${ksv_xdg_dir}/applications/google-earth.desktop" "${ksv_kml_mimes[*]}" "${ksv_kmz_mimes[*]}"
	fi
}


function ks_config()
{
	ks_config_menu	
	
}

function ks_remove()
{
	if [ -e /etc/xdg/menus/applications-merged/google-earth.menu ] ; then
		rm -rf /etc/xdg/menus/applications-merged/google-earth.menu
	fi

	if [ -x /usr/bin/update-mime-database ] ; then
		update-mime-database "${ksv_xdg_dir}/mime"
	fi

	if [ -x /usr/bin/update-desktop-database ] ; then
		update-desktop-database -q "${ksv_xdg_dir}/applications"
	fi

}

function ks_purge()
{
	if [ -d /usr/share/fonts/wps-office ] ; then
		rm -rf /usr/share/fonts/wps-office
	fi
}
	
function ks_uninstall_icon()
{
	local context=$1
	shift
	local mode=$1
	shift

	local png=
	local mime=
	local nextIsPng=0
	for item in $@
	do
		if [ "" = "${item}" ] ; then
			continue
		fi
		if [ ${nextIsPng} -eq 1 ] ; then
			png=${item}
			nextIsPng=0
		else
			mime=${item}
			for i in 48 32 22 16; do
				if [ -e "${ksv_xdg_dir}/${ksv_def_icon_theme}/${i}x${i}/${context}/${png}" ] ; then
					xdg-icon-resource uninstall --noupdate --mode ${mode} --context ${context} --size ${i} ${mime}
				fi
			done

			nextIsPng=1
		fi
	done
}


function ks_prerm_uninstall_menu()
{

	if [ -f "${ksv_xdg_dir}/applications/google-earth.desktop" ] ; then
		xdg-mime uninstall --mode system "${ksv_xdg_dir}/mime/packages/google-earth.xml"

		#xdg-desktop-menu uninstall --noupdate --mode system "${ksv_xdg_dir}/desktop-directories/wps-office.directory" "${ksv_xdg_dir}/applications/wps-office-wps.desktop"
		xdg-desktop-menu uninstall --noupdate --mode system "${ksv_xdg_dir}/applications/google-earth.desktop"
		xdg-desktop-menu forceupdate --mode system

		ks_uninstall_icon "mimetypes" "system" "${ksv_kml_mimes[*]}" "${ksv_kmz_mimes[*]}"
		xdg-icon-resource forceupdate --mode system
	fi

}

function ks_prerm_upgrade()
{
	ks_prerm_uninstall_menu
}

function ks_prerm_remove()
{
	ks_prerm_uninstall_menu
}

function ks_main()
{
	if [ $# -eq 0 ] ; then
		return;
	fi

	ks_init
	case $1 in
		configure )
			shift
			ks_config $@
			;;
		prerm )
			shift
			ks_prerm_remove $@
			;;
		remove )
			shift
			ks_remove $@
			ks_purge $@
			;;
		upgrade )
			shift
			ks_prerm_upgrade $@
			ks_config $@
			;;
	esac
}

post_install()
{
	ks_main configure
}

post_upgrade()
{
	ks_main upgrade
}

pre_remove()
{
	ks_main prerm
}

post_remove()
{
	ks_main remove
}

最近编辑记录 roadgo (2012-08-31 22:37:22)

离线

页脚