From 3fa34672cad0a1b298f2a16cf7bb3b5305c5b5b1 Mon Sep 17 00:00:00 2001 From: shenmo Date: Sat, 7 Jun 2025 10:59:02 +0800 Subject: [PATCH] 8.4 --- LICENSE | 8 +++---- ace-base.config | 2 ++ build-pkg.sh | 8 +++++-- debian-build.sh | 7 +++++++ linker.sh | 3 ++- replacer.sh | 2 +- src/DEBIAN/control | 13 ++++++++++++ src/DEBIAN/postinst | 18 ++++++++++++++++ src/DEBIAN/postrm | 21 +++++++++++++++++++ .../@PKG_NAME@/files/bin/ace-uninstall-helper | 4 ++-- .../apps/@PKG_NAME@/files/build-container.sh | 17 +++++++-------- 11 files changed, 83 insertions(+), 20 deletions(-) create mode 100755 debian-build.sh mode change 100644 => 100755 replacer.sh create mode 100644 src/DEBIAN/control create mode 100755 src/DEBIAN/postinst create mode 100755 src/DEBIAN/postrm diff --git a/LICENSE b/LICENSE index 94a9ed0..f288702 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found. GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. @@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see -. +. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read -. +. diff --git a/ace-base.config b/ace-base.config index 0456f83..505e057 100644 --- a/ace-base.config +++ b/ace-base.config @@ -2,3 +2,5 @@ @HOST_NAME@=Amber-CE-Bookworm @EXEC_NAME@=bookworm-run @PRETTY_NAME@=Bookworm +@VERSION@=12.8.4 +@CODE_NAME@=bookworm diff --git a/build-pkg.sh b/build-pkg.sh index 3e2031a..908af40 100755 --- a/build-pkg.sh +++ b/build-pkg.sh @@ -22,13 +22,17 @@ read_config() { } pushd $(dirname $(realpath $0)) -read_config "ace-base.config" +cp ace-base.config ace-base-build.config +echo "@ARCH@=$(dpkg --print-architecture)" >> ace-base-build.config +read_config "ace-base-build.config" # 访问变量 echo "Package Name: $PKG_NAME" echo "Host Name: $HOST_NAME" echo "Executable Name: $EXEC_NAME" echo "Pretty Name: $PRETTY_NAME" +echo "Architecture: $ARCH" +echo "Codename: $CODE_NAME" if [[ -z "$1" ]];then echo "Need TARGET DIR" @@ -38,5 +42,5 @@ target_dir="${1}" # 要处理的目标目录 bash replacer.sh ${target_dir}/ bash linker.sh ${target_dir}/ - cd ${target_dir}/opt/apps/$PKG_NAME/files && bash build-container.sh $(uname -m) + cd ${target_dir}/opt/apps/$PKG_NAME/files && bash build-container.sh $ARCH $CODE_NAME popd \ No newline at end of file diff --git a/debian-build.sh b/debian-build.sh new file mode 100755 index 0000000..0e39331 --- /dev/null +++ b/debian-build.sh @@ -0,0 +1,7 @@ +#!/bin/bash +pushd $(dirname $(realpath $0)) +sudo apt install debootstrap systemd-container sudo file -y +cp -vr src pkg +bash build-pkg.sh pkg +dpkg-deb -Z gzip -b pkg/ ./ +popd \ No newline at end of file diff --git a/linker.sh b/linker.sh index f285e78..87273b1 100755 --- a/linker.sh +++ b/linker.sh @@ -22,13 +22,14 @@ read_config() { } -read_config "ace-base.config" +read_config "ace-base-build.config" # 访问变量 echo "Package Name: $PKG_NAME" echo "Host Name: $HOST_NAME" echo "Executable Name: $EXEC_NAME" echo "Pretty Name: $PRETTY_NAME" +echo "Version: $VERSION" target_dir="${1}" mkdir ${target_dir}/usr/bin ln -vfs ../../opt/apps/$PKG_NAME/files/bin/ace-run ${target_dir}/usr/bin/$EXEC_NAME diff --git a/replacer.sh b/replacer.sh old mode 100644 new mode 100755 index 71a8328..7f4c06f --- a/replacer.sh +++ b/replacer.sh @@ -3,7 +3,7 @@ ######################################## # 配置部分 ######################################## -config_file="ace-base.config" # 配置文件路径 +config_file="ace-base-build.config" # 配置文件路径 if [[ -z "$1" ]];then echo "Need TARGET DIR" exit diff --git a/src/DEBIAN/control b/src/DEBIAN/control new file mode 100644 index 0000000..9fb0e7b --- /dev/null +++ b/src/DEBIAN/control @@ -0,0 +1,13 @@ +Package: @PKG_NAME@ +Source: amber-ce +Version: @VERSION@ +Architecture: @ARCH@ +Maintainer: shenmo +Installed-Size: 145627 +Depends: bubblewrap, flatpak, zenity, policykit-1 | pkexec | polkit-1 | polkit, systemd, procps +Section: misc +Conflists: ace-host-integration +Priority: optional +Multi-Arch: foreign +Homepage: https://gitee.com/amber-ce/amber-ce-bookworm/ +Description: bwrap wrapper for install and running debs inside a @PRETTY_NAME@ container diff --git a/src/DEBIAN/postinst b/src/DEBIAN/postinst new file mode 100755 index 0000000..d263768 --- /dev/null +++ b/src/DEBIAN/postinst @@ -0,0 +1,18 @@ +#!/bin/bash +export PACKAGE_NAME="$DPKG_MAINTSCRIPT_PACKAGE" + + + +/opt/apps/$PACKAGE_NAME/files/bin/ace-init + + +systemctl daemon-reload +systemctl enable $PACKAGE_NAME-auto-upgrade +systemctl start $PACKAGE_NAME-auto-upgrade + + if [ -f /usr/lib/sysctl.d/$PACKAGE_NAME.conf ];then + sysctl -p /usr/lib/sysctl.d/$PACKAGE_NAME.conf + fi + + +true diff --git a/src/DEBIAN/postrm b/src/DEBIAN/postrm new file mode 100755 index 0000000..334d5aa --- /dev/null +++ b/src/DEBIAN/postrm @@ -0,0 +1,21 @@ +#!/bin/bash +PACKAGE_NAME="$DPKG_MAINTSCRIPT_PACKAGE" + + +systemctl stop $PACKAGE_NAME-auto-upgrade +systemctl disable $PACKAGE_NAME-auto-upgrade + + + + +if [ "$1" = "remove" ] || [ "$1" = "purge" ];then + +echo "清理卸载残留" + +rm -rf /opt/apps/$PACKAGE_NAME +else +echo "非卸载,跳过清理" +fi + + + diff --git a/src/opt/apps/@PKG_NAME@/files/bin/ace-uninstall-helper b/src/opt/apps/@PKG_NAME@/files/bin/ace-uninstall-helper index f9d092f..2ad5088 100755 --- a/src/opt/apps/@PKG_NAME@/files/bin/ace-uninstall-helper +++ b/src/opt/apps/@PKG_NAME@/files/bin/ace-uninstall-helper @@ -54,7 +54,7 @@ fi if [ -f "$DPKG_LIST_FILE" ]; then if grep -q "$IN_CONTAINER_PATH" "$DPKG_LIST_FILE" || grep -q "/opt/apps/$PKGNAME_GUESS/entries/applications/$PKGNAME_GUESS.desktop" "$DPKG_LIST_FILE"; then - bookworm-run apt autopurge $PKGNAME_GUESS -y + @EXEC_NAME@ apt autopurge $PKGNAME_GUESS -y ret=$? if [ "$ret" = "0" ];then echo "Operation succeeded." @@ -73,7 +73,7 @@ fi if grep -q "$IN_CONTAINER_PATH" "$file"; then PKGNAME_GUESS=$(basename "$file" .list | cut -d':' -f1) echo "Get pkgname $PKGNAME_GUESS, uninstalling..." - bookworm-run apt autopurge $PKGNAME_GUESS -y + @EXEC_NAME@ apt autopurge $PKGNAME_GUESS -y ret=$? if [ "$ret" = "0" ];then echo "Operation succeeded." diff --git a/src/opt/apps/@PKG_NAME@/files/build-container.sh b/src/opt/apps/@PKG_NAME@/files/build-container.sh index d801223..c9f6a5f 100755 --- a/src/opt/apps/@PKG_NAME@/files/build-container.sh +++ b/src/opt/apps/@PKG_NAME@/files/build-container.sh @@ -9,27 +9,24 @@ if [ `which systemd-nspawn` = "" ];then echo "Need to install systemd-container!" exit fi - +if [ "$2" = "" ];then +echo "Usage: $0 ARCHITECTURE CODENAME" +exit +fi if [ "$1" = "amd64" ] || [ "$1" = "x86_64" ];then ARCH="amd64" ARCH_ANOTHERWAY="x64" cd "`dirname $0`" -sudo debootstrap --components=main,contrib,non-free,non-free-firmware --include=libnotify-bin,apt-utils,bash-completion,bc,curl,dialog,diffutils,findutils,less,libnss-myhostname,libvte-common,lsof,ncurses-base,passwd,pinentry-curses,procps,sudo,time,util-linux,wget,libegl1,libvulkan1,mesa-vulkan-drivers,locales,libglib2.0-bin --arch=${ARCH} bookworm ./ace-env https://mirrors.ustc.edu.cn/debian/ +sudo debootstrap --components=main,contrib,non-free,non-free-firmware --include=libnotify-bin,apt-utils,bash-completion,bc,curl,dialog,diffutils,findutils,less,libnss-myhostname,libvte-common,lsof,ncurses-base,passwd,pinentry-curses,procps,sudo,time,util-linux,wget,libegl1,libvulkan1,mesa-vulkan-drivers,locales,libglib2.0-bin --arch=${ARCH} $2 ./ace-env https://mirrors.cernet.edu.cn/debian/ elif [ "$1" = "arm64" ] || [ "$1" = "arm" ]|| [ "$1" = "aarch64" ];then ARCH="arm64" ARCH_ANOTHERWAY="arm64" cd "`dirname $0`" -sudo debootstrap --components=main,contrib,non-free,non-free-firmware --include=libnotify-bin,apt-utils,bash-completion,bc,curl,dialog,diffutils,findutils,less,libnss-myhostname,libvte-common,lsof,ncurses-base,passwd,pinentry-curses,procps,sudo,time,util-linux,wget,libegl1,libvulkan1,mesa-vulkan-drivers,locales,libglib2.0-bin --arch=${ARCH} bookworm ./ace-env https://mirrors.ustc.edu.cn/debian/ -elif [ "$1" = "loongarch64" ] || [ "$1" = "loong64" ];then -ARCH="loong64" -ARCH_ANOTHERWAY="loong64" -sudo debootstrap --no-check-gpg --include=libnotify-bin,debian-ports-archive-keyring,apt-utils,bash-completion,bc,curl,dialog,diffutils,gnupg,findutils,less,libnss-myhostname,libvte-common,lsof,ncurses-base,passwd,pinentry-curses,procps,sudo,time,util-linux,wget,libegl1,libgl1-mesa-dri,libvulkan1,mesa-vulkan-drivers,locales,libglib2.0-bin --arch=${ARCH} --variant=buildd sid ./ace-env https://deb.debian.org/debian-ports/ -else -echo "Need to point out architecture" -exit +sudo debootstrap --components=main,contrib,non-free,non-free-firmware --include=libnotify-bin,apt-utils,bash-completion,bc,curl,dialog,diffutils,findutils,less,libnss-myhostname,libvte-common,lsof,ncurses-base,passwd,pinentry-curses,procps,sudo,time,util-linux,wget,libegl1,libvulkan1,mesa-vulkan-drivers,locales,libglib2.0-bin --arch=${ARCH} $2 ./ace-env https://mirrors.cernet.edu.cn/debian/ + fi