to-latest

This commit is contained in:
shenmo 2023-07-27 15:58:00 +08:00
parent 33a672a5ea
commit 77279777b0
7 changed files with 39 additions and 29 deletions

View File

@ -1,5 +1,5 @@
Package: cn.flamescion.bookworm-compatibility-mode
Version: 12.1.4-1
Version: 12.1.4-4
Section: misc
Priority: optional
Depends: bubblewrap

View File

@ -1,4 +1,6 @@
#!/bin/bash
/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bin/bookworm-init
export PACKAGE_NAME="$DPKG_MAINTSCRIPT_PACKAGE"
/opt/apps/$PACKAGE_NAME/files/bin/bookworm-init
if [ "$PACKAGE_NAME" = "cn.flamescion.bookworm-compatibility-mode" ];then
ln -sf /opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bin/bookworm-run /usr/bin/bookworm-run
fi

View File

@ -1,10 +1,12 @@
#!/bin/bash
PACKAGE_NAME="$DPKG_MAINTSCRIPT_PACKAGE"
if [ "$1" = "remove" ] || [ "$1" = "purge" ];then
echo "清理卸载残留"
if [ "$PACKAGE_NAME" = "cn.flamescion.bookworm-compatibility-mode" ];then
unlink /usr/bin/bookworm-run
rm -rf /opt/apps/cn.flamescion.bookworm-compatibility-mode/
fi
echo "清理卸载残留"
rm -rf /opt/apps/$PACKAGE_NAME
else
echo "非卸载,跳过清理"
fi

View File

@ -4,15 +4,20 @@ if [ "$(id -u)" != "0" ]; then
echo "当前用户不是 root 用户,退出"
exit
fi
chrootEnvPath=/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bookworm-env
if [ "$PACKAGE_NAME" = "" ];then
PKGNAME=cn.flamescion.bookworm-compatibility-mode
else
PKGNAME=$PACKAGE_NAME
fi
chrootEnvPath=/opt/apps/$PKGNAME/files/bookworm-env
if [ ! -e $chrootEnvPath ];then
echo "Uncompress the env...."
tar -xvf $chrootEnvPath.tar.xz -C /opt/apps/cn.flamescion.bookworm-compatibility-mode/files/
tar -xvf $chrootEnvPath.tar.xz -C /opt/apps/$PKGNAME/files/
fi
echo "Update the flamescion container tools"
tar -xvf `dirname $chrootEnvPath`/flamescion-container-tools.tar.xz -C $chrootEnvPath
chown -R $(who | awk '{print $1}' | head -n 1) $chrootEnvPath
non_root_user=$(who | awk '{print $1}' | head -n 1)
uid=$(id -u $non_root_user)
@ -37,7 +42,7 @@ bwrap --dev-bind $chrootEnvPath/ / \
--dev-bind /sys /sys \
--dev-bind /run /run \
--dev-bind /run/user/$uid/pulse /run/user/$uid/pulse \
--dev-bind / /run/host \
--dev-bind / /host \
--bind-try /usr/share/themes /usr/local/share/themes \
--bind-try /usr/share/icons /usr/local/share/icons \
--bind-try /usr/share/fonts /usr/local/share/fonts \
@ -171,7 +176,7 @@ EOFFFFFF
chmod +x $chrootEnvPath/init.sh
bookworm-run bash /init.sh
bookworm-run rm /init.sh
bookworm-run cp /run/host/etc/locale.gen /etc/locale.gen && locale-gen
bookworm-run cp /host/etc/locale.gen /etc/locale.gen && locale-gen
bookworm-run touch /finish.flag
sudo -u $(who | awk '{print $1}' | head -n 1) bwrap --dev-bind $chrootEnvPath/ / \
--setenv LANG "$LANG" \
@ -192,7 +197,7 @@ sudo -u $(who | awk '{print $1}' | head -n 1) bwrap --dev-bind $chrootEnvPath/ /
--dev-bind /sys /sys \
--dev-bind /run /run \
--dev-bind /run/user/$uid/pulse /run/user/$uid/pulse \
--dev-bind / /run/host \
--dev-bind / /host \
--bind-try /usr/share/themes /usr/local/share/themes \
--bind-try /usr/share/icons /usr/local/share/icons \
--bind-try /usr/share/fonts /usr/local/share/fonts \
@ -201,3 +206,5 @@ sudo -u $(who | awk '{print $1}' | head -n 1) bwrap --dev-bind $chrootEnvPath/ /
--dev-bind /etc/resolv.conf /etc/resolv.conf \
--dev-bind /home /home \
locale-gen
chown -R $(who | awk '{print $1}' | head -n 1) $chrootEnvPath

View File

@ -1,10 +1,19 @@
#!/bin/bash
if [ ! -e /opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bookworm-env/finish.flag ];then
curdir=`realpath $0`
parent_dir=`dirname $curdir`
pparent_dir=`dirname $parent_dir`
ppparent_dir=`dirname $pparent_dir`
PKGNAME=`basename $ppparent_dir`
export PACKAGE_NAME=$PKGNAME
chrootEnvPath=/opt/apps/$PKGNAME/files/bookworm-env
if [ ! -e $chrootEnvPath/finish.flag ];then
if [ "$(id -u)" = "0" ]; then
/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bin/bookworm-init
`dirname $chrootEnvPath`/bin/bookworm-init
else
pkexec /opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bin/bookworm-init
pkexec `dirname $chrootEnvPath`/bin/bookworm-init
fi
@ -25,7 +34,7 @@ fi
done
fi
chrootEnvPath=/opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bookworm-env
non_root_user=$(who | awk '{print $1}' | head -n 1)
uid=$(id -u $non_root_user)
@ -49,7 +58,7 @@ bwrap --dev-bind $chrootEnvPath/ / \
--dev-bind /sys /sys \
--dev-bind /run /run \
--dev-bind /run/user/$uid/pulse /run/user/$uid/pulse \
--dev-bind / /run/host \
--dev-bind / /host \
--bind-try /usr/share/themes /usr/local/share/themes \
--bind-try /usr/share/icons /usr/local/share/icons \
--bind-try /usr/share/fonts /usr/local/share/fonts \

View File

@ -1,10 +0,0 @@
#!/bin/bash
if [ `which debootstrap` = "" ];then
echo "Need to install debootstrap!"
exit
fi
cd "`dirname $0`"
sudo debootstrap bookworm ./bookworm-env https://mirrors.ustc.edu.cn/debian/
tar -cJvf bookworm-env.tar.xz bookworm-env/*
sudo rm -rf bookworm-env

View File

@ -1,7 +1,7 @@
{
"appid": "cn.flamescion.bookworm-compatibility-mode",
"name": "cn.flamescion.bookworm-compatibility-mode",
"version": "12.1.1",
"version": "12.1.4",
"arch": ["amd64"],
"permissions": {
"autostart": true,