mirror of
https://gitee.com/amber-ce/amber-pm
synced 2026-06-22 06:03:55 +08:00
Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 52df319e64 | |||
| 84bfc4a1e8 | |||
| 8c8bd26e91 | |||
| 0458b348ab | |||
| d8b37c3f82 | |||
| e0cdb03f49 | |||
| c6d7bbaf21 | |||
| 7a6be8244f | |||
| 0611165355 | |||
| bdd5ced484 | |||
| 2ac48801ce | |||
| d4bb5239ba | |||
| e0f691f35f | |||
| bdc123ba6f | |||
| e95adb8263 | |||
| 8e50f721f1 | |||
| e5933373d7 | |||
| e1070820ee | |||
| cc3e3c9c12 | |||
| 4d7aa499f0 | |||
| 8ad48ab51a | |||
| da00f49a2e | |||
| c71679a23d | |||
| c0494c640b | |||
| b7c9797ef1 | |||
| 844eed8a3d | |||
| c69ab42228 |
@@ -1,5 +1,5 @@
|
|||||||
Package: apm
|
Package: apm
|
||||||
Version: 1.1.2
|
Version: 1.1.3
|
||||||
Maintainer: shenmo <jifengshenmo@outlook.com>
|
Maintainer: shenmo <jifengshenmo@outlook.com>
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: utils
|
Section: utils
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
enumAppInfoList() {
|
enumAppInfoList() {
|
||||||
appInfoList=()
|
appInfoList=()
|
||||||
apps="/var/lib/apm"
|
apps="/var/lib/apm"
|
||||||
@@ -13,6 +9,7 @@ enumAppInfoList() {
|
|||||||
done
|
done
|
||||||
echo "${appInfoList[@]}"
|
echo "${appInfoList[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
linkDir() {
|
linkDir() {
|
||||||
ensureTargetDir() {
|
ensureTargetDir() {
|
||||||
targetFile=$1
|
targetFile=$1
|
||||||
@@ -26,17 +23,14 @@ linkDir() {
|
|||||||
targetDir=$(dirname "$target")
|
targetDir=$(dirname "$target")
|
||||||
find "$source" -type f | while read sourceFile; do
|
find "$source" -type f | while read sourceFile; do
|
||||||
targetFile="$targetDir/${sourceFile#$sourceDir/}"
|
targetFile="$targetDir/${sourceFile#$sourceDir/}"
|
||||||
|
|
||||||
|
|
||||||
ensureTargetDir "$targetFile"
|
ensureTargetDir "$targetFile"
|
||||||
sourceFile=$(realpath --relative-to="$(dirname $targetFile)" "$sourceFile" )
|
sourceFile=$(realpath --relative-to="$(dirname $targetFile)" "$sourceFile" )
|
||||||
if [ ! -e "${targetFile}" ];then
|
if [ ! -e "${targetFile}" ];then
|
||||||
ln -sv "$sourceFile" "$targetFile"
|
ln -sv "$sourceFile" "$targetFile"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
linkApp() {
|
linkApp() {
|
||||||
appID=$1
|
appID=$1
|
||||||
appEntriesDir="/var/lib/apm/$appID/entries"
|
appEntriesDir="/var/lib/apm/$appID/entries"
|
||||||
@@ -53,6 +47,21 @@ linkApp() {
|
|||||||
if [ ! -d "$folder" ]; then
|
if [ ! -d "$folder" ]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# 对于 applications 目录,先为所有 .desktop 文件添加必要的字段
|
||||||
|
if [ "$folder" = "$appEntriesDir/applications" ]; then
|
||||||
|
find "$folder" -name "*.desktop" -type f | while read desktop; do
|
||||||
|
# 添加 X-APM-APPID
|
||||||
|
if ! grep -q "^X-APM-APPID=" "$desktop"; then
|
||||||
|
echo "X-APM-APPID=$appID" >> "$desktop"
|
||||||
|
fi
|
||||||
|
# 添加 X-Deepin-PreUninstall
|
||||||
|
if ! grep -q "^X-Deepin-PreUninstall=" "$desktop"; then
|
||||||
|
echo "X-Deepin-PreUninstall=amber-pm-app-uninstaller $appID" >> "$desktop"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$folder" = "$appEntriesDir/polkit" ]; then
|
if [ "$folder" = "$appEntriesDir/polkit" ]; then
|
||||||
linkDir "$folder" "/usr/share/polkit-1"
|
linkDir "$folder" "/usr/share/polkit-1"
|
||||||
elif [ "$folder" = "$appEntriesDir/fonts/conf" ]; then
|
elif [ "$folder" = "$appEntriesDir/fonts/conf" ]; then
|
||||||
@@ -64,32 +73,29 @@ linkApp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function exec_uos_package_link(){
|
function exec_uos_package_link(){
|
||||||
|
for app in $(enumAppInfoList); do
|
||||||
for app in $(enumAppInfoList); do
|
linkApp "$app" &
|
||||||
linkApp "$app" &
|
done
|
||||||
|
wait
|
||||||
done
|
|
||||||
wait
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function exec_v23_icon_link(){
|
function exec_v23_icon_link(){
|
||||||
# Fix v23 broken icon
|
# Fix v23 broken icon
|
||||||
if [ ! -d "/usr/share/icons/hicolor/scalable/apps" ];then
|
if [ ! -d "/usr/share/icons/hicolor/scalable/apps" ];then
|
||||||
mkdir -p /usr/share/icons/hicolor/scalable/apps
|
mkdir -p /usr/share/icons/hicolor/scalable/apps
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for icon_root_icon_path in $(ls /usr/share/icons/*.png /usr/share/icons/*.svg 2>/dev/null)
|
for icon_root_icon_path in $(ls /usr/share/icons/*.png /usr/share/icons/*.svg 2>/dev/null)
|
||||||
do
|
do
|
||||||
target_icon_path=/usr/share/icons/hicolor/scalable/apps/$(basename ${icon_root_icon_path})
|
target_icon_path=/usr/share/icons/hicolor/scalable/apps/$(basename ${icon_root_icon_path})
|
||||||
if [ ! -e ${target_icon_path} ];then
|
if [ ! -e ${target_icon_path} ];then
|
||||||
ln -sv $(realpath --relative-to=/usr/share/icons/hicolor/scalable/apps ${icon_root_icon_path}) /usr/share/icons/hicolor/scalable/apps
|
ln -sv $(realpath --relative-to=/usr/share/icons/hicolor/scalable/apps ${icon_root_icon_path}) /usr/share/icons/hicolor/scalable/apps
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function exec_link_clean(){
|
function exec_link_clean(){
|
||||||
# remove broken links in /usr/share
|
# remove broken links in /usr/share
|
||||||
|
|
||||||
find /usr/share/applications -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
find /usr/share/applications -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||||
find /usr/share/icons -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
find /usr/share/icons -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||||
find /usr/share/mime/packages -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
find /usr/share/mime/packages -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||||
@@ -98,77 +104,74 @@ function exec_link_clean(){
|
|||||||
find /usr/share/fcitx -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
find /usr/share/fcitx -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||||
find /usr/share/help -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
find /usr/share/help -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||||
find /usr/share/locale -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
find /usr/share/locale -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||||
# find /usr/lib/$(gcc -dumpmachine)/fcitx -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
|
||||||
find /usr/lib/mozilla/plugins -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
find /usr/lib/mozilla/plugins -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||||
find /usr/share/polkit-1/actions -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
find /usr/share/polkit-1/actions -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||||
find /usr/share/fonts -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
find /usr/share/fonts -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||||
find /etc/fonts/conf.d -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
find /etc/fonts/conf.d -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function exec_uos_package_update(){
|
function exec_uos_package_update(){
|
||||||
update-icon-caches /usr/share/icons/* > /dev/null 2>&1 &
|
update-icon-caches /usr/share/icons/* > /dev/null 2>&1 &
|
||||||
update-desktop-database -q > /dev/null 2>&1 &
|
update-desktop-database -q > /dev/null 2>&1 &
|
||||||
update-mime-database -V /usr/share/mime > /dev/null 2>&1 &
|
update-mime-database -V /usr/share/mime > /dev/null 2>&1 &
|
||||||
glib-compile-schemas /usr/share/glib-2.0/schemas/ > /dev/null 2>&1 &
|
glib-compile-schemas /usr/share/glib-2.0/schemas/ > /dev/null 2>&1 &
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function exec_debian_compatibile_links(){
|
function exec_debian_compatibile_links(){
|
||||||
# 源目录和目标目录定义
|
# 源目录和目标目录定义
|
||||||
local SOURCE_DIR="/var/lib/apm"
|
local SOURCE_DIR="/var/lib/apm"
|
||||||
local TARGET_DIR="/var/lib/apm/apm/files/ace-env/var/lib/apm"
|
local TARGET_DIR="/var/lib/apm/apm/files/ace-env/var/lib/apm"
|
||||||
|
|
||||||
# 检查目标目录是否存在
|
# 检查目标目录是否存在
|
||||||
if [[ ! -d "$TARGET_DIR" ]]; then
|
if [[ ! -d "$TARGET_DIR" ]]; then
|
||||||
mkdir -p $TARGET_DIR
|
mkdir -p $TARGET_DIR
|
||||||
fi
|
|
||||||
|
|
||||||
# 第一部分:为缺失的目录创建软链接
|
|
||||||
echo "检查并创建缺失的软链接..."
|
|
||||||
for dir in "$SOURCE_DIR"/*/; do
|
|
||||||
# 获取目录名(去掉路径和尾部斜杠)
|
|
||||||
dirname=$(basename "$dir")
|
|
||||||
|
|
||||||
# 跳过 apm 目录
|
|
||||||
if [[ "$dirname" == "apm" ]]; then
|
|
||||||
continue
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 检查目标目录中是否已存在对应的软链接或目录
|
|
||||||
target_link="$TARGET_DIR/$dirname"
|
|
||||||
if [[ ! -e "$target_link" ]]; then
|
|
||||||
echo "创建软链接: $target_link -> $dir"
|
|
||||||
ln -sv "$dir" "$target_link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# 第二部分:清理无效的软链接
|
# 第一部分:为缺失的目录创建软链接
|
||||||
echo "清理无效的软链接..."
|
echo "检查并创建缺失的软链接..."
|
||||||
for link in "$TARGET_DIR"/*; do
|
for dir in "$SOURCE_DIR"/*/; do
|
||||||
# 检查是否为软链接
|
# 获取目录名(去掉路径和尾部斜杠)
|
||||||
if [[ -L "$link" ]]; then
|
dirname=$(basename "$dir")
|
||||||
# 检查软链接是否有效(指向的目标是否存在)
|
|
||||||
if [[ ! -e "$link" ]]; then
|
# 跳过 apm 目录
|
||||||
echo "删除无效软链接: $link"
|
if [[ "$dirname" == "apm" ]]; then
|
||||||
rm "$link"
|
continue
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
done
|
# 检查目标目录中是否已存在对应的软链接或目录
|
||||||
|
target_link="$TARGET_DIR/$dirname"
|
||||||
|
if [[ ! -e "$target_link" ]]; then
|
||||||
|
echo "创建软链接: $target_link -> $dir"
|
||||||
|
ln -sv "$dir" "$target_link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# 第二部分:清理无效的软链接
|
||||||
|
echo "清理无效的软链接..."
|
||||||
|
for link in "$TARGET_DIR"/*; do
|
||||||
|
# 检查是否为软链接
|
||||||
|
if [[ -L "$link" ]]; then
|
||||||
|
# 检查软链接是否有效(指向的目标是否存在)
|
||||||
|
if [[ ! -e "$link" ]]; then
|
||||||
|
echo "删除无效软链接: $link"
|
||||||
|
rm "$link"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
echo "----------------Running APM Dstore Patch----------------"
|
echo "----------------Running APM Dstore Patch----------------"
|
||||||
|
|
||||||
# execute linkApp function for each app and print output
|
# 执行链接操作(同时完成 .desktop 字段添加)
|
||||||
exec_uos_package_link
|
exec_uos_package_link
|
||||||
|
|
||||||
|
# exec_v23_icon_link
|
||||||
#exec_v23_icon_link
|
|
||||||
exec_link_clean
|
exec_link_clean
|
||||||
wait
|
wait
|
||||||
exec_uos_package_update
|
exec_uos_package_update
|
||||||
if [[ "${IS_APM_ENV}" = "" ]];then
|
if [[ "${IS_APM_ENV}" = "" ]];then
|
||||||
exec_debian_compatibile_links
|
exec_debian_compatibile_links
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "----------------Finished----------------"
|
echo "----------------Finished----------------"
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
@VERSION@=1.1.7
|
@VERSION@=1.2.0
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ Version: @VERSION@
|
|||||||
Architecture: amd64
|
Architecture: amd64
|
||||||
Maintainer: shenmo <shenmo@spark-app.store>
|
Maintainer: shenmo <shenmo@spark-app.store>
|
||||||
Installed-Size: 49000
|
Installed-Size: 49000
|
||||||
Depends: bubblewrap, flatpak, policykit-1 | pkexec | polkit-1 | polkit, systemd, procps,coreutils,fuse-overlayfs,xz-utils | xz,libnotify-bin,curl,xdg-user-dirs,bash
|
Depends: zenity | garma,bubblewrap, flatpak, policykit-1 | pkexec | polkit-1 | polkit, systemd, procps,coreutils,fuse-overlayfs,xz-utils | xz,libnotify-bin,curl,xdg-user-dirs,bash
|
||||||
Recommends: dpkg, fakeroot, busybox
|
Recommends: dpkg, fakeroot, busybox
|
||||||
Section: misc
|
Section: misc
|
||||||
Conflicts: ace-host-integration
|
Conflicts: ace-host-integration
|
||||||
|
|||||||
+2
-1
@@ -15,7 +15,8 @@ systemctl restart apparmor.service || true
|
|||||||
fi
|
fi
|
||||||
# Send statistics data
|
# Send statistics data
|
||||||
/var/lib/apm/apm/files/feedback.sh &
|
/var/lib/apm/apm/files/feedback.sh &
|
||||||
|
ln -sv / /host
|
||||||
|
amber-pm-dstore-patch
|
||||||
|
|
||||||
;;
|
;;
|
||||||
triggered)
|
triggered)
|
||||||
|
|||||||
Executable
+84
@@ -0,0 +1,84 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# ===== 日志函数(简化版)=====
|
||||||
|
log.info() { echo "INFO: $*"; }
|
||||||
|
log.warn() { echo "WARN: $*"; }
|
||||||
|
log.error() { echo "ERROR: $*"; }
|
||||||
|
log.debug() { :; } # APM 场景下可禁用 debug 日志
|
||||||
|
|
||||||
|
# ===== APM 专用桌面文件扫描(单文件)=====
|
||||||
|
function scan_apm_desktop_log() {
|
||||||
|
unset desktop_file_path
|
||||||
|
local pkg_name="$1"
|
||||||
|
local desktop_dir="/var/lib/apm/apm/files/ace-env/var/lib/apm/${pkg_name}/entries/applications"
|
||||||
|
|
||||||
|
[ -d "$desktop_dir" ] || return 1
|
||||||
|
|
||||||
|
while IFS= read -r -d '' path; do
|
||||||
|
[ -f "$path" ] || continue
|
||||||
|
if ! grep -q 'NoDisplay=true' "$path" 2>/dev/null; then
|
||||||
|
log.info "Found valid APM desktop file: $path"
|
||||||
|
export desktop_file_path="$path"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done < <(find "$desktop_dir" -name "*.desktop" -type f -print0 2>/dev/null)
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# ===== APM 专用桌面文件扫描(多文件列表)=====
|
||||||
|
function scan_apm_desktop_list() {
|
||||||
|
local pkg_name="$1"
|
||||||
|
local desktop_dir="/var/lib/apm/apm/files/ace-env/var/lib/apm/${pkg_name}/entries/applications"
|
||||||
|
local result=""
|
||||||
|
|
||||||
|
[ -d "$desktop_dir" ] || { echo ""; return; }
|
||||||
|
|
||||||
|
while IFS= read -r -d '' path; do
|
||||||
|
[ -f "$path" ] || continue
|
||||||
|
if ! grep -q 'NoDisplay=true' "$path" 2>/dev/null; then
|
||||||
|
result+="${path},"
|
||||||
|
fi
|
||||||
|
done < <(find "$desktop_dir" -name "*.desktop" -type f -print0 2>/dev/null)
|
||||||
|
|
||||||
|
echo "${result%,}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# ===== 启动应用 =====
|
||||||
|
function launch_app() {
|
||||||
|
local desktop_path="${1#file://}"
|
||||||
|
local exec_cmd
|
||||||
|
shift # 移除第一个参数(desktop_path),剩余的是要传递给应用的参数
|
||||||
|
|
||||||
|
# 提取并清理 Exec 行(移除字段代码如 %f %u 等)
|
||||||
|
exec_cmd=$(grep -m1 '^Exec=' "$desktop_path" | cut -d= -f2- | sed 's/%[fFuUdDnNickvm]*//g; s/^[[:space:]]*//; s/[[:space:]]*$//')
|
||||||
|
[ -z "$exec_cmd" ] && return 1
|
||||||
|
|
||||||
|
# 如果有额外参数,添加到命令中
|
||||||
|
if [ $# -gt 0 ]; then
|
||||||
|
log.info "Launching with arguments: $*"
|
||||||
|
exec_cmd="$exec_cmd $*"
|
||||||
|
fi
|
||||||
|
|
||||||
|
log.info "Launching: $exec_cmd"
|
||||||
|
${SHELL:-bash} -c "$exec_cmd"
|
||||||
|
}
|
||||||
|
|
||||||
|
# 导出函数供 ACE 环境调用
|
||||||
|
export -f launch_app scan_apm_desktop_log scan_apm_desktop_list log.info log.error
|
||||||
|
|
||||||
|
# ===== 主逻辑 =====
|
||||||
|
[ $# -lt 1 ] && {
|
||||||
|
log.error "Usage: $0 <apm-package-name> [additional arguments...]"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg_name="$1"
|
||||||
|
shift # 移除包名参数,剩余的都是要传递给应用的参数
|
||||||
|
|
||||||
|
# 直接执行 launch 逻辑,并将剩余参数传递给 launch_app
|
||||||
|
if scan_apm_desktop_log "$pkg_name" && launch_app "$desktop_file_path" "$@"; then
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
Executable
+52
@@ -0,0 +1,52 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# ===== Log =====
|
||||||
|
log.warn() { echo -e "[\e[33mWARN\e[0m]: \e[1m$*\e[0m"; }
|
||||||
|
log.error() { echo -e "[\e[31mERROR\e[0m]: \e[1m$*\e[0m"; }
|
||||||
|
log.info() { echo -e "[\e[96mINFO\e[0m]: \e[1m$*\e[0m"; }
|
||||||
|
log.debug() { echo -e "[\e[32mDEBUG\e[0m]: \e[1m$*\e[0m"; }
|
||||||
|
|
||||||
|
# 获取原始用户(调用 pkexec 或 sudo 的用户)
|
||||||
|
ORIGINAL_USER="${SUDO_USER:-$USER}"
|
||||||
|
ORIGINAL_UID=$(id -u "$ORIGINAL_USER")
|
||||||
|
ORIGINAL_DISPLAY="${DISPLAY:-:0}"
|
||||||
|
ORIGINAL_XAUTHORITY="${XAUTHORITY:-$HOME/.Xauthority}"
|
||||||
|
|
||||||
|
# 以原始用户身份运行图形界面命令
|
||||||
|
function run_as_user() {
|
||||||
|
sudo -u "$ORIGINAL_USER" DISPLAY="$ORIGINAL_DISPLAY" XAUTHORITY="$ORIGINAL_XAUTHORITY" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
function zenity() {
|
||||||
|
if [[ -e /usr/bin/garma ]]; then
|
||||||
|
run_as_user garma "$@"
|
||||||
|
else
|
||||||
|
run_as_user "$(command -v zenity)" "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function notify-send() {
|
||||||
|
local uid="$ORIGINAL_UID"
|
||||||
|
sudo -u "$ORIGINAL_USER" DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/${uid}/bus" zenity --notification --text="$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
# 如果当前不是 root,则用 pkexec 重新执行并传递必要的环境变量
|
||||||
|
if [ "$UID" != "0" ]; then
|
||||||
|
# 保存当前环境变量,通过 env 传递给 pkexec
|
||||||
|
exec pkexec "$0" "$@"
|
||||||
|
exit $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 用户确认
|
||||||
|
if zenity --question --text="即将卸载 $1\n请确认" --no-wrap; then
|
||||||
|
# 启动卸载命令(这里假设 apm 是系统命令,请根据实际情况调整)
|
||||||
|
# 注意:apm 可能不存在,可替换为 apt、dnf 等
|
||||||
|
apm autoremove "$1" -y
|
||||||
|
ret=$?
|
||||||
|
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
notify-send "卸载完成"
|
||||||
@@ -646,14 +646,16 @@ fi
|
|||||||
sudo -E chrootEnvPath="$chrootEnvPath" /var/lib/apm/apm/files/ace-run-pkg aptss clean || true
|
sudo -E chrootEnvPath="$chrootEnvPath" /var/lib/apm/apm/files/ace-run-pkg aptss clean || true
|
||||||
sudo -E chrootEnvPath="$chrootEnvPath" /var/lib/apm/apm/files/ace-run-pkg rm -vfr /var/lib/apt/lists || true
|
sudo -E chrootEnvPath="$chrootEnvPath" /var/lib/apm/apm/files/ace-run-pkg rm -vfr /var/lib/apt/lists || true
|
||||||
sudo -E chrootEnvPath="$chrootEnvPath" /var/lib/apm/apm/files/ace-run-pkg rm -vfr /var/lib/aptss/lists || true
|
sudo -E chrootEnvPath="$chrootEnvPath" /var/lib/apm/apm/files/ace-run-pkg rm -vfr /var/lib/aptss/lists || true
|
||||||
sudo -E chrootEnvPath="$chrootEnvPath" /var/lib/apm/apm/files/ace-run-pkg rm -vfr /var/cache/apt/* || true
|
sudo -E chrootEnvPath="$chrootEnvPath" /var/lib/apm/apm/files/ace-run-pkg rm -vfr /var/cache/apt/archives/* || true
|
||||||
|
|
||||||
#清理 .dpkg-new 文件
|
#清理 .dpkg-new 文件
|
||||||
log.info "搜索并清理 .dpkg-new 文件..."
|
log.info "搜索并清理 .dpkg-new 文件..."
|
||||||
# 在 core 目录下查找并删除所有以 .dpkg-new 结尾的文件
|
# 在 core 目录下查找并删除所有以 .dpkg-new 结尾的文件
|
||||||
find "$CRAFT_DIR/core" -name "*.dpkg-new" 2>/dev/null | while read -r file; do
|
# 删除 .dpkg-new 文件(去掉后缀)
|
||||||
log.info "删除: $file"
|
log.info "删除 .dpkg-new 文件.."
|
||||||
sudo rm -f "$file"
|
find "$CRAFT_DIR/core" -name "*.dpkg-new" 2>/dev/null | while read -r file; do
|
||||||
|
|
||||||
|
sudo rm -vfr "$file"
|
||||||
done
|
done
|
||||||
|
|
||||||
# 统计清理结果
|
# 统计清理结果
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ until ! echo $updatetext | grep -q "E:"; do
|
|||||||
updatetext=$(LANGUAGE=en_US apm update 2>&1)
|
updatetext=$(LANGUAGE=en_US apm update 2>&1)
|
||||||
retry_count=$((retry_count + 1))
|
retry_count=$((retry_count + 1))
|
||||||
done
|
done
|
||||||
|
apm clean
|
||||||
update_app_number=$(env LANGUAGE=en_US apm list --upgradable 2>/dev/null | grep -c upgradable)
|
update_app_number=$(env LANGUAGE=en_US apm list --upgradable 2>/dev/null | grep -c upgradable)
|
||||||
echo "update_app_number is $update_app_number"
|
echo "update_app_number is $update_app_number"
|
||||||
|
|
||||||
|
|||||||
+61
-8
@@ -21,9 +21,10 @@ Usage:
|
|||||||
Commands:
|
Commands:
|
||||||
install 安装软件包
|
install 安装软件包
|
||||||
remove 卸载软件包
|
remove 卸载软件包
|
||||||
run <package> 运行指定软件包的可执行文件
|
launch <package> [args...] 启动软件包(通过应用启动器)
|
||||||
sandbox-run <package> 运行指定软件包的可执行文件(主目录沙箱化)
|
run <package> [EXEC_PATH] [args...] 运行指定软件包的可执行文件(可指定容器内路径)
|
||||||
bwrap-run <package> 运行指定软件包的可执行文件(使用特殊的挂载参数以支持bwrap)
|
sandbox-run <package> [EXEC_PATH] [args...] 运行指定软件包的可执行文件(主目录沙箱化)
|
||||||
|
bwrap-run <package> [EXEC_PATH] [args...] 运行指定软件包的可执行文件(使用特殊的挂载参数以支持bwrap)
|
||||||
|
|
||||||
update 更新软件包信息
|
update 更新软件包信息
|
||||||
hold 锁定软件包版本
|
hold 锁定软件包版本
|
||||||
@@ -195,8 +196,34 @@ apm_exec(){
|
|||||||
umount "/tmp/apm/${coredir}"
|
umount "/tmp/apm/${coredir}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 启动应用:通过 amber-pm-app-launcher 运行
|
||||||
|
apm_launch() {
|
||||||
|
local pkg="$1"
|
||||||
|
shift
|
||||||
|
if [ -z "$pkg" ]; then
|
||||||
|
log.error "Package name required for 'launch' command"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 保存原始 PATH_PREFIX,检查包是否存在(逻辑同 run 分支)
|
||||||
|
local original_path_prefix="$PATH_PREFIX"
|
||||||
|
if ! [ -d "${PATH_PREFIX}/var/lib/apm/$pkg" ]; then
|
||||||
|
if [ -d "/var/lib/apm/$pkg" ]; then
|
||||||
|
PATH_PREFIX=""
|
||||||
|
else
|
||||||
|
log.error "Package not installed: $pkg"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 调用应用启动器,传递所有参数
|
||||||
|
amber-pm-app-launcher "$pkg" "$@"
|
||||||
|
local exit_code=$?
|
||||||
|
|
||||||
|
# 恢复 PATH_PREFIX(不影响后续命令)
|
||||||
|
PATH_PREFIX="$original_path_prefix"
|
||||||
|
return $exit_code
|
||||||
|
}
|
||||||
|
|
||||||
# 调试信息函数
|
# 调试信息函数
|
||||||
debug_info() {
|
debug_info() {
|
||||||
@@ -234,11 +261,11 @@ bronya_egg() {
|
|||||||
cat <<'EOF'
|
cat <<'EOF'
|
||||||
_ __ ____ _ ____ __
|
_ __ ____ _ ____ __
|
||||||
| | / /__ _/ / /____ ______(_)__ / __/_ _____ / /____ __ _
|
| | / /__ _/ / /____ ______(_)__ / __/_ _____ / /____ __ _
|
||||||
| |/ / _ `/ / '_/ // / __/ / -_) _\ \/ // (_-</ __/ -_) ' \
|
| |/ / _ `/ / '_/ // / __/ / _-) _\ \/ // (_-</ __/ -_) ' \
|
||||||
|___/\_,_/_/_/\_\\_, /_/ /_/\__/ /___/\_, /___/\__/\__/_/_/_/
|
|___/\_,_/_/_/\_\\_, /_/ /_/\__/ /___/\_, /___/\__/\__/_/_/_/
|
||||||
/ / ___ ___ __/___/____/ / /___/
|
/ / ___ ___ __/___/____/ / /___/
|
||||||
/ /__/ _ `/ // / _ \/ __/ _ \
|
/ /__/ _ `/ // / _ \/ __/ _ \
|
||||||
/____/\_,_/\_,_/_//_/\__/_//_/
|
/____/\_,_/_,_/_//_/\__/_//_/
|
||||||
|
|
||||||
Valkyrie 系统启动 - 重装小兔,Fire!
|
Valkyrie 系统启动 - 重装小兔,Fire!
|
||||||
💎 感谢 Anysets 为 AmberCE 和 AmberPM 的 Arch 架构支持提供帮助~
|
💎 感谢 Anysets 为 AmberCE 和 AmberPM 的 Arch 架构支持提供帮助~
|
||||||
@@ -303,13 +330,24 @@ for dir in "$APM_BASE"/*/; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# 主命令处理
|
# 主命令处理
|
||||||
case "$1" in
|
case "$1" in
|
||||||
install|full-upgrade|upgrade|reinstall)
|
install|full-upgrade|upgrade|reinstall)
|
||||||
command=$1
|
command=$1
|
||||||
shift
|
shift
|
||||||
amber-pm-debug aptss "$command" "$@"
|
amber-pm-debug aptss "$command" "$@"
|
||||||
|
exit_code=$?
|
||||||
|
|
||||||
|
# 如果第一次执行失败,尝试修复并重试
|
||||||
|
if [ $exit_code -ne 0 ]; then
|
||||||
|
log.warn "Command failed, attempting to fix with dpkg --configure -a..."
|
||||||
|
amber-pm-debug dpkg --configure -a
|
||||||
|
log.info "Retrying $command..."
|
||||||
|
amber-pm-debug aptss "$command" "$@"
|
||||||
exit_code=$?
|
exit_code=$?
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $exit_code -eq 0 ]; then
|
if [ $exit_code -eq 0 ]; then
|
||||||
log.info "Operation successful"
|
log.info "Operation successful"
|
||||||
else
|
else
|
||||||
@@ -319,6 +357,7 @@ case "$1" in
|
|||||||
amber-pm-debug amber-pm-dstore-patch
|
amber-pm-debug amber-pm-dstore-patch
|
||||||
apm-nvidia-toggle
|
apm-nvidia-toggle
|
||||||
amber-pm-gxde-desktop-fix
|
amber-pm-gxde-desktop-fix
|
||||||
|
update-mime-database /var/lib/apm/apm/files/ace-env/amber-ce-tools/data-dir/mime > /dev/null 2>&1 &
|
||||||
;;
|
;;
|
||||||
download|search|policy|list|update|clean|show|depends|rdepends|changelog|moo)
|
download|search|policy|list|update|clean|show|depends|rdepends|changelog|moo)
|
||||||
command=$1
|
command=$1
|
||||||
@@ -360,6 +399,17 @@ case "$1" in
|
|||||||
amber-pm-debug amber-pm-dstore-patch
|
amber-pm-debug amber-pm-dstore-patch
|
||||||
amber-pm-gxde-desktop-fix
|
amber-pm-gxde-desktop-fix
|
||||||
;;
|
;;
|
||||||
|
launch)
|
||||||
|
shift
|
||||||
|
apm_launch "$@"
|
||||||
|
exit_code=$?
|
||||||
|
if [ $exit_code -eq 0 ]; then
|
||||||
|
log.info "Operation successful"
|
||||||
|
else
|
||||||
|
log.error "Error: Operation failed"
|
||||||
|
exit $exit_code
|
||||||
|
fi
|
||||||
|
;;
|
||||||
run)
|
run)
|
||||||
# 运行包命令:第二个参数必须是包名
|
# 运行包命令:第二个参数必须是包名
|
||||||
if [ -z "$2" ]; then
|
if [ -z "$2" ]; then
|
||||||
@@ -393,9 +443,11 @@ case "$1" in
|
|||||||
log.info "Running user command: $*"
|
log.info "Running user command: $*"
|
||||||
apm_exec "$@"
|
apm_exec "$@"
|
||||||
else
|
else
|
||||||
# 没有额外参数:提示
|
# 没有额外参数:提示用户改用 launch,并自动调用 launch
|
||||||
log.info "Usage: $SCRIPT_NAME run $pkg [EXEC_PATH]"
|
log.info "未指定可执行文件路径。如果希望在未指定容器路径的情况下启动应用程序,推荐使用 "launch" 命令"
|
||||||
exit 1
|
log.info "正在启动:$SCRIPT_NAME launch $pkg"
|
||||||
|
apm_launch "$pkg"
|
||||||
|
exit $?
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
sandbox-run)
|
sandbox-run)
|
||||||
@@ -415,6 +467,7 @@ case "$1" in
|
|||||||
debug_info $@
|
debug_info $@
|
||||||
;;
|
;;
|
||||||
ssaudit)
|
ssaudit)
|
||||||
|
amber-pm-debug dpkg --configure -a
|
||||||
amber-pm-debug ssaudit $@ --native
|
amber-pm-debug ssaudit $@ --native
|
||||||
exit_code=$?
|
exit_code=$?
|
||||||
if [ $exit_code -eq 0 ]; then
|
if [ $exit_code -eq 0 ]; then
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ _apm()
|
|||||||
# see if the user selected a command already
|
# see if the user selected a command already
|
||||||
local COMMANDS=(
|
local COMMANDS=(
|
||||||
"ssaudit"
|
"ssaudit"
|
||||||
|
"launch"
|
||||||
"list"
|
"list"
|
||||||
"search"
|
"search"
|
||||||
"show" "showsrc"
|
"show" "showsrc"
|
||||||
@@ -185,7 +186,7 @@ find_directories_without_ace_env() {
|
|||||||
# 查找所有直接子目录,排除包含ace-env子目录的目录
|
# 查找所有直接子目录,排除包含ace-env子目录的目录
|
||||||
while IFS= read -r -d '' dir; do
|
while IFS= read -r -d '' dir; do
|
||||||
if [[ -d "$dir" ]] && [[ ! -d "$dir/files/ace-env" ]]; then
|
if [[ -d "$dir" ]] && [[ ! -d "$dir/files/ace-env" ]]; then
|
||||||
result+=("$(basename $dir)")
|
result+=("$(basename "$dir")")
|
||||||
fi
|
fi
|
||||||
done < <(find "$base_dir" -maxdepth 1 -type d ! -path "$base_dir" -print0 2>/dev/null)
|
done < <(find "$base_dir" -maxdepth 1 -type d ! -path "$base_dir" -print0 2>/dev/null)
|
||||||
|
|
||||||
@@ -196,52 +197,107 @@ find_directories_without_ace_env() {
|
|||||||
fi
|
fi
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
function apm_run_compgen(){
|
|
||||||
result=$(find_directories_without_ace_env "$primary_dir")
|
|
||||||
|
|
||||||
if [[ -n "$result" ]]; then
|
function apm_run_compgen(){
|
||||||
echo "$result"
|
result=$(find_directories_without_ace_env "$primary_dir")
|
||||||
else
|
|
||||||
result=$(find_directories_without_ace_env "$fallback_dir")
|
|
||||||
if [[ -n "$result" ]]; then
|
if [[ -n "$result" ]]; then
|
||||||
echo "$result"
|
echo "$result"
|
||||||
else
|
else
|
||||||
echo ""
|
result=$(find_directories_without_ace_env "$fallback_dir")
|
||||||
|
if [[ -n "$result" ]]; then
|
||||||
|
echo "$result"
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 获取当前命令的参数位置
|
||||||
|
get_arg_position() {
|
||||||
|
local cmd="$1"
|
||||||
|
local pos=0
|
||||||
|
local found_cmd=0
|
||||||
|
|
||||||
|
for (( i=1; i < ${#words[@]}; i++ )); do
|
||||||
|
if [[ $found_cmd -eq 0 ]]; then
|
||||||
|
if [[ "${words[i]}" == "$cmd" ]]; then
|
||||||
|
found_cmd=1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# 跳过选项参数(以-开头)
|
||||||
|
if [[ "${words[i]}" != -* ]]; then
|
||||||
|
((pos++))
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo $pos
|
||||||
|
}
|
||||||
|
|
||||||
# specific command arguments
|
# specific command arguments
|
||||||
if [[ -n $command ]]; then
|
if [[ -n $command ]]; then
|
||||||
|
# 获取参数位置
|
||||||
|
local arg_pos=$(get_arg_position "$command")
|
||||||
|
|
||||||
case $command in
|
case $command in
|
||||||
remove|purge|autoremove)
|
remove|purge|autoremove)
|
||||||
# Debian system
|
# 第一个参数匹配包名
|
||||||
|
if [[ $arg_pos -eq 1 ]]; then
|
||||||
|
COMPREPLY=( $( compgen -W "$(ls /var/lib/apm/apm/files/ace-env/var/lib/apm/ )" "$cur" ) )
|
||||||
COMPREPLY=( $( compgen -W "$(ls /var/lib/apm/apm/files/ace-env/var/lib/apm/ )" $cur ) )
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
show|list|download|changelog|depends|rdepends)
|
show|list|download|changelog|depends|rdepends)
|
||||||
COMPREPLY=( $( amber-pm-debug apt-cache --no-generate pkgnames "$cur" -o Dir::Cache="/var/lib/aptss/" \
|
# 第一个参数匹配包名
|
||||||
2> /dev/null ) )
|
if [[ $arg_pos -eq 1 ]]; then
|
||||||
|
COMPREPLY=( $( amber-pm-debug apt-cache --no-generate pkgnames "$cur" -o Dir::Cache="/var/lib/aptss/" \
|
||||||
|
2> /dev/null ) )
|
||||||
|
fi
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
install)
|
install)
|
||||||
COMPREPLY=( $( amber-pm-debug apt-cache --no-generate pkgnames "$cur" -o Dir::Cache="/var/lib/aptss/" \
|
# 第一个参数匹配包名
|
||||||
2> /dev/null ) )
|
if [[ $arg_pos -eq 1 ]]; then
|
||||||
if [[ "$cur" == ./* || "$cur" == /* ]]; then
|
COMPREPLY=( $( amber-pm-debug apt-cache --no-generate pkgnames "$cur" -o Dir::Cache="/var/lib/aptss/" \
|
||||||
_filedir "deb"
|
2> /dev/null ) )
|
||||||
|
if [[ "$cur" == ./* || "$cur" == /* ]]; then
|
||||||
|
_filedir "deb"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
source|build-dep|showsrc|policy)
|
source|build-dep|showsrc|policy)
|
||||||
COMPREPLY=( $( amber-pm-debug apt-cache --no-generate pkgnames "$cur" -o Dir::Cache="/var/lib/aptss/" \
|
# 第一个参数匹配包名
|
||||||
2> /dev/null ) $( apt-cache dumpavail -o Dir::Cache="/var/lib/aptss/" | \
|
if [[ $arg_pos -eq 1 ]]; then
|
||||||
command grep "^Source: $cur" | sort -u | cut -f2 -d" " ) )
|
COMPREPLY=( $( amber-pm-debug apt-cache --no-generate pkgnames "$cur" -o Dir::Cache="/var/lib/aptss/" \
|
||||||
|
2> /dev/null ) $( apt-cache dumpavail -o Dir::Cache="/var/lib/aptss/" | \
|
||||||
|
command grep "^Source: $cur" | sort -u | cut -f2 -d" " ) )
|
||||||
|
fi
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
run|sandbox-run|bwrap-run)
|
run|sandbox-run|bwrap-run)
|
||||||
COMPREPLY=( $( compgen -W "$(apm_run_compgen)" "$cur" ) )
|
# 第一个参数匹配包名
|
||||||
|
if [[ $arg_pos -eq 1 ]]; then
|
||||||
|
COMPREPLY=( $( compgen -W "$(apm_run_compgen)" "$cur" ) )
|
||||||
|
# 第二个及以后参数匹配文件
|
||||||
|
elif [[ $arg_pos -ge 2 ]]; then
|
||||||
|
_filedir
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
launch)
|
||||||
|
# 第一个参数匹配包名
|
||||||
|
if [[ $arg_pos -eq 1 ]]; then
|
||||||
|
COMPREPLY=( $( compgen -W "$(apm_run_compgen)" "$cur" ) )
|
||||||
|
# 第二个及以后参数匹配文件
|
||||||
|
elif [[ $arg_pos -ge 2 ]]; then
|
||||||
|
_filedir
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
ssaudit)
|
||||||
|
# ssaudit 命令总是匹配文件
|
||||||
|
_filedir
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -256,4 +312,4 @@ fi
|
|||||||
} &&
|
} &&
|
||||||
complete -F _apm apm
|
complete -F _apm apm
|
||||||
|
|
||||||
# ex: ts=4 sw=4 et filetype=sh
|
# ex: ts=4 sw=4 et filetype=sh
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||||
|
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
|
||||||
|
<policyconfig>
|
||||||
|
<vendor>Flamescion</vendor>
|
||||||
|
<icon_name>x-package-repository</icon_name>
|
||||||
|
<action id="store.spark-app.apm-uninstaller">
|
||||||
|
<description>运行justinstallme需要权限</description>
|
||||||
|
<message>要使用ssinstall需要权限</message>
|
||||||
|
<defaults>
|
||||||
|
<allow_any>yes</allow_any>
|
||||||
|
<allow_inactive>yes</allow_inactive>
|
||||||
|
<allow_active>yes</allow_active>
|
||||||
|
</defaults>
|
||||||
|
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/amber-pm-app-uninstaller</annotate>
|
||||||
|
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||||
|
</action>
|
||||||
|
</policyconfig>
|
||||||
@@ -109,7 +109,8 @@ ENV_VARS=(
|
|||||||
"PATH /amber-ce-tools/bin-override:\$PATH"
|
"PATH /amber-ce-tools/bin-override:\$PATH"
|
||||||
"IS_ACE_ENV 1"
|
"IS_ACE_ENV 1"
|
||||||
"GTK_USE_PORTAL 1"
|
"GTK_USE_PORTAL 1"
|
||||||
"XDG_DATA_DIRS /amber-ce-tools/additional-data-dir-in-container:\$XDG_DATA_DIRS"
|
"XDG_DATA_DIRS /amber-ce-tools/additional-data-dir-in-container:/host/usr/local/share:/host/usr/share:\$XDG_DATA_DIRS"
|
||||||
|
"XCURSOR_PATH /host/usr/share/icons:/host/usr/share/cursors:/usr/share/icons:/usr/share/cursors:\$XCURSOR_PATH"
|
||||||
)
|
)
|
||||||
|
|
||||||
# 基础绑定目录(始终绑定)
|
# 基础绑定目录(始终绑定)
|
||||||
@@ -125,9 +126,6 @@ BASE_BIND_DIRS=(
|
|||||||
"--dev-bind /run /run"
|
"--dev-bind /run /run"
|
||||||
"--dev-bind-try /run/user/\$uid/pulse /run/user/\$uid/pulse"
|
"--dev-bind-try /run/user/\$uid/pulse /run/user/\$uid/pulse"
|
||||||
"--dev-bind / /host"
|
"--dev-bind / /host"
|
||||||
"--ro-bind-try /usr/share/themes /usr/local/share/themes"
|
|
||||||
"--ro-bind-try /usr/share/icons /usr/share/icons"
|
|
||||||
"--ro-bind-try /usr/share/fonts /usr/local/share/fonts"
|
|
||||||
"--dev-bind-try /etc/resolv.conf /etc/resolv.conf"
|
"--dev-bind-try /etc/resolv.conf /etc/resolv.conf"
|
||||||
"--dev-bind-try /home /home"
|
"--dev-bind-try /home /home"
|
||||||
"--dev-bind-try $HOME/.apm/${APM_PKG_NAME}/.deepinwine $HOME/.deepinwine"
|
"--dev-bind-try $HOME/.apm/${APM_PKG_NAME}/.deepinwine $HOME/.deepinwine"
|
||||||
@@ -150,12 +148,13 @@ NON_SANDBOX_BIND_DIRS=(
|
|||||||
)
|
)
|
||||||
|
|
||||||
# 根据 APM_USE_BWRAP 决定是否添加 CAP_SYS_ADMIN
|
# 根据 APM_USE_BWRAP 决定是否添加 CAP_SYS_ADMIN
|
||||||
|
# 为修复Steam问题,强制都不加
|
||||||
EXTRA_ARGS=()
|
EXTRA_ARGS=()
|
||||||
if [ "${APM_USE_BWRAP:-0}" != "1" ]; then
|
#if [ "${APM_USE_BWRAP:-0}" != "1" ]; then
|
||||||
EXTRA_ARGS=(
|
# EXTRA_ARGS=(
|
||||||
"--cap-add CAP_SYS_ADMIN"
|
# "--cap-add CAP_SYS_ADMIN"
|
||||||
)
|
# )
|
||||||
fi
|
#fi
|
||||||
|
|
||||||
EXTRA_SCRIPTS=(
|
EXTRA_SCRIPTS=(
|
||||||
# cursor_theme_dir_integration
|
# cursor_theme_dir_integration
|
||||||
|
|||||||
@@ -104,9 +104,9 @@ BIND_DIRS=(
|
|||||||
"--dev-bind-try /home /home"
|
"--dev-bind-try /home /home"
|
||||||
)
|
)
|
||||||
EXTRA_ARGS=(
|
EXTRA_ARGS=(
|
||||||
"--hostname Amber-PM"
|
# "--hostname Amber-PM"
|
||||||
"--unshare-uts"
|
# "--unshare-uts"
|
||||||
"--cap-add CAP_SYS_ADMIN"
|
# "--cap-add CAP_SYS_ADMIN"
|
||||||
)
|
)
|
||||||
|
|
||||||
EXTRA_SCRIPTS=(
|
EXTRA_SCRIPTS=(
|
||||||
|
|||||||
@@ -114,7 +114,8 @@ ln -sv ../../usr/share/applications $chrootEnvPath/amber-ce-tools/data-dir/
|
|||||||
ln -sv ../../usr/share/icons $chrootEnvPath/amber-ce-tools/data-dir/
|
ln -sv ../../usr/share/icons $chrootEnvPath/amber-ce-tools/data-dir/
|
||||||
mkdir -p $chrootEnvPath/usr/share/templates
|
mkdir -p $chrootEnvPath/usr/share/templates
|
||||||
ln -sfv ../../usr/share/templates/ $chrootEnvPath/amber-ce-tools/data-dir/
|
ln -sfv ../../usr/share/templates/ $chrootEnvPath/amber-ce-tools/data-dir/
|
||||||
|
mkdir -p $chrootEnvPath/usr/share/templates
|
||||||
|
ln -sfv ../../usr/share/mime/ $chrootEnvPath/amber-ce-tools/data-dir/
|
||||||
|
|
||||||
chmod 777 -R $chrootEnvPath/usr/share/icons
|
chmod 777 -R $chrootEnvPath/usr/share/icons
|
||||||
rm -vfr $chrootEnvPath/dev/*
|
rm -vfr $chrootEnvPath/dev/*
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
### 这个工具是用来启动apm内置ACE环境的,不是用来打开应用的
|
||||||
bash(){
|
bash(){
|
||||||
/usr/bin/bash --rcfile <(cat ~/.bashrc; echo "PS1=\"\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@Amber-PM \[\e[36;40m\]\w\[\e[0m\]]\\\$ \"") $@
|
/usr/bin/bash --rcfile <(cat ~/.bashrc; echo "PS1=\"\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@Amber-PM \[\e[36;40m\]\w\[\e[0m\]]\\\$ \"") $@
|
||||||
}
|
}
|
||||||
@@ -113,14 +113,11 @@ BIND_DIRS=(
|
|||||||
"--dev-bind /run /run"
|
"--dev-bind /run /run"
|
||||||
"--dev-bind-try /run/user/\$uid/pulse /run/user/\$uid/pulse"
|
"--dev-bind-try /run/user/\$uid/pulse /run/user/\$uid/pulse"
|
||||||
"--dev-bind / /host"
|
"--dev-bind / /host"
|
||||||
"--ro-bind-try /usr/share/themes /usr/local/share/themes"
|
|
||||||
"--ro-bind-try /usr/share/icons /usr/local/share/icons"
|
|
||||||
"--ro-bind-try /usr/share/fonts /usr/local/share/fonts"
|
|
||||||
"--dev-bind-try /etc/resolv.conf /etc/resolv.conf"
|
"--dev-bind-try /etc/resolv.conf /etc/resolv.conf"
|
||||||
"--dev-bind-try /home /home"
|
"--dev-bind-try /home /home"
|
||||||
)
|
)
|
||||||
EXTRA_ARGS=(
|
EXTRA_ARGS=(
|
||||||
"--cap-add CAP_SYS_ADMIN"
|
# "--cap-add CAP_SYS_ADMIN"
|
||||||
)
|
)
|
||||||
|
|
||||||
EXTRA_SCRIPTS=(
|
EXTRA_SCRIPTS=(
|
||||||
|
|||||||
Reference in New Issue
Block a user