!4 update src/usr/bin/packdeb.

Merge pull request !4 from 眼睛想旅行/N/A
This commit is contained in:
2025-05-30 15:04:39 +00:00
committed by Gitee

View File

@@ -12,6 +12,32 @@ else
opt=`pwd` opt=`pwd`
fi fi
notify-send `basename $opt`开始打包 -i /usr/share/icons/uos-packaging-tools.png 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/.. fakeroot dpkg-deb -Z xz -b $opt $opt/..
notify-send `basename $opt`打包完成 -i /usr/share/icons/uos-packaging-tools.png notify-send `basename $opt`打包完成 -i /usr/share/icons/uos-packaging-tools.png
exit exit