忘记、过去
deepin
2023-06-16 17:22 postinst 等维护脚本的运行环境本来就是 root 身份
不过,用户在使用 sudo 安装 deb 包的时候,是可以在 postinst 等维护脚本里获取到当前用户名称和 uid 的,
userName=$(/usr/bin/logname)
if [ $? -ne 0 ] ; then
userName=""
fi
userId=$(/usr/bin/id -u $userName)
if [ $? -ne 0 ] ; then
userId=""
fi
可以根据上述 $userName 和 $userId 是否为空来拼接你要的路径
Reply Like 3 View the author


中文 
来问个问题,我为什么为我用deb打包之后,在postinst这个配置安装文件运行一些程序,这些程序的运行的设置跑到ROOT用户下面了,没有到我当前用户程序下面
我把一些配置在我安装时,在当前用户有效,怎么能好 ?