mirror of
https://gitee.com/spark-store-project/additional-base-lib
synced 2025-12-18 21:11:40 +08:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8ed5bb479c | |||
| d590f2acb5 | |||
|
|
c06c29d22b | ||
| bb4347cfc6 | |||
| f948825d88 | |||
| dd5a9d2b97 | |||
| 6adca141b8 | |||
|
|
499f04719c | ||
| 14bf59fb5a | |||
| 00767f1aed | |||
| c144bc5bba |
32
README.en.md
32
README.en.md
@@ -1,6 +1,6 @@
|
||||
# Additional Base Lib
|
||||
|
||||
Solve the common compatible problem of glibc on GNU/Linux, by lightweight container utility bubblewrap.
|
||||
Solve the common compatible problem of glibc on GNU/Linux, by lightweight container utility bubblewrap. (Support distros based on debian)
|
||||
|
||||
#### Introdution
|
||||
|
||||
@@ -10,29 +10,27 @@ That's because the application build with higher glibc then running. Someone cho
|
||||
|
||||
#### License
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
#### Notes
|
||||
|
||||
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. 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.
|
||||
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.
|
||||
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.
|
||||
3. Also include a single libstdc++ library with glibc, because this problem is as often as that with glibc.
|
||||
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.
|
||||
4. You may use LD_LIBRARY_PATH environment variable with ablrun to search libraries in other directories, which may solve some other library problem.
|
||||
|
||||
|
||||
#### Usage
|
||||
|
||||
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:
|
||||
Install additional-base-lib debian package first (You may download from the right side, Releases section.):
|
||||
`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 which invokes glibc problem, led by ablrun and a space:
|
||||
Then you can run command, that contains glibc problem, led by ablrun and a space:
|
||||
`ablrun [command [arguments ...]]`
|
||||
|
||||
When remove, You should also use package management.
|
||||
If you use debian-based GNU/Linux distribution, install with this command:
|
||||
Uninstall:
|
||||
`sudo apt remove additional-base-lib`
|
||||
If your distribution base on rpm, use package manage command provided by your distribution.
|
||||
|
||||
|
||||
#### Resources
|
||||
|
||||
@@ -42,9 +40,9 @@ https://bbs.deepin.org/post/256555
|
||||
Common solution for many library problem (in Chinese):
|
||||
https://bbs.deepin.org/post/256081
|
||||
|
||||
#### Customize
|
||||
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.
|
||||
Install these packages first: bash, coreutils, dpkg, dpkg-dev, grep, wget, patchelf
|
||||
A help for someone like to port this script to other GNU/Linux platform (in Chinese):
|
||||
https://bbs.deepin.org/post/258721
|
||||
|
||||
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
|
||||
#### 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.
|
||||
dependence: bash, coreutils, dpkg, dpkg-dev, grep, wget, patchelf
|
||||
|
||||
31
README.md
31
README.md
@@ -1,9 +1,6 @@
|
||||
# Additional Base Lib 附加基础库
|
||||
|
||||
用轻量级容器工具bubblewrap解决GNU/Linux操作系统中常见的glibc不兼容问题。
|
||||
|
||||
|因为一些原因我不能继续更新这个程序。可以阅读[这篇文章了解ABL的原理和设计细节](https://bbs.deepin.org/zh/post/282284)。|
|
||||
|-|
|
||||
用轻量级容器工具bubblewrap解决GNU/Linux操作系统中常见的glibc不兼容问题。(暂时只支持debian系)
|
||||
|
||||
#### 概述
|
||||
|
||||
@@ -13,29 +10,25 @@
|
||||
|
||||
#### 许可
|
||||
|
||||
`ablrun`等脚本文件没有许可证限制。附带的glibc等动态库文件都是取自一些GNU/Linux发行版的,请遵守相应的许可。
|
||||
ablrun等脚本文件没有许可证限制。附带的glibc等动态库文件都是取自一些GNU/Linux发行版的,请遵守相应的许可。
|
||||
|
||||
#### 注意事项
|
||||
|
||||
1. 软件包可以安装在使用dpkg或rpm的发行版上。移植到其他发行版平台也很容易。
|
||||
2. 大多数应用都能运行,但是一些需要权限的不可以。如果你发现了应该可以但实际上不能运行的应用,请向我报告。
|
||||
1. 只在deepin测试过,但应该能在所有debian系发行版上运行。移植到其他发行版平台也很容易。
|
||||
2. 由于使用了bwrap容器环境,因此有些程序不能运行的,比如说在程序内部使用了容器技术或者需要挂载文件系统的程序就不行。appimage是例外,因为我专门设计了单独的方案去运行他。
|
||||
3. 在glibc之外还打包了一个libstdc++的动态库,因为这个问题也比较常见。
|
||||
4. 这个脚本只关注解决glibc的兼容问题,因此很多时候你还需要解决一些其他的动态库问题才能让应用运行。你可以在使用ablrun的同时使用`LD_LIBRARY_PATH`环境变量改变动态库寻找的位置,解决一些其他动态库问题。
|
||||
4. 你可以在使用ablrun的同时使用LD_LIBRARY_PATH环境变量改变动态库寻找的位置,解决一些其他动态库问题。
|
||||
|
||||
#### 用法
|
||||
|
||||
首先需要安装additional-base-lib的软件包,可以在右侧发行版处下载。
|
||||
如果你使用的是debian衍生版,使用这个命令安装:
|
||||
首先需要安装additional-base-lib的debian包(请在右侧发行版处下载):
|
||||
`sudo apt install "path/to/package_name.deb"`
|
||||
基于rpm的发行版,请使用相应的包管理命令。
|
||||
|
||||
此后只需要在出现glibc问题的命令前面,加上ablrun和空格即可:
|
||||
`ablrun [命令 [运行选项 ...]]`
|
||||
|
||||
卸载也需要通过系统的包管理器。
|
||||
如果使用的是debian衍生版,使用这个命令卸载:
|
||||
卸载:
|
||||
`sudo apt remove additional-base-lib`
|
||||
基于rpm的发行版,请使用相应的包管理命令。
|
||||
|
||||
#### 其他资源
|
||||
|
||||
@@ -45,9 +38,9 @@ https://bbs.deepin.org/post/256555
|
||||
解决动态库问题的通用解决方法:
|
||||
https://bbs.deepin.org/post/256081
|
||||
|
||||
#### 定制
|
||||
如果这里发布的deb包不符合你的要求(库版本、架构),你可以使用`make-deb.sh`创造你自己的附加基础库。你需要将项目下载到本地,然后编辑这个脚本,把三个包的下载链接改成你想要的即可。你可以在debian的网站找到各种版本和架构的下载链接:https://www.debian.org/distrib/packages ,然后在当前目录中执行`make-deb.sh`即可。他会自动识别软件包的架构并采取相应方案。
|
||||
在这之前,你需要安装以下软件包:bash, coreutils, dpkg, dpkg-dev, grep, wget, patchelf
|
||||
想要移植程序到其他系统或平台的,可以参考:
|
||||
https://bbs.deepin.org/post/258721
|
||||
|
||||
对于rpm包,你可以使用`make-rpm.sh`,你需要将项目下载到本地,然后编辑这个脚本,把三个包的下载链接改成你想要的即可。你可以在fedora的网站找到各种版本和架构的下载链接:https://packages.fedoraproject.org/ ,然后在当前目录中执行`make-rpm.sh`即可。他会自动识别软件包的架构并采取相应方案。rpm包会存储在`~/rpmbuild/RPMS`中。
|
||||
在这之前,你需要安装以下软件包:bash, coreutils, rpm-build, wget, patchelf
|
||||
#### 定制
|
||||
如果这里发布的deb包不符合你的要求(库版本、架构),你可以使用make-deb.sh创造你自己的附加基础库。你需要将项目下载到本地,然后编辑这个脚本,把三个包的下载链接改成你想要的即可。你可以在debian的网站找到各种版本和架构的下载链接:https://www.debian.org/distrib/packages ,然后在当前目录中执行make-deb.sh即可。他会自动识别软件包的架构并采取相应方案。
|
||||
需要依赖:bash, coreutils, dpkg, dpkg-dev, grep, wget, patchelf
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
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
|
||||
|
||||
|
||||
98
make-deb.sh
98
make-deb.sh
@@ -1,10 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
LIBC6_DOWNLOAD_URL=http://mirrors.ustc.edu.cn/debian/pool/main/g/glibc/libc6_2.38-13_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://mirrors.ustc.edu.cn/debian/pool/main/g/gcc-14/libstdc++6_14-20240330-1_amd64.deb
|
||||
LIBC6_DOWNLOAD_URL=http://ftp.cn.debian.org/debian/pool/main/g/glibc/libc6_2.36-9+deb12u1_amd64.deb
|
||||
LIBC_BIN_DOWNLOAD_URL=http://ftp.cn.debian.org/debian/pool/main/g/glibc/libc-bin_2.36-9+deb12u1_amd64.deb
|
||||
LIBSTDCxx6_DOWNLOAD_URL=http://ftp.cn.debian.org/debian/pool/main/g/gcc-12/libstdc++6_12.2.0-14_amd64.deb
|
||||
|
||||
ABL_VERSION=9
|
||||
ABL_VERSION=7
|
||||
|
||||
check(){
|
||||
if [ "$1" != 0 ]
|
||||
@@ -20,7 +20,7 @@ mkdir ./downloads
|
||||
echo "download libc6..."
|
||||
wget "$LIBC6_DOWNLOAD_URL" -c -O ./downloads/libc6.deb
|
||||
check $?
|
||||
echo "download libc-bin..."
|
||||
echo "download libc_bin..."
|
||||
wget "$LIBC_BIN_DOWNLOAD_URL" -c -O ./downloads/libc-bin.deb
|
||||
check $?
|
||||
echo "download libstdc++6..."
|
||||
@@ -47,7 +47,7 @@ check $?
|
||||
|
||||
echo
|
||||
echo "check packages:"
|
||||
echo "check version libc6==libc-bin"
|
||||
echo "check version libc6==lib_bin"
|
||||
LIBC6_VERSION=`cat ./downloads/libc6/DEBIAN/control | grep "^Version: .*"`
|
||||
check $?
|
||||
LIBC6_VERSION=${LIBC6_VERSION:9}
|
||||
@@ -62,7 +62,7 @@ echo "$LIBC6_VERSION==$LIBC_BIN_VERSION"
|
||||
[ "$LIBC6_VERSION" = "$LIBC_BIN_VERSION" ]
|
||||
check $?
|
||||
|
||||
echo "check arch libc6==libc-bin"
|
||||
echo "check arch libc6==libc_bin"
|
||||
LIBC6_ARCH=`cat ./downloads/libc6/DEBIAN/control | grep "^Architecture: .*"`
|
||||
check $?
|
||||
LIBC6_ARCH=${LIBC6_ARCH:14}
|
||||
@@ -99,18 +99,8 @@ check $?
|
||||
DEBIAN_MULTIARCH=${DEBIAN_MULTIARCH:21}
|
||||
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:"
|
||||
LD_SO_LOCATION=`patchelf --print-interpreter "./downloads/libc6/${LIBC_LIB_DIR}lib/${DEBIAN_MULTIARCH}/libc.so.6"`
|
||||
LD_SO_LOCATION=`patchelf --print-interpreter "./downloads/libc6/lib/${DEBIAN_MULTIARCH}/libc.so.6"`
|
||||
check $?
|
||||
echo "$LD_SO_LOCATION"
|
||||
|
||||
@@ -124,13 +114,44 @@ mkdir ./deb-contents/usr/lib
|
||||
mkdir "./deb-contents/usr/lib/$DEBIAN_MULTIARCH"
|
||||
|
||||
echo
|
||||
echo "gather files:"
|
||||
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 "Recommends: transhell" >> ./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 "generate ablrun script..."
|
||||
echo "#!/bin/bash" > ./deb-contents/usr/bin/ablrun
|
||||
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
|
||||
cat ./scripts/ablrun_part >> ./deb-contents/usr/bin/ablrun
|
||||
echo >> ./deb-contents/DEBIAN/control
|
||||
check $?
|
||||
|
||||
echo
|
||||
echo "gather files:"
|
||||
echo "copy ablrun script..."
|
||||
cp ./scripts/ablrun ./deb-contents/usr/bin/ablrun
|
||||
check $?
|
||||
|
||||
echo "copy ablrun-appimage script..."
|
||||
cp ./scripts/ablrun-appimage ./deb-contents/usr/bin/ablrun-appimage
|
||||
check $?
|
||||
|
||||
echo "copy transhell i18n scripts..."
|
||||
mkdir -p ./deb-contents/usr/share/ablrun/transhell
|
||||
cp ./scripts/transhell/ablrun_* ./deb-contents/usr/share/ablrun/transhell/
|
||||
check $?
|
||||
|
||||
echo "generate ablrun-normal script..."
|
||||
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_ARCH_DIR=$DEBIAN_MULTIARCH" >> ./deb-contents/usr/bin/ablrun-normal
|
||||
cat ./scripts/ablrun-normal.1 >> ./deb-contents/usr/bin/ablrun-normal
|
||||
check $?
|
||||
|
||||
echo "chmod..."
|
||||
@@ -154,13 +175,13 @@ rooted_readlink(){
|
||||
}
|
||||
|
||||
echo "copy many libc6 components..."
|
||||
cp -r "./downloads/libc6/${LIBC_LIB_DIR}lib/${DEBIAN_MULTIARCH}/" "./deb-contents/usr/lib/${DEBIAN_MULTIARCH}/additional-base-lib"
|
||||
cp -r "./downloads/libc6/lib/${DEBIAN_MULTIARCH}/" "./deb-contents/usr/lib/${DEBIAN_MULTIARCH}/additional-base-lib"
|
||||
check $?
|
||||
|
||||
echo "copy ld.so..."
|
||||
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"
|
||||
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"
|
||||
cp `rooted_readlink "./downloads/libc6/$LD_SO_LOCATION" "./downloads/libc6"` "./deb-contents/usr/lib/${DEBIAN_MULTIARCH}/additional-base-lib/$LD_SO_LOCATION"
|
||||
check $?
|
||||
|
||||
echo "copy ldd script..."
|
||||
@@ -171,34 +192,11 @@ 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"
|
||||
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 "build deb package:"
|
||||
dpkg-deb -Zgzip -b ./deb-contents "./additional-base-lib_${GLIBC_VERSION}-${ABL_VERSION}_${DEBIAN_DEB_ARCH}.deb"
|
||||
# use gzip to compress for compatibility
|
||||
dpkg -b ./deb-contents "./additional-base-lib_${GLIBC_VERSION}-${ABL_VERSION}_${DEBIAN_DEB_ARCH}.deb"
|
||||
check $?
|
||||
|
||||
echo
|
||||
|
||||
224
make-rpm.sh
224
make-rpm.sh
@@ -1,224 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
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.39/8.fc40/x86_64/glibc-common-2.39-8.fc40.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=9
|
||||
ABL_RPM_RELEASE=1
|
||||
|
||||
check(){
|
||||
if [ "$1" != 0 ]
|
||||
then
|
||||
echo "Error"
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
echo "download packages:"
|
||||
mkdir ./downloads
|
||||
echo "download glibc..."
|
||||
wget "$GLIBC_DOWNLOAD_URL" -c -O ./downloads/glibc.rpm
|
||||
check $?
|
||||
echo "download glibc-common..."
|
||||
wget "$GLIBC_COMMON_DOWNLOAD_URL" -c -O ./downloads/glibc-common.rpm
|
||||
check $?
|
||||
echo "download libstdc++..."
|
||||
wget "$LIBSTDCxx_DOWNLOAD_URL" -c -O ./downloads/libstdc++.rpm
|
||||
|
||||
echo
|
||||
echo "check packages:"
|
||||
echo "check version glibc==glibc-common"
|
||||
GLIBC_VERSION=`rpm -q ./downloads/glibc.rpm --qf %{VERSION}`
|
||||
check $?
|
||||
GLIBC_COMMON_VERSION=`rpm -q ./downloads/glibc-common.rpm --qf %{VERSION}`
|
||||
check $?
|
||||
LIBSTDCxx_VERSION=`rpm -q ./downloads/libstdc++.rpm --qf %{VERSION}`
|
||||
check $?
|
||||
|
||||
echo "$GLIBC_VERSION==$GLIBC_COMMON_VERSION"
|
||||
[ "$GLIBC_VERSION" = "$GLIBC_COMMON_VERSION" ]
|
||||
check $?
|
||||
|
||||
echo "check release glibc==glibc-common"
|
||||
GLIBC_RELEASE=`rpm -q ./downloads/glibc.rpm --qf %{RELEASE}`
|
||||
check $?
|
||||
GLIBC_COMMON_RELEASE=`rpm -q ./downloads/glibc-common.rpm --qf %{RELEASE}`
|
||||
check $?
|
||||
LIBSTDCxx_RELEASE=`rpm -q ./downloads/libstdc++.rpm --qf %{RELEASE}`
|
||||
check $?
|
||||
|
||||
echo "$GLIBC_RELEASE==$GLIBC_COMMON_RELEASE"
|
||||
[ "$GLIBC_RELEASE" = "$GLIBC_COMMON_RELEASE" ]
|
||||
check $?
|
||||
|
||||
echo "check arch glibc==glibc-common"
|
||||
GLIBC_ARCH=`rpm -q ./downloads/glibc.rpm --qf %{ARCH}`
|
||||
check $?
|
||||
GLIBC_COMMON_ARCH=`rpm -q ./downloads/glibc-common.rpm --qf %{ARCH}`
|
||||
check $?
|
||||
|
||||
echo "$GLIBC_ARCH==$GLIBC_COMMON_ARCH"
|
||||
[ "$GLIBC_ARCH" = "$GLIBC_COMMON_ARCH" ]
|
||||
check $?
|
||||
|
||||
echo "check arch glibc==libstdc++"
|
||||
LIBSTDCxx_ARCH=`rpm -q ./downloads/libstdc++.rpm --qf %{ARCH}`
|
||||
check $?
|
||||
|
||||
echo "$GLIBC_ARCH==$LIBSTDCxx_ARCH"
|
||||
[ "$GLIBC_ARCH" = "$LIBSTDCxx_ARCH" ]
|
||||
check $?
|
||||
|
||||
echo
|
||||
echo "prepare rpmbuild tree..."
|
||||
mkdir ~/rpmbuild
|
||||
mkdir ~/rpmbuild/BUILD
|
||||
mkdir ~/rpmbuild/RPMS
|
||||
mkdir ~/rpmbuild/SPECS
|
||||
|
||||
echo
|
||||
echo "extract files..."
|
||||
|
||||
echo "extract glibc.rpm"
|
||||
mkdir ~/rpmbuild/BUILD/glibc
|
||||
check $?
|
||||
rpm2cpio ./downloads/glibc.rpm | cpio -idmvD ~/rpmbuild/BUILD/glibc
|
||||
check $?
|
||||
|
||||
echo "extract glibc-common.rpm"
|
||||
mkdir ~/rpmbuild/BUILD/glibc-common
|
||||
check $?
|
||||
rpm2cpio ./downloads/glibc-common.rpm | cpio -idmvD ~/rpmbuild/BUILD/glibc-common
|
||||
check $?
|
||||
|
||||
echo "extract libstdc++.rpm"
|
||||
mkdir ~/rpmbuild/BUILD/libstdc++
|
||||
check $?
|
||||
rpm2cpio ./downloads/libstdc++.rpm | cpio -idmvD ~/rpmbuild/BUILD/libstdc++
|
||||
check $?
|
||||
|
||||
echo
|
||||
echo "collect information:"
|
||||
echo "glibc version"
|
||||
echo "$GLIBC_VERSION"
|
||||
|
||||
echo "glibc release"
|
||||
echo "$GLIBC_RELEASE"
|
||||
|
||||
echo "rpm architecture:"
|
||||
echo "$GLIBC_ARCH"
|
||||
|
||||
echo "library dir:"
|
||||
if [ -d ~/rpmbuild/BUILD/glibc/lib64 ]
|
||||
then
|
||||
SYSTEM_LIBRARY_DIR=lib64
|
||||
else
|
||||
[ -d ~/rpmbuild/BUILD/glibc/lib ]
|
||||
check $?
|
||||
SYSTEM_LIBRARY_DIR=lib
|
||||
fi
|
||||
echo "$SYSTEM_LIBRARY_DIR"
|
||||
|
||||
echo "ld.so location:"
|
||||
LD_SO_LOCATION=`patchelf --print-interpreter ~/rpmbuild/BUILD/glibc/$SYSTEM_LIBRARY_DIR/libc.so.6`
|
||||
check $?
|
||||
echo "$LD_SO_LOCATION"
|
||||
|
||||
echo
|
||||
echo "build rpm spec file..."
|
||||
echo "%global __brp_strip %{nil}" > ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||
# disable strip, for it may fail when packaging for another architecture.
|
||||
echo "%global _binary_payload w9.gzdio" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||
# use gzip to compress for compatibility.
|
||||
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 "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 "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 "BuildArch: $GLIBC_ARCH" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||
# we don't use this field, pass --target to rpmbuild is enough.
|
||||
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 "%install" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||
echo "cp -r ./abl-rpm/* %{buildroot}" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||
echo "" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||
echo "%description" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||
echo "A script to run programs with newer libc." >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||
echo "package built with make-rpm.sh from additional-base-lib project." >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||
echo "glibc download URL: $GLIBC_DOWNLOAD_URL" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||
echo "glibc-common download URL: $GLIBC_COMMON_DOWNLOAD_URL" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||
echo "libstdc++ download URL: $LIBSTDCxx_DOWNLOAD_URL" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||
echo "" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||
echo "%files" >> ~/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/bin/ablrun" >> ~/rpmbuild/SPECS/additional-base-lib.spec
|
||||
check $?
|
||||
|
||||
echo
|
||||
echo "build package directories..."
|
||||
mkdir ~/rpmbuild/BUILD/abl-rpm
|
||||
mkdir ~/rpmbuild/BUILD/abl-rpm/usr
|
||||
mkdir ~/rpmbuild/BUILD/abl-rpm/usr/$SYSTEM_LIBRARY_DIR
|
||||
mkdir ~/rpmbuild/BUILD/abl-rpm/usr/bin
|
||||
|
||||
echo
|
||||
echo "gather files:"
|
||||
echo "generate ablrun script..."
|
||||
echo "#!/bin/bash" > ~/rpmbuild/BUILD/abl-rpm/usr/bin/ablrun
|
||||
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
|
||||
cat ./scripts/ablrun_part >> ~/rpmbuild/BUILD/abl-rpm/usr/bin/ablrun
|
||||
check $?
|
||||
|
||||
echo "chmod..."
|
||||
chmod a+x ~/rpmbuild/BUILD/abl-rpm/usr/bin/ablrun
|
||||
check $?
|
||||
|
||||
rooted_readlink(){
|
||||
rrl_result=$1
|
||||
rrl_root=$2
|
||||
while [ -h "$rrl_result" ]
|
||||
do
|
||||
rrl_result=`readlink "$rrl_result"`
|
||||
if [ "${rrl_result:0:1}" == "/" ]
|
||||
then
|
||||
rrl_result="$rrl_root/$rrl_result"
|
||||
else
|
||||
rrl_result=`dirname "$1"`"/$rrl_result"
|
||||
fi
|
||||
done
|
||||
echo -n "$rrl_result"
|
||||
}
|
||||
|
||||
echo "copy many glibc components..."
|
||||
cp -r ~/"rpmbuild/BUILD/glibc/${SYSTEM_LIBRARY_DIR}/" ~/"rpmbuild/BUILD/abl-rpm/usr/${SYSTEM_LIBRARY_DIR}/additional-base-lib"
|
||||
check $?
|
||||
|
||||
echo "copy ld.so..."
|
||||
mkdir --parents ~/"rpmbuild/BUILD/abl-rpm/usr/${SYSTEM_LIBRARY_DIR}/additional-base-lib/$LD_SO_LOCATION"
|
||||
rm -d ~/"rpmbuild/BUILD/abl-rpm/usr/${SYSTEM_LIBRARY_DIR}/additional-base-lib/$LD_SO_LOCATION"
|
||||
cp `rooted_readlink ~/"rpmbuild/BUILD/glibc/$LD_SO_LOCATION" ~/"rpmbuild/libc6"` ~/"rpmbuild/BUILD/abl-rpm/usr/${SYSTEM_LIBRARY_DIR}/additional-base-lib/$LD_SO_LOCATION"
|
||||
check $?
|
||||
|
||||
echo "copy ldd script..."
|
||||
cp ~/"rpmbuild/BUILD/glibc-common/usr/bin/ldd" ~/"rpmbuild/BUILD/abl-rpm/usr/${SYSTEM_LIBRARY_DIR}/additional-base-lib/ldd"
|
||||
check $?
|
||||
|
||||
echo "copy libstdc++"
|
||||
cp `rooted_readlink ~/"rpmbuild/BUILD/libstdc++/usr/${SYSTEM_LIBRARY_DIR}/libstdc++.so.6" ~/"rpmbuild/BUILD/libstdc++"` ~/"rpmbuild/BUILD/abl-rpm/usr/${SYSTEM_LIBRARY_DIR}/additional-base-lib/libstdc++.so.6"
|
||||
check $?
|
||||
|
||||
echo
|
||||
echo "build rpm package:"
|
||||
rpmbuild -bb ~/rpmbuild/SPECS/additional-base-lib.spec --target "$GLIBC_ARCH"
|
||||
check $?
|
||||
|
||||
echo
|
||||
echo "complete with no error!"
|
||||
echo "RPM package may locate in ~/rpmbuild/RPMS"
|
||||
echo "You may clean ~/rpmbuild/BUILD and ./downloads for a new start."
|
||||
|
||||
56
scripts/ablrun
Executable file
56
scripts/ablrun
Executable file
@@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -x "/opt/durapps/transhell/transhell.sh" ]
|
||||
then
|
||||
source /opt/durapps/transhell/transhell.sh
|
||||
load_transhell
|
||||
else
|
||||
if [ -f "/usr/share/ablrun/transhell/ablrun_${LANG%.*}.transhell" ]
|
||||
then
|
||||
source "/usr/share/ablrun/transhell/ablrun_${LANG%.*}.transhell"
|
||||
else
|
||||
source /usr/share/ablrun/transhell/ablrun_en_US.transhell
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$*" = "" ]
|
||||
then
|
||||
echo -e "${TRANSHELL_CONTENT_AUTHOR_INFO_AND_LIB_LICENSE}"
|
||||
|
||||
echo -e "${TRANSHELL_CONTENT_USAGE}"
|
||||
echo -e "${TRANSHELL_CONTENT_ADDITIONAL_BASE_LIB_INFO}"
|
||||
echo
|
||||
echo -e "${TRANSHELL_CONTENT_SCRIPT_AUTO_DETECT}"
|
||||
echo -e "${TRANSHELL_CONTENT_APPIMAGE_INFO}"
|
||||
echo -e "${TRANSHELL_CONTENT_NORMAL_EXECUTABLE_INFO}"
|
||||
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 -e "${TRANSHELL_CONTENT_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 "$@"
|
||||
|
||||
42
scripts/ablrun-appimage
Executable file
42
scripts/ablrun-appimage
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/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
|
||||
41
scripts/ablrun-normal.1
Executable file
41
scripts/ablrun-normal.1
Executable file
@@ -0,0 +1,41 @@
|
||||
#some contents is generated when build 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 /lib/${ABL_ARCH_DIR}/libc.so.6`
|
||||
|
||||
if [ "$LD_LIBRARY_PATH" = "" ]
|
||||
then
|
||||
ABL_LIBRARY_PATH="/usr/lib/${ABL_ARCH_DIR}/additional-base-lib/"
|
||||
else
|
||||
ABL_LIBRARY_PATH="$LD_LIBRARY_PATH;/usr/lib/${ABL_ARCH_DIR}/additional-base-lib"
|
||||
fi
|
||||
|
||||
exec bwrap \
|
||||
--dev-bind / / \
|
||||
--bind /usr/lib/${ABL_ARCH_DIR}/additional-base-lib/"$ABL_TARGET_LD_SO_PATH" "$ABL_LD_SO_PATH" \
|
||||
--bind /usr/lib/${ABL_ARCH_DIR}/additional-base-lib/libc.so.6 "$ABL_LIBC_SO_PATH" \
|
||||
--bind /usr/lib/${ABL_ARCH_DIR}/additional-base-lib/ldd /usr/bin/ldd \
|
||||
--setenv LD_LIBRARY_PATH "$ABL_LIBRARY_PATH" \
|
||||
-- "$@"
|
||||
@@ -1,154 +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 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 "$@"
|
||||
|
||||
9
scripts/transhell/ablrun_de_DE.transhell
Normal file
9
scripts/transhell/ablrun_de_DE.transhell
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
TRANSHELL_CONTENT_USAGE="Verwendung: $0 [Befehl [Argumente...]]"
|
||||
TRANSHELL_CONTENT_ADDITIONAL_BASE_LIB_INFO="Dieses Skript ist Teil von additional-base-lib. Das Paket bietet eine einfache Möglichkeit, das Kompatibilitätsproblem zwischen Anwendung und glibc zu lösen, unterstützt durch Bubblewrap."
|
||||
TRANSHELL_CONTENT_SCRIPT_AUTO_DETECT="Dieses Skript erkennt automatisch normale ausführbare Dateien und AppImages und verwendet dann das angegebene Skript, um sie auszuführen. Wenn Sie Probleme haben, können Sie sie direkt verwenden."
|
||||
TRANSHELL_CONTENT_APPIMAGE_INFO="Für AppImage benötigen Sie ablrun-appimage."
|
||||
TRANSHELL_CONTENT_NORMAL_EXECUTABLE_INFO="Für normale ausführbare Dateien benötigen Sie ablrun-normal."
|
||||
TRANSHELL_CONTENT_FILE_NOT_EXISTS="Datei existiert nicht."
|
||||
TRANSHELL_CONTENT_AUTHOR_INFO_AND_LIB_LICENSE="\n Alle mit additional-base-lib gepackten Bibliotheksdateien stammen von einer GNU/Linux-Distribution. Informationen dazu sind möglicherweise in den Paketsteuerungsdateien zu finden. Die Skripte selbst wurden von CongTianKong <https://gitee.com/CongTianKong> erstellt. Für das Skript gibt es keine Lizenz- oder Urheberrechtsbeschränkungen. Fühlen Sie sich frei, damit umzugehen.\n"
|
||||
|
||||
9
scripts/transhell/ablrun_en_US.transhell
Normal file
9
scripts/transhell/ablrun_en_US.transhell
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
TRANSHELL_CONTENT_USAGE="Usage: $0 [command [arguments...]]"
|
||||
TRANSHELL_CONTENT_ADDITIONAL_BASE_LIB_INFO="This script is a part of additional-base-lib. The package provides a simple way to solve the compatibility issue between the application and glibc, powered by bubblewrap."
|
||||
TRANSHELL_CONTENT_SCRIPT_AUTO_DETECT="This script automatically detects normal executables and AppImages, and then uses the specified script to run them. If you encounter any issues, you may also choose to use them directly."
|
||||
TRANSHELL_CONTENT_APPIMAGE_INFO="For AppImage, you need ablrun-appimage."
|
||||
TRANSHELL_CONTENT_NORMAL_EXECUTABLE_INFO="For normal executable, you need ablrun-normal."
|
||||
TRANSHELL_CONTENT_FILE_NOT_EXISTS="File does not exist."
|
||||
TRANSHELL_CONTENT_AUTHOR_INFO_AND_LIB_LICENSE="\n All library files packaged with additional-base-lib are sourced from a GNU/Linux distribution. You might find information in the package control files. The scripts themselves were created by CongTianKong <https://gitee.com/CongTianKong>. There are no license or copyright restrictions for the script. Feel free to use it.\n"
|
||||
|
||||
10
scripts/transhell/ablrun_es_ES.transhell
Normal file
10
scripts/transhell/ablrun_es_ES.transhell
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
TRANSHELL_CONTENT_USAGE="uso: $0 [comando [argumentos...]]"
|
||||
TRANSHELL_CONTENT_ADDITIONAL_BASE_LIB_INFO="Este script es parte de additional-base-lib. El paquete proporciona una forma sencilla de solucionar el problema de compatibilidad entre la aplicación y glibc, alimentado por bubblewrap."
|
||||
TRANSHELL_CONTENT_SCRIPT_AUTO_DETECT="Este script detecta automáticamente ejecutables normales y appimages, y luego utiliza el script especificado para ejecutarlos. Si experimentas problemas, puedes usarlos directamente."
|
||||
TRANSHELL_CONTENT_APPIMAGE_INFO="para appimage, necesitas ablrun-appimage."
|
||||
TRANSHELL_CONTENT_NORMAL_EXECUTABLE_INFO="para ejecutable normal, necesitas ablrun-normal."
|
||||
TRANSHELL_CONTENT_FILE_NOT_EXISTS="El archivo no existe."
|
||||
TRANSHELL_CONTENT_AUTHOR_INFO_AND_LIB_LICENSE="\n Todos los archivos de biblioteca que están empaquetados con additional-base-lib\n se toman de una distribución GNU/Linux. Puede encontrar información en los \n archivos de control de paquetes. Los propios scripts fueron creados por\n CongTianKong <https://gitee.com/CongTianKong>. No hay ninguna licencia ni\n restricción de derechos de autor para el script. Siéntete libre de utilizarlo.\n"
|
||||
|
||||
|
||||
9
scripts/transhell/ablrun_fr_FR.transhell
Normal file
9
scripts/transhell/ablrun_fr_FR.transhell
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
TRANSHELL_CONTENT_USAGE="utilisation: $0 [commande [arguments...]]"
|
||||
TRANSHELL_CONTENT_ADDITIONAL_BASE_LIB_INFO="Le script fait partie de additional-base-lib. Le package fournit un moyen simple de résoudre le problème de compatibilité entre l'application et glibc, alimenté par bubblewrap."
|
||||
TRANSHELL_CONTENT_SCRIPT_AUTO_DETECT="Ce script détecte automatiquement les exécutables normaux et les appimages, puis utilise le script spécifié pour les exécuter. Si vous rencontrez des problèmes, vous pouvez les utiliser directement."
|
||||
TRANSHELL_CONTENT_APPIMAGE_INFO="Pour l'appimage, vous avez besoin de ablrun-appimage."
|
||||
TRANSHELL_CONTENT_NORMAL_EXECUTABLE_INFO="Pour l'exécutable normal, vous avez besoin de ablrun-normal."
|
||||
TRANSHELL_CONTENT_FILE_NOT_EXISTS="Fichier inexistant."
|
||||
TRANSHELL_CONTENT_AUTHOR_INFO_AND_LIB_LICENSE="\n Tous les fichiers de bibliothèque, qui sont inclus dans additional-base-lib, ont été extraits d'une seule distribution GNU/Linux. Vous trouverez peut-être des informations dans les fichiers de contrôle des paquets. Les scripts eux-mêmes ont été créés par CongTianKong <https://gitee.com/CongTianKong>. Il n'y a ni licence ni restriction de copyright pour le script. N'hésitez pas à l'utiliser.\n"
|
||||
|
||||
9
scripts/transhell/ablrun_it_IT.transhell
Normal file
9
scripts/transhell/ablrun_it_IT.transhell
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
TRANSHELL_CONTENT_USAGE="uso: $0 [comando [argomenti...]]"
|
||||
TRANSHELL_CONTENT_ADDITIONAL_BASE_LIB_INFO="Lo script fa parte di additional-base-lib. Il pacchetto fornisce un modo semplice per risolvere il problema di compatibilità tra l'applicazione e glibc, alimentato da bubblewrap."
|
||||
TRANSHELL_CONTENT_SCRIPT_AUTO_DETECT="Questo script rileva automaticamente l'eseguibile normale e l'appimage, e quindi utilizza lo script specificato per eseguirli. Se riscontri problemi, potresti volerli utilizzare direttamente."
|
||||
TRANSHELL_CONTENT_APPIMAGE_INFO="Per l'appimage, è necessario ablrun-appimage."
|
||||
TRANSHELL_CONTENT_NORMAL_EXECUTABLE_INFO="Per l'eseguibile normale, è necessario ablrun-normal."
|
||||
TRANSHELL_CONTENT_FILE_NOT_EXISTS="File non esistente."
|
||||
TRANSHELL_CONTENT_AUTHOR_INFO_AND_LIB_LICENSE="\n Tutti i file di libreria, confezionati con additional-base-lib, sono tratti da una distribuzione GNU/Linux. Potresti trovare informazioni nei file di controllo del pacchetto. Gli script stessi sono stati creati da CongTianKong <https://gitee.com/CongTianKong>. Non ci sono restrizioni di licenza o copyright con lo script. Sentiti libero di utilizzarlo.\n"
|
||||
|
||||
9
scripts/transhell/ablrun_ja_JP.transhell
Normal file
9
scripts/transhell/ablrun_ja_JP.transhell
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
TRANSHELL_CONTENT_USAGE="使い方: $0 [コマンド [引数...]]"
|
||||
TRANSHELL_CONTENT_ADDITIONAL_BASE_LIB_INFO="このスクリプトは additional-base-lib の一部です。このパッケージは、アプリケーションと glibc の互換性の問題をバブルラップで解決するための簡単な方法を提供します。"
|
||||
TRANSHELL_CONTENT_SCRIPT_AUTO_DETECT="このスクリプトでは、通常の実行可能ファイルと AppImage を自動的に検出し、指定されたスクリプトを使用してどちらかを実行します。問題が発生した場合、直接それらを使用することもできます。"
|
||||
TRANSHELL_CONTENT_APPIMAGE_INFO="AppImage の場合、ablrun-appimage が必要です。"
|
||||
TRANSHELL_CONTENT_NORMAL_EXECUTABLE_INFO="通常の実行可能ファイルの場合、ablrun-normal が必要です。"
|
||||
TRANSHELL_CONTENT_FILE_NOT_EXISTS="ファイルが存在しません。"
|
||||
TRANSHELL_CONTENT_AUTHOR_INFO_AND_LIB_LICENSE="\n additional-base-lib でパックされたすべてのライブラリファイルは、1 つの GNU/Linux ディストリビューションから取得されています。パッケージの制御ファイルに関する情報が見つかるかもしれません。スクリプト自体は CongTianKong <https://gitee.com/CongTianKong> によって作成されました。このスクリプトにはライセンスや著作権の制約はありません。自由に取り扱ってください。\n"
|
||||
|
||||
9
scripts/transhell/ablrun_ru_RU.transhell
Normal file
9
scripts/transhell/ablrun_ru_RU.transhell
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
TRANSHELL_CONTENT_USAGE="Использование: $0 [команда [аргументы...]]"
|
||||
TRANSHELL_CONTENT_ADDITIONAL_BASE_LIB_INFO="Этот скрипт является частью additional-base-lib. Пакет предоставляет простой способ решения проблемы совместимости между приложением и glibc, с поддержкой bubblewrap."
|
||||
TRANSHELL_CONTENT_SCRIPT_AUTO_DETECT="Этот скрипт автоматически обнаруживает нормальные выполняемые файлы и appimage, а затем использует указанный скрипт для их запуска. Если у вас возникли проблемы, вы можете использовать их напрямую."
|
||||
TRANSHELL_CONTENT_APPIMAGE_INFO="Для appimage вам понадобится ablrun-appimage."
|
||||
TRANSHELL_CONTENT_NORMAL_EXECUTABLE_INFO="Для нормального выполняемого файла вам понадобится ablrun-normal."
|
||||
TRANSHELL_CONTENT_FILE_NOT_EXISTS="Файл не существует."
|
||||
TRANSHELL_CONTENT_AUTHOR_INFO_AND_LIB_LICENSE="Все библиотечные файлы, которые упакованы с additional-base-lib,\n были взяты из одного дистрибутива GNU/Linux. Вы можете найти информацию\n в файлах управления пакетами. Сами скрипты были созданы\n CongTianKong <https://gitee.com/CongTianKong>. Скрипт не имеет лицензии\n или ограничений авторских прав. Вы можете свободно использовать его.\n"
|
||||
|
||||
9
scripts/transhell/ablrun_zh_CN.transhell
Normal file
9
scripts/transhell/ablrun_zh_CN.transhell
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
TRANSHELL_CONTENT_USAGE="用法: $0 [命令 [参数...]]"
|
||||
TRANSHELL_CONTENT_ADDITIONAL_BASE_LIB_INFO="该脚本是 additional-base-lib 的一部分。此软件包提供了一个简单的方法来解决应用程序与 glibc 之间的兼容性问题,基于 bubblewrap 提供支持。"
|
||||
TRANSHELL_CONTENT_SCRIPT_AUTO_DETECT="此脚本会自动检测普通可执行文件和 AppImage,并使用指定的脚本来运行它们。如果遇到问题,您也可以直接使用这些文件。"
|
||||
TRANSHELL_CONTENT_APPIMAGE_INFO="对于 AppImage,您需要 ablrun-appimage。"
|
||||
TRANSHELL_CONTENT_NORMAL_EXECUTABLE_INFO="对于普通的可执行文件,您需要 ablrun-normal。"
|
||||
TRANSHELL_CONTENT_FILE_NOT_EXISTS="文件不存在。"
|
||||
TRANSHELL_CONTENT_AUTHOR_INFO_AND_LIB_LICENSE="所有打包在 additional-base-lib 中的库文件都来自于 GNU/Linux 发行版。您可能会在包控制文件中找到相关信息。脚本本身由 CongTianKong <https://gitee.com/CongTianKong> 创建。此脚本没有许可证或版权限制,请随意使用。\n"
|
||||
|
||||
Reference in New Issue
Block a user