From 2372c42adf99ba8ad080b05f3e743d6829ad640d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9C=BC=E7=9D=9B=E6=83=B3=E6=97=85=E8=A1=8C?= Date: Fri, 30 May 2025 07:50:31 +0000 Subject: [PATCH] =?UTF-8?q?update=20src/usr/bin/packdeb.=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=A6=82=E6=9E=9C=E6=9D=83=E9=99=90=E4=B8=8D=E6=98=AF?= =?UTF-8?q?755=E5=AF=BC=E8=87=B4=E6=89=93=E5=8C=85=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 眼睛想旅行 --- src/usr/bin/packdeb | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/usr/bin/packdeb b/src/usr/bin/packdeb index cdf8c71..e47343c 100755 --- a/src/usr/bin/packdeb +++ b/src/usr/bin/packdeb @@ -12,6 +12,32 @@ else opt=`pwd` fi notify-send `basename $opt`开始打包 -i /usr/share/icons/uos-packaging-tools.png + +echo "正在检查权限: $opt" +# 增强权限检查逻辑 +non_755_files=$(find "$opt" -type f -not -perm 755 -o -type d -not -perm 755 2>/dev/null | wc -l) +if [ $non_755_files -gt 0 ]; then + echo "发现$non_755_files个文件/目录权限不是755,正在修改..." + if sudo chmod 755 -R "$opt" 2>/tmp/chmod_error.log; then + echo "权限修改成功" + else + error_msg=$(head -n 1 /tmp/chmod_error.log 2>/dev/null || echo "未知错误") + notify-send "权限修改失败: $error_msg" -i /usr/share/icons/uos-packaging-tools.png + # 尝试使用pkexec作为备用方案 + if command -v pkexec >/dev/null 2>&1; then + if pkexec chmod 755 -R "$opt"; then + echo "使用pkexec修改权限成功" + else + exit 1 + fi + else + exit 1 + fi + fi +else + echo "所有文件权限已经是755,无需修改" +fi + fakeroot dpkg-deb -Z xz -b $opt $opt/.. notify-send `basename $opt`打包完成 -i /usr/share/icons/uos-packaging-tools.png exit