mirror of
https://gitee.com/spark-store-project/additional-base-lib
synced 2025-09-22 19:52:20 +08:00
Compare commits
20 Commits
abl-7-rele
...
master
Author | SHA1 | Date | |
---|---|---|---|
9cca9d7e7b | |||
|
aaedef8b83 | ||
|
22a319014d | ||
|
1b4bfd36c1 | ||
|
19297c6eef | ||
|
e9a5e11b52 | ||
|
f6087dacf6 | ||
|
28803b11b6 | ||
|
179cf44241 | ||
|
f0734f618a | ||
|
78459b003c | ||
|
045565b4b9 | ||
|
ff129705fc | ||
|
dc18f99a7b | ||
|
8da4a01eda | ||
|
3022d094eb | ||
|
c895d5fd5e | ||
|
ac2e3327dd | ||
|
c3411f2903 | ||
|
e631aa3c6f |
32
README.en.md
32
README.en.md
@ -1,6 +1,6 @@
|
|||||||
# Additional Base Lib
|
# Additional Base Lib
|
||||||
|
|
||||||
Solve the common compatible problem of glibc on GNU/Linux, by lightweight container utility bubblewrap. (Support distros based on debian)
|
Solve the common compatible problem of glibc on GNU/Linux, by lightweight container utility bubblewrap.
|
||||||
|
|
||||||
#### Introdution
|
#### Introdution
|
||||||
|
|
||||||
@ -10,27 +10,29 @@ That's because the application build with higher glibc then running. Someone cho
|
|||||||
|
|
||||||
#### License
|
#### License
|
||||||
|
|
||||||
There's no license restriction with scripts such as ablrun. All the library files are taken from some GNU/Linux distribution, their original license should followed.
|
There's no license restriction with scripts such as `ablrun`. All the library files are taken from some GNU/Linux distributions, their original license should followed.
|
||||||
|
|
||||||
#### Notes
|
#### Notes
|
||||||
|
|
||||||
1. Tested in deepin, but it's also able to run on other distro based on debian. And It's easy to port to other GNU/Linux platform.
|
1. You can install it onto many distributions with dpkg or rpm package management system. And It's easy to port to other GNU/Linux platform.
|
||||||
2. It use bwrap, as a result, some application may not run, such as ones use there own container or ones need to mount filesystem. But appimages will run, because I designed a special method to support.
|
2. Most applications can run with ablrun, but some needs privileges can't. If you found an application which should run but actually don't, please report.
|
||||||
3. Also include a single libstdc++ library with glibc, because this problem is as often as that with glibc.
|
3. Also include a single libstdc++ library with glibc, because this problem is as often as that with glibc.
|
||||||
4. You may use LD_LIBRARY_PATH environment variable with ablrun to search libraries in other directories, which may solve some other library problem.
|
4. The script can only solve glibc campatible problem, not all the problems to make your application run. You may use `LD_LIBRARY_PATH` environment variable with ablrun to search libraries in other directories, which may solve some other library problem.
|
||||||
|
|
||||||
|
|
||||||
#### Usage
|
#### Usage
|
||||||
|
|
||||||
Install additional-base-lib debian package first (You may download from the right side, Releases section.):
|
Install additional-base-lib package first. You may download from Releases section on the right side of the page.
|
||||||
|
If you use debian-based GNU/Linux distribution, install with this command:
|
||||||
`sudo apt install "path/to/package_name.deb"`
|
`sudo apt install "path/to/package_name.deb"`
|
||||||
|
If your distribution base on rpm, use package manage command provided by your distribution.
|
||||||
|
|
||||||
Then you can run command, that contains glibc problem, led by ablrun and a space:
|
Then you can run command which invokes glibc problem, led by ablrun and a space:
|
||||||
`ablrun [command [arguments ...]]`
|
`ablrun [command [arguments ...]]`
|
||||||
|
|
||||||
Uninstall:
|
When remove, You should also use package management.
|
||||||
|
If you use debian-based GNU/Linux distribution, install with this command:
|
||||||
`sudo apt remove additional-base-lib`
|
`sudo apt remove additional-base-lib`
|
||||||
|
If your distribution base on rpm, use package manage command provided by your distribution.
|
||||||
|
|
||||||
#### Resources
|
#### Resources
|
||||||
|
|
||||||
@ -40,9 +42,9 @@ https://bbs.deepin.org/post/256555
|
|||||||
Common solution for many library problem (in Chinese):
|
Common solution for many library problem (in Chinese):
|
||||||
https://bbs.deepin.org/post/256081
|
https://bbs.deepin.org/post/256081
|
||||||
|
|
||||||
A help for someone like to port this script to other GNU/Linux platform (in Chinese):
|
|
||||||
https://bbs.deepin.org/post/258721
|
|
||||||
|
|
||||||
#### Customize
|
#### Customize
|
||||||
If the released package cannot fit your needs (such as library version, architecture), you may try make-deb.sh to create your own additional base lib. Download the project, and edit the script, change 3 URLs for download packages to which you want. You may found many version and architectures from debian page: https://www.debian.org/distrib/packages , and then run the script make-deb.sh. It will auto-detect architecture of packages, and take corresponding methods.
|
If the released package cannot fit your needs (such as library version, architecture), for deb package, you may try `make-deb.sh` to create your own additional base lib. Download the project, and edit the script, change 3 package download URLs to which you want. You may found many version and architectures from debian page: https://www.debian.org/distrib/packages , and then run the script `make-deb.sh`. It will auto-detect architecture of packages, and take corresponding methods.
|
||||||
dependence: bash, coreutils, dpkg, dpkg-dev, grep, wget, patchelf
|
Install these packages first: bash, coreutils, dpkg, dpkg-dev, grep, wget, patchelf
|
||||||
|
|
||||||
|
For rpm package, you need `make-rpm.sh`. Download the project, and edit the script, change 3 package download URLs to which you want. You may found many versions and architectures from fedora page: https://packages.fedoraproject.org/ , and then run the script `make-rpm.sh`. It will auto-detect architecture of packages, and take corresponding methods. Rpm package will store to `~/rpmbuild/RPMS` directory.
|
||||||
|
Install these packages first: bash, coreutils, rpm-build, wget, patchelf
|
||||||
|
31
README.md
31
README.md
@ -1,6 +1,9 @@
|
|||||||
# Additional Base Lib 附加基础库
|
# Additional Base Lib 附加基础库
|
||||||
|
|
||||||
用轻量级容器工具bubblewrap解决GNU/Linux操作系统中常见的glibc不兼容问题。(暂时只支持debian系)
|
用轻量级容器工具bubblewrap解决GNU/Linux操作系统中常见的glibc不兼容问题。
|
||||||
|
|
||||||
|
|因为一些原因我不能继续更新这个程序。可以阅读[这篇文章了解ABL的原理和设计细节](https://bbs.deepin.org/zh/post/282284)。|
|
||||||
|
|-|
|
||||||
|
|
||||||
#### 概述
|
#### 概述
|
||||||
|
|
||||||
@ -10,25 +13,29 @@
|
|||||||
|
|
||||||
#### 许可
|
#### 许可
|
||||||
|
|
||||||
ablrun等脚本文件没有许可证限制。附带的glibc等动态库文件都是取自一些GNU/Linux发行版的,请遵守相应的许可。
|
`ablrun`等脚本文件没有许可证限制。附带的glibc等动态库文件都是取自一些GNU/Linux发行版的,请遵守相应的许可。
|
||||||
|
|
||||||
#### 注意事项
|
#### 注意事项
|
||||||
|
|
||||||
1. 只在deepin测试过,但应该能在所有debian系发行版上运行。移植到其他发行版平台也很容易。
|
1. 软件包可以安装在使用dpkg或rpm的发行版上。移植到其他发行版平台也很容易。
|
||||||
2. 由于使用了bwrap容器环境,因此有些程序不能运行的,比如说在程序内部使用了容器技术或者需要挂载文件系统的程序就不行。appimage是例外,因为我专门设计了单独的方案去运行他。
|
2. 大多数应用都能运行,但是一些需要权限的不可以。如果你发现了应该可以但实际上不能运行的应用,请向我报告。
|
||||||
3. 在glibc之外还打包了一个libstdc++的动态库,因为这个问题也比较常见。
|
3. 在glibc之外还打包了一个libstdc++的动态库,因为这个问题也比较常见。
|
||||||
4. 你可以在使用ablrun的同时使用LD_LIBRARY_PATH环境变量改变动态库寻找的位置,解决一些其他动态库问题。
|
4. 这个脚本只关注解决glibc的兼容问题,因此很多时候你还需要解决一些其他的动态库问题才能让应用运行。你可以在使用ablrun的同时使用`LD_LIBRARY_PATH`环境变量改变动态库寻找的位置,解决一些其他动态库问题。
|
||||||
|
|
||||||
#### 用法
|
#### 用法
|
||||||
|
|
||||||
首先需要安装additional-base-lib的debian包(请在右侧发行版处下载):
|
首先需要安装additional-base-lib的软件包,可以在右侧发行版处下载。
|
||||||
|
如果你使用的是debian衍生版,使用这个命令安装:
|
||||||
`sudo apt install "path/to/package_name.deb"`
|
`sudo apt install "path/to/package_name.deb"`
|
||||||
|
基于rpm的发行版,请使用相应的包管理命令。
|
||||||
|
|
||||||
此后只需要在出现glibc问题的命令前面,加上ablrun和空格即可:
|
此后只需要在出现glibc问题的命令前面,加上ablrun和空格即可:
|
||||||
`ablrun [命令 [运行选项 ...]]`
|
`ablrun [命令 [运行选项 ...]]`
|
||||||
|
|
||||||
卸载:
|
卸载也需要通过系统的包管理器。
|
||||||
|
如果使用的是debian衍生版,使用这个命令卸载:
|
||||||
`sudo apt remove additional-base-lib`
|
`sudo apt remove additional-base-lib`
|
||||||
|
基于rpm的发行版,请使用相应的包管理命令。
|
||||||
|
|
||||||
#### 其他资源
|
#### 其他资源
|
||||||
|
|
||||||
@ -38,9 +45,9 @@ https://bbs.deepin.org/post/256555
|
|||||||
解决动态库问题的通用解决方法:
|
解决动态库问题的通用解决方法:
|
||||||
https://bbs.deepin.org/post/256081
|
https://bbs.deepin.org/post/256081
|
||||||
|
|
||||||
想要移植程序到其他系统或平台的,可以参考:
|
|
||||||
https://bbs.deepin.org/post/258721
|
|
||||||
|
|
||||||
#### 定制
|
#### 定制
|
||||||
如果这里发布的deb包不符合你的要求(库版本、架构),你可以使用make-deb.sh创造你自己的附加基础库。你需要将项目下载到本地,然后编辑这个脚本,把三个包的下载链接改成你想要的即可。你可以在debian的网站找到各种版本和架构的下载链接:https://www.debian.org/distrib/packages ,然后在当前目录中执行make-deb.sh即可。他会自动识别软件包的架构并采取相应方案。
|
如果这里发布的deb包不符合你的要求(库版本、架构),你可以使用`make-deb.sh`创造你自己的附加基础库。你需要将项目下载到本地,然后编辑这个脚本,把三个包的下载链接改成你想要的即可。你可以在debian的网站找到各种版本和架构的下载链接:https://www.debian.org/distrib/packages ,然后在当前目录中执行`make-deb.sh`即可。他会自动识别软件包的架构并采取相应方案。
|
||||||
需要依赖:bash, coreutils, dpkg, dpkg-dev, grep, wget, patchelf
|
在这之前,你需要安装以下软件包:bash, coreutils, dpkg, dpkg-dev, grep, wget, patchelf
|
||||||
|
|
||||||
|
对于rpm包,你可以使用`make-rpm.sh`,你需要将项目下载到本地,然后编辑这个脚本,把三个包的下载链接改成你想要的即可。你可以在fedora的网站找到各种版本和架构的下载链接:https://packages.fedoraproject.org/ ,然后在当前目录中执行`make-rpm.sh`即可。他会自动识别软件包的架构并采取相应方案。rpm包会存储在`~/rpmbuild/RPMS`中。
|
||||||
|
在这之前,你需要安装以下软件包:bash, coreutils, rpm-build, wget, patchelf
|
||||||
|
20
bubblewrap-ln-flatpak.spec
Normal file
20
bubblewrap-ln-flatpak.spec
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
Name: bubblewrap-ln-flatpak
|
||||||
|
Version: 1
|
||||||
|
Release: 1
|
||||||
|
Summary: use flatpak-bwrap instead bwrap (for CentOS 7)
|
||||||
|
BuildArch: noarch
|
||||||
|
License: None
|
||||||
|
Requires: flatpak
|
||||||
|
Provides: bubblewrap
|
||||||
|
%description
|
||||||
|
use flatpak-bwrap instead bwrap (for CentOS 7)
|
||||||
|
|
||||||
|
%install
|
||||||
|
mkdir %{buildroot}/usr
|
||||||
|
mkdir %{buildroot}/usr/bin
|
||||||
|
ln -s /usr/libexec/flatpak-bwrap %{buildroot}/usr/bin/bwrap
|
||||||
|
|
||||||
|
%files
|
||||||
|
/usr/bin/bwrap
|
||||||
|
|
||||||
|
|
83
make-deb.sh
83
make-deb.sh
@ -1,10 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
LIBC6_DOWNLOAD_URL=http://ftp.cn.debian.org/debian/pool/main/g/glibc/libc6_2.36-9+deb12u1_amd64.deb
|
LIBC6_DOWNLOAD_URL=http://mirrors.ustc.edu.cn/debian/pool/main/g/glibc/libc6_2.38-13_amd64.deb
|
||||||
LIBC_BIN_DOWNLOAD_URL=http://ftp.cn.debian.org/debian/pool/main/g/glibc/libc-bin_2.36-9+deb12u1_amd64.deb
|
LIBC_BIN_DOWNLOAD_URL=http://mirrors.ustc.edu.cn/debian/pool/main/g/glibc/libc-bin_2.38-13_amd64.deb
|
||||||
LIBSTDCxx6_DOWNLOAD_URL=http://ftp.cn.debian.org/debian/pool/main/g/gcc-12/libstdc++6_12.2.0-14_amd64.deb
|
LIBSTDCxx6_DOWNLOAD_URL=http://mirrors.ustc.edu.cn/debian/pool/main/g/gcc-14/libstdc++6_14-20240330-1_amd64.deb
|
||||||
|
|
||||||
ABL_VERSION=7
|
ABL_VERSION=9
|
||||||
|
|
||||||
check(){
|
check(){
|
||||||
if [ "$1" != 0 ]
|
if [ "$1" != 0 ]
|
||||||
@ -99,8 +99,18 @@ check $?
|
|||||||
DEBIAN_MULTIARCH=${DEBIAN_MULTIARCH:21}
|
DEBIAN_MULTIARCH=${DEBIAN_MULTIARCH:21}
|
||||||
echo "$DEBIAN_MULTIARCH"
|
echo "$DEBIAN_MULTIARCH"
|
||||||
|
|
||||||
|
echo "check usrmerge status:":
|
||||||
|
if [ -d "./downloads/libc6/lib" ]
|
||||||
|
then
|
||||||
|
LIBC_LIB_DIR=""
|
||||||
|
echo "not usrmerge"
|
||||||
|
else
|
||||||
|
LIBC_LIB_DIR="usr/"
|
||||||
|
echo "usrmerge"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "ld.so location:"
|
echo "ld.so location:"
|
||||||
LD_SO_LOCATION=`patchelf --print-interpreter "./downloads/libc6/lib/${DEBIAN_MULTIARCH}/libc.so.6"`
|
LD_SO_LOCATION=`patchelf --print-interpreter "./downloads/libc6/${LIBC_LIB_DIR}lib/${DEBIAN_MULTIARCH}/libc.so.6"`
|
||||||
check $?
|
check $?
|
||||||
echo "$LD_SO_LOCATION"
|
echo "$LD_SO_LOCATION"
|
||||||
|
|
||||||
@ -113,39 +123,14 @@ mkdir ./deb-contents/usr/bin
|
|||||||
mkdir ./deb-contents/usr/lib
|
mkdir ./deb-contents/usr/lib
|
||||||
mkdir "./deb-contents/usr/lib/$DEBIAN_MULTIARCH"
|
mkdir "./deb-contents/usr/lib/$DEBIAN_MULTIARCH"
|
||||||
|
|
||||||
echo
|
|
||||||
echo "create control file..."
|
|
||||||
echo "Package: additional-base-lib" >> ./deb-contents/DEBIAN/control
|
|
||||||
echo "Version: $GLIBC_VERSION-$ABL_VERSION" >> ./deb-contents/DEBIAN/control
|
|
||||||
echo "Section: utils" >> ./deb-contents/DEBIAN/control
|
|
||||||
echo "Priority: optional" >> ./deb-contents/DEBIAN/control
|
|
||||||
echo "Architecture: $DEBIAN_DEB_ARCH" >> ./deb-contents/DEBIAN/control
|
|
||||||
echo "Maintainer: CongTianKong (gitee.com/CongTianKong)" >> ./deb-contents/DEBIAN/control
|
|
||||||
echo "Depends: bubblewrap, bash, coreutils, shared-mime-info, xdg-utils" >> ./deb-contents/DEBIAN/control
|
|
||||||
echo "Description: A script to run programs with newer libc." >> ./deb-contents/DEBIAN/control
|
|
||||||
echo " package built with make-deb.sh from additional-base-lib project." >> ./deb-contents/DEBIAN/control
|
|
||||||
echo " libc6 download URL: $LIBC6_DOWNLOAD_URL" >> ./deb-contents/DEBIAN/control
|
|
||||||
echo " libc-bin download URL: $LIBC_BIN_DOWNLOAD_URL" >> ./deb-contents/DEBIAN/control
|
|
||||||
echo " libstdc++6 download URL: $LIBSTDCxx6_DOWNLOAD_URL" >> ./deb-contents/DEBIAN/control
|
|
||||||
|
|
||||||
echo >> ./deb-contents/DEBIAN/control
|
|
||||||
check $?
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "gather files:"
|
echo "gather files:"
|
||||||
echo "copy ablrun script..."
|
|
||||||
cp ./scripts/ablrun ./deb-contents/usr/bin/ablrun
|
|
||||||
check $?
|
|
||||||
|
|
||||||
echo "copy ablrun-appimage script..."
|
echo "generate ablrun script..."
|
||||||
cp ./scripts/ablrun-appimage ./deb-contents/usr/bin/ablrun-appimage
|
echo "#!/bin/bash" > ./deb-contents/usr/bin/ablrun
|
||||||
check $?
|
echo "ABL_TARGET_LD_SO_PATH=$LD_SO_LOCATION" >> ./deb-contents/usr/bin/ablrun
|
||||||
|
echo "ABL_DIR_PREFIX=lib/$DEBIAN_MULTIARCH" >> ./deb-contents/usr/bin/ablrun
|
||||||
echo "generate ablrun-normal script..."
|
cat ./scripts/ablrun_part >> ./deb-contents/usr/bin/ablrun
|
||||||
echo "#!/bin/bash" > ./deb-contents/usr/bin/ablrun-normal
|
|
||||||
echo "ABL_TARGET_LD_SO_PATH=$LD_SO_LOCATION" >> ./deb-contents/usr/bin/ablrun-normal
|
|
||||||
echo "ABL_DIR_PREFIX=lib/$DEBIAN_MULTIARCH" >> ./deb-contents/usr/bin/ablrun-normal
|
|
||||||
cat ./scripts/ablrun-normal_part >> ./deb-contents/usr/bin/ablrun-normal
|
|
||||||
check $?
|
check $?
|
||||||
|
|
||||||
echo "chmod..."
|
echo "chmod..."
|
||||||
@ -169,13 +154,13 @@ rooted_readlink(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo "copy many libc6 components..."
|
echo "copy many libc6 components..."
|
||||||
cp -r "./downloads/libc6/lib/${DEBIAN_MULTIARCH}/" "./deb-contents/usr/lib/${DEBIAN_MULTIARCH}/additional-base-lib"
|
cp -r "./downloads/libc6/${LIBC_LIB_DIR}lib/${DEBIAN_MULTIARCH}/" "./deb-contents/usr/lib/${DEBIAN_MULTIARCH}/additional-base-lib"
|
||||||
check $?
|
check $?
|
||||||
|
|
||||||
echo "copy ld.so..."
|
echo "copy ld.so..."
|
||||||
mkdir --parents "./deb-contents/usr/lib/${DEBIAN_MULTIARCH}/additional-base-lib/$LD_SO_LOCATION"
|
mkdir --parents "./deb-contents/usr/lib/${DEBIAN_MULTIARCH}/additional-base-lib/$LD_SO_LOCATION"
|
||||||
rm -d "./deb-contents/usr/lib/${DEBIAN_MULTIARCH}/additional-base-lib/$LD_SO_LOCATION"
|
rm -d "./deb-contents/usr/lib/${DEBIAN_MULTIARCH}/additional-base-lib/$LD_SO_LOCATION"
|
||||||
cp `rooted_readlink "./downloads/libc6/$LD_SO_LOCATION" "./downloads/libc6"` "./deb-contents/usr/lib/${DEBIAN_MULTIARCH}/additional-base-lib/$LD_SO_LOCATION"
|
cp `rooted_readlink "./downloads/libc6/${LIBC_LIB_DIR}${LD_SO_LOCATION}" "./downloads/libc6"` "./deb-contents/usr/lib/${DEBIAN_MULTIARCH}/additional-base-lib/$LD_SO_LOCATION"
|
||||||
check $?
|
check $?
|
||||||
|
|
||||||
echo "copy ldd script..."
|
echo "copy ldd script..."
|
||||||
@ -186,6 +171,30 @@ echo "copy libstdc++..."
|
|||||||
cp `rooted_readlink ./downloads/libstdc++6/usr/lib/${DEBIAN_MULTIARCH}/libstdc++.so.6 ./downloads/libstdc++6/` "./deb-contents/usr/lib/${DEBIAN_MULTIARCH}/additional-base-lib/libstdc++.so.6"
|
cp `rooted_readlink ./downloads/libstdc++6/usr/lib/${DEBIAN_MULTIARCH}/libstdc++.so.6 ./downloads/libstdc++6/` "./deb-contents/usr/lib/${DEBIAN_MULTIARCH}/additional-base-lib/libstdc++.so.6"
|
||||||
check $?
|
check $?
|
||||||
|
|
||||||
|
echo "calculate file size..."
|
||||||
|
DEB_INSTALL_SIZE=(`du -s ./deb-contents/`)
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "create control file..."
|
||||||
|
echo "Package: additional-base-lib" > ./deb-contents/DEBIAN/control
|
||||||
|
echo "Version: $GLIBC_VERSION-$ABL_VERSION" >> ./deb-contents/DEBIAN/control
|
||||||
|
echo "Section: utils" >> ./deb-contents/DEBIAN/control
|
||||||
|
echo "Priority: optional" >> ./deb-contents/DEBIAN/control
|
||||||
|
echo "Installed-Size: ${DEB_INSTALL_SIZE[@]:0:1}" >> ./deb-contents/DEBIAN/control
|
||||||
|
echo "Architecture: $DEBIAN_DEB_ARCH" >> ./deb-contents/DEBIAN/control
|
||||||
|
echo "Maintainer: CongTianKong" >> ./deb-contents/DEBIAN/control
|
||||||
|
echo "Depends: bubblewrap, bash, coreutils" >> ./deb-contents/DEBIAN/control
|
||||||
|
echo "Suggests: shared-mime-info, xdg-utils" >> ./deb-contents/DEBIAN/control
|
||||||
|
echo "Homepage: https://gitee.com/deepin-community-store/additional-base-lib" >> ./deb-contents/DEBIAN/control
|
||||||
|
echo "Description: A script to run programs with newer libc." >> ./deb-contents/DEBIAN/control
|
||||||
|
echo " package built with make-deb.sh from additional-base-lib project." >> ./deb-contents/DEBIAN/control
|
||||||
|
echo " libc6 download URL: $LIBC6_DOWNLOAD_URL" >> ./deb-contents/DEBIAN/control
|
||||||
|
echo " libc-bin download URL: $LIBC_BIN_DOWNLOAD_URL" >> ./deb-contents/DEBIAN/control
|
||||||
|
echo " libstdc++6 download URL: $LIBSTDCxx6_DOWNLOAD_URL" >> ./deb-contents/DEBIAN/control
|
||||||
|
|
||||||
|
echo >> ./deb-contents/DEBIAN/control
|
||||||
|
check $?
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "build deb package:"
|
echo "build deb package:"
|
||||||
dpkg-deb -Zgzip -b ./deb-contents "./additional-base-lib_${GLIBC_VERSION}-${ABL_VERSION}_${DEBIAN_DEB_ARCH}.deb"
|
dpkg-deb -Zgzip -b ./deb-contents "./additional-base-lib_${GLIBC_VERSION}-${ABL_VERSION}_${DEBIAN_DEB_ARCH}.deb"
|
||||||
|
40
make-rpm.sh
40
make-rpm.sh
@ -1,10 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
GLIBC_DOWNLOAD_URL=https://kojipkgs.fedoraproject.org//packages/glibc/2.38/1.fc39/x86_64/glibc-2.38-1.fc39.x86_64.rpm
|
GLIBC_DOWNLOAD_URL=https://kojipkgs.fedoraproject.org//packages/glibc/2.39/8.fc40/x86_64/glibc-2.39-8.fc40.x86_64.rpm
|
||||||
GLIBC_COMMON_DOWNLOAD_URL=https://kojipkgs.fedoraproject.org//packages/glibc/2.38/1.fc39/x86_64/glibc-common-2.38-1.fc39.x86_64.rpm
|
GLIBC_COMMON_DOWNLOAD_URL=https://kojipkgs.fedoraproject.org//packages/glibc/2.39/8.fc40/x86_64/glibc-common-2.39-8.fc40.x86_64.rpm
|
||||||
LIBSTDCxx_DOWNLOAD_URL=https://kojipkgs.fedoraproject.org//packages/gcc/13.2.1/1.fc39/x86_64/libstdc++-13.2.1-1.fc39.x86_64.rpm
|
LIBSTDCxx_DOWNLOAD_URL=https://kojipkgs.fedoraproject.org//packages/gcc/14.0.1/0.15.fc40/x86_64/libstdc++-14.0.1-0.15.fc40.x86_64.rpm
|
||||||
|
|
||||||
ABL_VERSION=7
|
ABL_VERSION=9
|
||||||
|
ABL_RPM_RELEASE=1
|
||||||
|
|
||||||
check(){
|
check(){
|
||||||
if [ "$1" != 0 ]
|
if [ "$1" != 0 ]
|
||||||
@ -132,13 +133,14 @@ echo "%global _binary_payload w9.gzdio" >> ~/rpmbuild/SPECS/additional-base-lib.
|
|||||||
# use gzip to compress for compatibility.
|
# use gzip to compress for compatibility.
|
||||||
echo "Name: additional-base-lib" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
echo "Name: additional-base-lib" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||||
echo "Version: $GLIBC_VERSION.$GLIBC_RELEASE.$ABL_VERSION" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
echo "Version: $GLIBC_VERSION.$GLIBC_RELEASE.$ABL_VERSION" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||||
echo "Release: 1" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
echo "Release: $ABL_RPM_RELEASE" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||||
echo "Summary: A script to run programs with newer libc." >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
echo "Summary: A script to run programs with newer libc." >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||||
echo "License: Mix" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
echo "License: Mix" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||||
echo "URL: https://gitee.com/deepin-community-store/additional-base-lib" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
echo "URL: https://gitee.com/deepin-community-store/additional-base-lib" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||||
#echo "BuildArch: $GLIBC_ARCH" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
#echo "BuildArch: $GLIBC_ARCH" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||||
# we don't use this field, pass --target to rpmbuild is enough.
|
# we don't use this field, pass --target to rpmbuild is enough.
|
||||||
echo "Requires: bubblewrap, bash, coreutils, shared-mime-info, xdg-utils" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
echo "Requires: bubblewrap, bash, coreutils" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||||
|
echo "Suggests: shared-mime-info, xdg-utils" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||||
echo "" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
echo "" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||||
echo "%install" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
echo "%install" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||||
echo "cp -r ./abl-rpm/* %{buildroot}" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
echo "cp -r ./abl-rpm/* %{buildroot}" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||||
@ -154,8 +156,6 @@ echo "%files" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
|||||||
echo "%dir /usr/$SYSTEM_LIBRARY_DIR/additional-base-lib" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
echo "%dir /usr/$SYSTEM_LIBRARY_DIR/additional-base-lib" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||||
echo "/usr/$SYSTEM_LIBRARY_DIR/additional-base-lib/*" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
echo "/usr/$SYSTEM_LIBRARY_DIR/additional-base-lib/*" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||||
echo "/usr/bin/ablrun" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
echo "/usr/bin/ablrun" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||||
echo "/usr/bin/ablrun-appimage" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
|
||||||
echo "/usr/bin/ablrun-normal" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
|
||||||
check $?
|
check $?
|
||||||
|
|
||||||
echo
|
echo
|
||||||
@ -167,28 +167,16 @@ mkdir ~/rpmbuild/BUILD/abl-rpm/usr/bin
|
|||||||
|
|
||||||
echo
|
echo
|
||||||
echo "gather files:"
|
echo "gather files:"
|
||||||
echo "copy ablrun script..."
|
echo "generate ablrun script..."
|
||||||
cp ./scripts/ablrun ~/rpmbuild/BUILD/abl-rpm/usr/bin/ablrun
|
echo "#!/bin/bash" > ~/rpmbuild/BUILD/abl-rpm/usr/bin/ablrun
|
||||||
check $?
|
echo "ABL_TARGET_LD_SO_PATH=$LD_SO_LOCATION" >> ~/rpmbuild/BUILD/abl-rpm/usr/bin/ablrun
|
||||||
|
echo "ABL_DIR_PREFIX=$SYSTEM_LIBRARY_DIR" >> ~/rpmbuild/BUILD/abl-rpm/usr/bin/ablrun
|
||||||
echo "copy ablrun-appimage script..."
|
cat ./scripts/ablrun_part >> ~/rpmbuild/BUILD/abl-rpm/usr/bin/ablrun
|
||||||
cp ./scripts/ablrun-appimage ~/rpmbuild/BUILD/abl-rpm/usr/bin/ablrun-appimage
|
|
||||||
check $?
|
|
||||||
|
|
||||||
echo "generate ablrun-normal script..."
|
|
||||||
echo "#!/bin/bash" > ~/rpmbuild/BUILD/abl-rpm/usr/bin/ablrun-normal
|
|
||||||
echo "ABL_TARGET_LD_SO_PATH=$LD_SO_LOCATION" >> ~/rpmbuild/BUILD/abl-rpm/usr/bin/ablrun-normal
|
|
||||||
echo "ABL_DIR_PREFIX=$SYSTEM_LIBRARY_DIR" >> ~/rpmbuild/BUILD/abl-rpm/usr/bin/ablrun-normal
|
|
||||||
cat ./scripts/ablrun-normal_part >> ~/rpmbuild/BUILD/abl-rpm/usr/bin/ablrun-normal
|
|
||||||
check $?
|
check $?
|
||||||
|
|
||||||
echo "chmod..."
|
echo "chmod..."
|
||||||
chmod a+x ~/rpmbuild/BUILD/abl-rpm/usr/bin/ablrun
|
chmod a+x ~/rpmbuild/BUILD/abl-rpm/usr/bin/ablrun
|
||||||
check $?
|
check $?
|
||||||
chmod a+x ~/rpmbuild/BUILD/abl-rpm/usr/bin/ablrun-appimage
|
|
||||||
check $?
|
|
||||||
chmod a+x ~/rpmbuild/BUILD/abl-rpm/usr/bin/ablrun-normal
|
|
||||||
check $?
|
|
||||||
|
|
||||||
rooted_readlink(){
|
rooted_readlink(){
|
||||||
rrl_result=$1
|
rrl_result=$1
|
||||||
@ -231,6 +219,6 @@ check $?
|
|||||||
|
|
||||||
echo
|
echo
|
||||||
echo "complete with no error!"
|
echo "complete with no error!"
|
||||||
echo "RPM package may locate in ~/rpmbuild/RPM"
|
echo "RPM package may locate in ~/rpmbuild/RPMS"
|
||||||
echo "You may clean ~/rpmbuild/BUILD and ./downloads for a new start."
|
echo "You may clean ~/rpmbuild/BUILD and ./downloads for a new start."
|
||||||
|
|
||||||
|
@ -1,50 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ "$*" = "" ]
|
|
||||||
then
|
|
||||||
echo "usage: $0 [command [arguments ...]]"
|
|
||||||
echo " The script is part of additional-base-lib. The package provides a"
|
|
||||||
echo " simple way to solve the compatible problem between application and"
|
|
||||||
echo " glibc, powered by bubblewrap."
|
|
||||||
echo
|
|
||||||
echo " All the library files, which packed with additional-base-lib,"
|
|
||||||
echo " are taken from one GNU/Linux distribution. You may found information"
|
|
||||||
echo " in package control files. The scripts theirselves were created by"
|
|
||||||
echo " CongTianKong <https://gitee.com/CongTianKong>. There's no lisence"
|
|
||||||
echo " nor copyright restriction with The script. Feel free to deal with."
|
|
||||||
echo
|
|
||||||
echo " This script auto-detects normal executable and appimage, and then"
|
|
||||||
echo " uses specified script to run either. If you experienced issues,"
|
|
||||||
echo " you may want to use them directly."
|
|
||||||
echo " for appimage, you need ablrun-appimage."
|
|
||||||
echo " for normal executable, you need ablrun-normal."
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ `whoami` = "root" ]
|
|
||||||
then
|
|
||||||
exec ablrun-normal "$@"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -e "$1" ]
|
|
||||||
then
|
|
||||||
ABL_FILENAME="$1"
|
|
||||||
else
|
|
||||||
ABL_FILENAME=`which $1`
|
|
||||||
if [ "$?" != "0" ]
|
|
||||||
then
|
|
||||||
echo "File not exists."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
ABL_FILETYPE=`xdg-mime query filetype "$ABL_FILENAME"`
|
|
||||||
if [ "$ABL_FILETYPE" != "application/vnd.appimage" ]
|
|
||||||
then
|
|
||||||
if [ "$ABL_FILETYPE" != "application/x-iso9660-appimage" ]
|
|
||||||
then
|
|
||||||
exec ablrun-normal "$@"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec ablrun-appimage "$@"
|
|
@ -1,42 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ "$*" = "" ]
|
|
||||||
then
|
|
||||||
echo "usage: $0 [appimage-file [arguments ...]]"
|
|
||||||
echo " This is helper script to run appimages for additional-base-lib."
|
|
||||||
echo
|
|
||||||
echo " You have to ensure input file IS an appimage, for this script"
|
|
||||||
echo " does not check. If you input other files, It will become"
|
|
||||||
echo " unpredictable."
|
|
||||||
echo
|
|
||||||
echo " There is a more convenient script to handle both normal executable"
|
|
||||||
echo " and appimage, called ablrun."
|
|
||||||
echo " usage: ablrun [command [arguments ...]]"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
ABLIMAGE_PARAMETERS=("$@")
|
|
||||||
|
|
||||||
coproc "$1" --appimage-mount
|
|
||||||
|
|
||||||
ABLIMAGE_PID=$!
|
|
||||||
|
|
||||||
cleanup() {
|
|
||||||
kill $ABLIMAGE_PID
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
trap cleanup SIGHUP
|
|
||||||
trap cleanup SIGINT
|
|
||||||
trap cleanup SIGTERM
|
|
||||||
|
|
||||||
if [ ! -e /proc/$! ]
|
|
||||||
then
|
|
||||||
echo "Child process failed."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
read -u ${COPROC[0]} ABLIMAGE_DIR
|
|
||||||
|
|
||||||
ablrun-normal "$ABLIMAGE_DIR/AppRun" ${ABLIMAGE_PARAMETERS[@]:1}
|
|
||||||
|
|
||||||
cleanup
|
|
@ -1,41 +0,0 @@
|
|||||||
#some content, such as ABL_DIR_PREFIX, ABL_TARGET_LD_SO_PATH, is generated when building the package
|
|
||||||
|
|
||||||
if [ "$*" = "" ]
|
|
||||||
then
|
|
||||||
echo "usage: $0 [command [arguments ...]]"
|
|
||||||
echo " The script is part of additional-base-lib. The package provides a"
|
|
||||||
echo " simple way to solve the compatible problem between application and"
|
|
||||||
echo " glibc, powered by bubblewrap."
|
|
||||||
echo
|
|
||||||
echo " All the library files, which packed with additional-base-lib,"
|
|
||||||
echo " are taken from one GNU/Linux distribution. You may found information"
|
|
||||||
echo " in package control files. The scripts theirselves were created by"
|
|
||||||
echo " CongTianKong <https://gitee.com/CongTianKong>. There's no lisence"
|
|
||||||
echo " nor copyright restriction with The script. Feel free to deal with."
|
|
||||||
echo
|
|
||||||
echo " If you're going to run appimage with additional-base-lib, you may"
|
|
||||||
echo " need ablrun-appimage."
|
|
||||||
echo
|
|
||||||
echo " There is a more convenient script to handle both normal executable"
|
|
||||||
echo " and appimage, called ablrun."
|
|
||||||
echo " usage: ablrun [command [arguments ...]]"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
ABL_LD_SO_PATH=`readlink -e $ABL_TARGET_LD_SO_PATH`
|
|
||||||
ABL_LIBC_SO_PATH=`readlink -e /${ABL_DIR_PREFIX}/libc.so.6`
|
|
||||||
|
|
||||||
if [ "$LD_LIBRARY_PATH" = "" ]
|
|
||||||
then
|
|
||||||
ABL_LIBRARY_PATH="/usr/${ABL_DIR_PREFIX}/additional-base-lib/"
|
|
||||||
else
|
|
||||||
ABL_LIBRARY_PATH="$LD_LIBRARY_PATH;/usr/${ABL_DIR_PREFIX}/additional-base-lib"
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec bwrap \
|
|
||||||
--dev-bind / / \
|
|
||||||
--bind /usr/${ABL_DIR_PREFIX}/additional-base-lib/"$ABL_TARGET_LD_SO_PATH" "$ABL_LD_SO_PATH" \
|
|
||||||
--bind /usr/${ABL_DIR_PREFIX}/additional-base-lib/libc.so.6 "$ABL_LIBC_SO_PATH" \
|
|
||||||
--bind /usr/${ABL_DIR_PREFIX}/additional-base-lib/ldd /usr/bin/ldd \
|
|
||||||
--setenv LD_LIBRARY_PATH "$ABL_LIBRARY_PATH" \
|
|
||||||
-- "$@"
|
|
154
scripts/ablrun_part
Executable file
154
scripts/ablrun_part
Executable file
@ -0,0 +1,154 @@
|
|||||||
|
# some content, such as ABL_DIR_PREFIX, ABL_TARGET_LD_SO_PATH, is generated when building the package
|
||||||
|
|
||||||
|
if [ "$*" = "" ]
|
||||||
|
then
|
||||||
|
echo "usage: $0 [command [arguments ...]]"
|
||||||
|
echo " The script is part of additional-base-lib. The package provides a"
|
||||||
|
echo " simple way to solve the compatible problem between application and"
|
||||||
|
echo " glibc, powered by bubblewrap."
|
||||||
|
echo
|
||||||
|
echo " All the library files, which packed with additional-base-lib,"
|
||||||
|
echo " are taken from one GNU/Linux distribution. You may found message"
|
||||||
|
echo " from package information. The script ablrun was created by"
|
||||||
|
echo " CongTianKong <https://gitee.com/CongTianKong>. There's no lisence"
|
||||||
|
echo " nor copyright restriction with The script. Feel free to deal with."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$LD_LIBRARY_PATH" = "" ]
|
||||||
|
then
|
||||||
|
ABL_LIBRARY_PATH="/usr/${ABL_DIR_PREFIX}/additional-base-lib/"
|
||||||
|
else
|
||||||
|
ABL_LIBRARY_PATH="$LD_LIBRARY_PATH;/usr/${ABL_DIR_PREFIX}/additional-base-lib"
|
||||||
|
fi
|
||||||
|
|
||||||
|
unset LD_LIBRARY_PATH
|
||||||
|
|
||||||
|
ABL_LD_SO_PATH=`readlink -e $ABL_TARGET_LD_SO_PATH`
|
||||||
|
ABL_LIBC_SO_PATH=`readlink -e /${ABL_DIR_PREFIX}/libc.so.6`
|
||||||
|
|
||||||
|
ABL_BWRAP_SETUID=`which bwrap`
|
||||||
|
ABL_BWRAP_SETUID=`readlink -e "$ABL_BWRAP_SETUID"`
|
||||||
|
ABL_BWRAP_SETUID=`ls -l "$ABL_BWRAP_SETUID"`
|
||||||
|
ABL_BWRAP_SETUID="${ABL_BWRAP_SETUID:3:1}"
|
||||||
|
|
||||||
|
ABL_MAX_USER_NS=`cat /proc/sys/user/max_user_namespaces`
|
||||||
|
|
||||||
|
ablrun_normal() {
|
||||||
|
exec bwrap \
|
||||||
|
--dev-bind / / \
|
||||||
|
--bind /usr/${ABL_DIR_PREFIX}/additional-base-lib/"$ABL_TARGET_LD_SO_PATH" "$ABL_LD_SO_PATH" \
|
||||||
|
--bind /usr/${ABL_DIR_PREFIX}/additional-base-lib/libc.so.6 "$ABL_LIBC_SO_PATH" \
|
||||||
|
--bind /usr/${ABL_DIR_PREFIX}/additional-base-lib/ldd /usr/bin/ldd \
|
||||||
|
--setenv LD_LIBRARY_PATH "$ABL_LIBRARY_PATH" \
|
||||||
|
--cap-add CAP_SYS_ADMIN \
|
||||||
|
-- "$@"
|
||||||
|
# Bwrap not installed setuid for most modern GNU/Linux system, use this easiest method.
|
||||||
|
}
|
||||||
|
|
||||||
|
ablrun_setuid() {
|
||||||
|
exec bwrap --dev-bind / / bwrap \
|
||||||
|
--dev-bind / / \
|
||||||
|
--bind /usr/${ABL_DIR_PREFIX}/additional-base-lib/"$ABL_TARGET_LD_SO_PATH" "$ABL_LD_SO_PATH" \
|
||||||
|
--bind /usr/${ABL_DIR_PREFIX}/additional-base-lib/libc.so.6 "$ABL_LIBC_SO_PATH" \
|
||||||
|
--bind /usr/${ABL_DIR_PREFIX}/additional-base-lib/ldd /usr/bin/ldd \
|
||||||
|
--setenv LD_LIBRARY_PATH "$ABL_LIBRARY_PATH" \
|
||||||
|
--cap-add CAP_SYS_ADMIN \
|
||||||
|
-- "$@"
|
||||||
|
# Bwrap installed setuid is for older kernel which does not allow user namespace.
|
||||||
|
# But in some GNU/Linux system there will still be setuid bwrap with updated kernel.
|
||||||
|
# Here is a simple trick to make a setuid bwrap not setuid, by nest it with another bwrap.
|
||||||
|
}
|
||||||
|
|
||||||
|
ablrun_nocap() {
|
||||||
|
exec bwrap \
|
||||||
|
--dev-bind / / \
|
||||||
|
--bind /usr/${ABL_DIR_PREFIX}/additional-base-lib/"$ABL_TARGET_LD_SO_PATH" "$ABL_LD_SO_PATH" \
|
||||||
|
--bind /usr/${ABL_DIR_PREFIX}/additional-base-lib/libc.so.6 "$ABL_LIBC_SO_PATH" \
|
||||||
|
--bind /usr/${ABL_DIR_PREFIX}/additional-base-lib/ldd /usr/bin/ldd \
|
||||||
|
--setenv LD_LIBRARY_PATH "$ABL_LIBRARY_PATH" \
|
||||||
|
"$@"
|
||||||
|
# For some system like CentOS/Red Hat Enterprise Linux 7 or Debian Jessie, for some reasons,
|
||||||
|
# user namespace is not allowed. So bwrap is installed setuid to provide function to
|
||||||
|
# unprivileged users, but it also forbid capabilities feature to unprivileged user.
|
||||||
|
|
||||||
|
# You can solve it by this command: (you can also use a larger number)
|
||||||
|
# sudo bash -c "echo 1 > /proc/sys/user/max_user_namespaces"
|
||||||
|
|
||||||
|
# If you don't do that, ablrun will still try it best to run as many applications as it can,
|
||||||
|
# but you will know there will be some applications, especially those use it own sandbox
|
||||||
|
# inside (for example, those based on electron) can not run.
|
||||||
|
|
||||||
|
# For appimages, I designed a special method to make them run, see it below.
|
||||||
|
|
||||||
|
# This method also use for root user.
|
||||||
|
}
|
||||||
|
|
||||||
|
ablrun_nocap_noreplace() {
|
||||||
|
bwrap \
|
||||||
|
--dev-bind / / \
|
||||||
|
--bind /usr/${ABL_DIR_PREFIX}/additional-base-lib/"$ABL_TARGET_LD_SO_PATH" "$ABL_LD_SO_PATH" \
|
||||||
|
--bind /usr/${ABL_DIR_PREFIX}/additional-base-lib/libc.so.6 "$ABL_LIBC_SO_PATH" \
|
||||||
|
--bind /usr/${ABL_DIR_PREFIX}/additional-base-lib/ldd /usr/bin/ldd \
|
||||||
|
--setenv LD_LIBRARY_PATH "$ABL_LIBRARY_PATH" \
|
||||||
|
"$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ `whoami` = "root" ]
|
||||||
|
then
|
||||||
|
ablrun_nocap "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$ABL_MAX_USER_NS" -gt 0 ]
|
||||||
|
then
|
||||||
|
if [ "$ABL_BWRAP_SETUID" = "s" ]
|
||||||
|
then
|
||||||
|
ablrun_setuid "$@"
|
||||||
|
else
|
||||||
|
ablrun_normal "$@"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# The special designed method for appimage
|
||||||
|
ABL_FILENAME=`which "$1"`
|
||||||
|
if [ "$?" = 0 ]
|
||||||
|
then
|
||||||
|
which xdg-mime > /dev/null
|
||||||
|
if [ "$?" = 0 ]
|
||||||
|
then
|
||||||
|
ABL_FILETYPE=`xdg-mime query filetype "$ABL_FILENAME"`
|
||||||
|
if [ "$ABL_FILETYPE" = "application/vnd.appimage" ] || [ "$ABL_FILETYPE" = "application/x-iso9660-appimage" ]
|
||||||
|
then
|
||||||
|
ABLIMAGE_PARAMETERS=("$@")
|
||||||
|
coproc "$1" --appimage-mount
|
||||||
|
ABLIMAGE_PID=$!
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
kill "$ABLIMAGE_PID"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
trap cleanup SIGHUP
|
||||||
|
trap cleanup SIGINT
|
||||||
|
trap cleanup SIGTERM
|
||||||
|
|
||||||
|
if [ ! -e /proc/$ABLIMAGE_PID ]
|
||||||
|
then
|
||||||
|
echo "Child process failed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
read -u ${COPROC[0]} ABLIMAGE_DIR
|
||||||
|
|
||||||
|
ablrun_nocap_noreplace "$ABLIMAGE_DIR/AppRun" "${ABLIMAGE_PARAMETERS[@]:1}"
|
||||||
|
# Use coproc, so no exec here.
|
||||||
|
kill "$ABLIMAGE_PID"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Fallback
|
||||||
|
ablrun_nocap "$@"
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user