Ubuntu deb封装安装后的键盘快捷键

Ubuntu deb封装安装后的键盘快捷键,ubuntu,package,debian,deb,Ubuntu,Package,Debian,Deb,我正在制作一个简单python程序(我称之为prang)的deb包,该程序在当前鼠标指针处拾取颜色,并在文本中读取其颜色,这有利于色盲 现在,我希望在安装程序时为其指定一个键盘快捷键。我希望在deb包的postinst文件中执行此操作: #! /bin/sh set -e chmod -R a+rx /usr/share/prang gconftool-2 --set /apps/metacity/keybinding_commands/command_11 --type string "/u

我正在制作一个简单python程序(我称之为prang)的deb包,该程序在当前鼠标指针处拾取颜色,并在文本中读取其颜色,这有利于色盲

现在,我希望在安装程序时为其指定一个键盘快捷键。我希望在deb包的postinst文件中执行此操作:

#! /bin/sh

set -e
chmod -R a+rx /usr/share/prang
gconftool-2 --set /apps/metacity/keybinding_commands/command_11 --type string "/usr/bin/prang"
gconftool-2 --set /apps/metacity/global_keybindings/run_command_11 --type string "<Control><Alt>C"

exit 0
#/垃圾箱/垃圾箱
set-e
chmod-RA+rx/usr/share/prang
gconftool-2--set/apps/metacity/keybinding_commands/command_11--键入字符串“/usr/bin/prang”
gconftool-2--set/apps/metacity/global_keybindings/run_command_11--键入字符串“C”
出口0

prang本身,从终端调用时运行良好。通过gconf编辑器手动设置键盘快捷键可以正常工作。安装后在终端中运行gconftool-2命令也可以正常工作。但通过postinst来实现这一点是行不通的。我错在哪里。

postinst以
根目录运行
;您需要以某种方式为每个受影响的普通用户运行
gconf
命令,而对于公共软件包,我只会在软件包自述中记录所需的命令,但对于专用方便软件包,我想你可能会弄乱人们的密钥绑定。
chmod
看起来是多余的-一个
/usr/share
目录应该已经有足够的权限进行world read access。谢谢你的评论。干杯关于如何以用户(非root用户)身份运行postinst有什么想法吗?
sed-n'/^[^:]*:[^:]*:1000:/,$p'/etc/passwd |(IFS=:;while read user etc;do case$user in nobody)break;;以撒;su-c'gconftool-2--set/apps/metacity/keybinding_commands/command_11--type string“/usr/bin/prang”;gconftool-2——set/apps/metacity/global_keybindings/run_command_11——键入字符串“C”'“$user”;完成)
但我建议在一般情况下不要这样做;这将覆盖任何用户的任何现有“运行命令11”设置。但希望这将足以推动你朝着正确的方向(或错误的方向,视情况而定)。