mirror of
https://gitee.com/spark-store-project/additional-base-lib
synced 2025-07-03 20:46:00 +08:00
Compare commits
35 Commits
Author | SHA1 | Date | |
---|---|---|---|
9cca9d7e7b | |||
|
aaedef8b83 | ||
|
22a319014d | ||
|
1b4bfd36c1 | ||
|
19297c6eef | ||
|
e9a5e11b52 | ||
|
f6087dacf6 | ||
|
28803b11b6 | ||
|
179cf44241 | ||
|
f0734f618a | ||
|
78459b003c | ||
|
045565b4b9 | ||
|
ff129705fc | ||
|
dc18f99a7b | ||
|
8da4a01eda | ||
|
3022d094eb | ||
|
c895d5fd5e | ||
|
ac2e3327dd | ||
|
c3411f2903 | ||
|
e631aa3c6f | ||
|
44a55a4f80 | ||
|
ec1b129b69 | ||
|
1eb5741b5a | ||
|
ad2c3311ea | ||
|
64d43756c2 | ||
|
1c33445fd3 | ||
|
76004e37a9 | ||
|
1a12416ad6 | ||
|
2c4539afc9 | ||
|
3255067f0b | ||
|
580a27c932 | ||
|
c242e3949a | ||
|
b7e9e34833 | ||
|
8229189ce0 | ||
|
6b519e0bc3 |
README.en.mdREADME.mdadditional-base-lib-2.36-9-6.debbubblewrap-ln-flatpak.specmake-deb.shmake-rpm.sh
additional-base-lib-deb-contents
DEBIAN
usr
bin
lib/x86_64-linux-gnu/additional-base-lib
ld-linux-x86-64.so.2lddlibBrokenLocale.so.1libanl.so.1libc.so.6libc_malloc_debug.so.0libdl.so.2libm.so.6libmemusage.solibmvec.so.1libnsl.so.1libnss_compat.so.2libnss_dns.so.2libnss_files.so.2libnss_hesiod.so.2libpcprofile.solibpthread.so.0libresolv.so.2librt.so.1libstdc++.so.6libthread_db.so.1libutil.so.1
scripts
34
README.en.md
34
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. (Support distros based on debian)
|
||||
Solve the common compatible problem of glibc on GNU/Linux, by lightweight container utility bubblewrap.
|
||||
|
||||
#### Introdution
|
||||
|
||||
@ -10,27 +10,29 @@ 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 debian 12, 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
|
||||
|
||||
1. Tested in deepin, but it's also albe to run on other distro based on debian amd64. 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.
|
||||
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.
|
||||
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
|
||||
|
||||
Install additional-base-lib debian package first:
|
||||
`sudo apt install "path/to/package_name.deb"`
|
||||
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"`
|
||||
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 ...]]`
|
||||
|
||||
Uninstall:
|
||||
`sudo apt remove additional-base-lib`
|
||||
|
||||
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`
|
||||
If your distribution base on rpm, use package manage command provided by your distribution.
|
||||
|
||||
#### Resources
|
||||
|
||||
@ -40,5 +42,9 @@ https://bbs.deepin.org/post/256555
|
||||
Common solution for many library problem (in Chinese):
|
||||
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
|
||||
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
|
||||
|
||||
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
|
||||
|
33
README.md
33
README.md
@ -1,6 +1,9 @@
|
||||
# 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等动态库文件源自debian 12,请遵守相应的许可。
|
||||
`ablrun`等脚本文件没有许可证限制。附带的glibc等动态库文件都是取自一些GNU/Linux发行版的,请遵守相应的许可。
|
||||
|
||||
#### 注意事项
|
||||
|
||||
1. 只在deepin测试过,但应该能在所有debian系发行版上运行。目前只支持amd64,但是移植到其他发行版平台也很容易。
|
||||
2. 由于使用了bwrap容器环境,因此有些程序不能运行的,比如说在程序内部使用了容器技术或者需要挂载文件系统的程序就不行。appimage是例外,因为我专门设计了单独的方案去运行他。
|
||||
1. 软件包可以安装在使用dpkg或rpm的发行版上。移植到其他发行版平台也很容易。
|
||||
2. 大多数应用都能运行,但是一些需要权限的不可以。如果你发现了应该可以但实际上不能运行的应用,请向我报告。
|
||||
3. 在glibc之外还打包了一个libstdc++的动态库,因为这个问题也比较常见。
|
||||
4. 你可以在使用ablrun的同时使用LD_LIBRARY_PATH环境变量改变动态库寻找的位置,解决一些其他动态库问题。
|
||||
4. 这个脚本只关注解决glibc的兼容问题,因此很多时候你还需要解决一些其他的动态库问题才能让应用运行。你可以在使用ablrun的同时使用`LD_LIBRARY_PATH`环境变量改变动态库寻找的位置,解决一些其他动态库问题。
|
||||
|
||||
#### 用法
|
||||
|
||||
首先需要安装additional-base-lib的debian包:
|
||||
`sudo apt install "path/to/package_name.deb"`
|
||||
首先需要安装additional-base-lib的软件包,可以在右侧发行版处下载。
|
||||
如果你使用的是debian衍生版,使用这个命令安装:
|
||||
`sudo apt install "path/to/package_name.deb"`
|
||||
基于rpm的发行版,请使用相应的包管理命令。
|
||||
|
||||
此后只需要在出现glibc问题的命令前面,加上ablrun和空格即可:
|
||||
`ablrun [命令 [运行选项 ...]]`
|
||||
|
||||
卸载:
|
||||
`sudo apt remove additional-base-lib`
|
||||
卸载也需要通过系统的包管理器。
|
||||
如果使用的是debian衍生版,使用这个命令卸载:
|
||||
`sudo apt remove additional-base-lib`
|
||||
基于rpm的发行版,请使用相应的包管理命令。
|
||||
|
||||
#### 其他资源
|
||||
|
||||
@ -38,5 +45,9 @@ https://bbs.deepin.org/post/256555
|
||||
解决动态库问题的通用解决方法:
|
||||
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`即可。他会自动识别软件包的架构并采取相应方案。
|
||||
在这之前,你需要安装以下软件包: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
|
||||
|
Binary file not shown.
@ -1,9 +0,0 @@
|
||||
Package: additional-base-lib
|
||||
Version: 2.36-9-6
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Architecture: amd64
|
||||
Maintainer: enforcee @ Deepin Technology Community
|
||||
Depends: bubblewrap, bash, coreutils, shared-mime-info, xdg-utils
|
||||
Description: A script to run programs with newer libc. (contains GLIBC_2.36 GLIBCXX_3.4.30)
|
||||
|
@ -1,48 +0,0 @@
|
||||
#!/usr/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 " All the library files, which distributed with additional-base-lib,"
|
||||
echo " are taken from debian bookworm. The script itself create by enforcee"
|
||||
echo " from deepin forum <https://bbs.deepin.org/>. 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,38 +0,0 @@
|
||||
#!/usr/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."
|
||||
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,37 +0,0 @@
|
||||
#!/usr/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 " All the library files, which distributed with additional-base-lib,"
|
||||
echo " are taken from debian bookworm. The script itself create by enforcee"
|
||||
echo " from deepin forum <https://bbs.deepin.org/>. 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 " There is a simpler script to handle both normal executable and"
|
||||
echo " appimage, called ablrun. usage: ablrun [command [arguments ...]]"
|
||||
exit
|
||||
fi
|
||||
|
||||
ABL_LDSO_PATH=`readlink -e /lib64/ld-linux-x86-64.so.2`
|
||||
ABL_LIBC_PATH=`readlink -e /usr/lib/x86_64-linux-gnu/libc.so.6`
|
||||
|
||||
if [ "$LD_LIBRARY_PATH" = "" ]
|
||||
then
|
||||
ABL_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu/additional-base-lib/"
|
||||
else
|
||||
ABL_LIBRARY_PATH="$ABL_LIBRARY_PATH;/usr/lib/x86_64-linux-gnu/additional-base-lib"
|
||||
fi
|
||||
|
||||
exec bwrap \
|
||||
--dev-bind / / \
|
||||
--bind /usr/lib/x86_64-linux-gnu/additional-base-lib/ld-linux-x86-64.so.2 "$ABL_LDSO_PATH" \
|
||||
--bind /usr/lib/x86_64-linux-gnu/additional-base-lib/libc.so.6 "$ABL_LIBC_PATH" \
|
||||
--bind /usr/lib/x86_64-linux-gnu/additional-base-lib/ldd /usr/bin/ldd \
|
||||
--setenv LD_LIBRARY_PATH "$ABL_LIBRARY_PATH" \
|
||||
-- "$@"
|
BIN
additional-base-lib-deb-contents/usr/lib/x86_64-linux-gnu/additional-base-lib/ld-linux-x86-64.so.2
BIN
additional-base-lib-deb-contents/usr/lib/x86_64-linux-gnu/additional-base-lib/ld-linux-x86-64.so.2
Binary file not shown.
@ -1,193 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (C) 1996-2022 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
|
||||
# The GNU C Library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
# The GNU C Library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with the GNU C Library; if not, see
|
||||
# <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# This is the `ldd' command, which lists what shared libraries are
|
||||
# used by given dynamically-linked executables. It works by invoking the
|
||||
# run-time dynamic linker as a command and setting the environment
|
||||
# variable LD_TRACE_LOADED_OBJECTS to a non-empty value.
|
||||
|
||||
# We should be able to find the translation right at the beginning.
|
||||
TEXTDOMAIN=libc
|
||||
TEXTDOMAINDIR=/usr/share/locale
|
||||
|
||||
RTLDLIST="/lib/ld-linux.so.2 /lib64/ld-linux-x86-64.so.2 /libx32/ld-linux-x32.so.2"
|
||||
warn=
|
||||
bind_now=
|
||||
verbose=
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
--vers | --versi | --versio | --version)
|
||||
echo 'ldd (Debian GLIBC 2.36-9) 2.36'
|
||||
printf $"Copyright (C) %s Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
" "2022"
|
||||
printf $"Written by %s and %s.
|
||||
" "Roland McGrath" "Ulrich Drepper"
|
||||
exit 0
|
||||
;;
|
||||
--h | --he | --hel | --help)
|
||||
echo $"Usage: ldd [OPTION]... FILE...
|
||||
--help print this help and exit
|
||||
--version print version information and exit
|
||||
-d, --data-relocs process data relocations
|
||||
-r, --function-relocs process data and function relocations
|
||||
-u, --unused print unused direct dependencies
|
||||
-v, --verbose print all information
|
||||
"
|
||||
printf $"For bug reporting instructions, please see:\\n%s.\\n" \
|
||||
"<http://www.debian.org/Bugs/>"
|
||||
exit 0
|
||||
;;
|
||||
-d | --d | --da | --dat | --data | --data- | --data-r | --data-re | \
|
||||
--data-rel | --data-relo | --data-reloc | --data-relocs)
|
||||
warn=yes
|
||||
shift
|
||||
;;
|
||||
-r | --f | --fu | --fun | --func | --funct | --functi | --functio | \
|
||||
--function | --function- | --function-r | --function-re | --function-rel | \
|
||||
--function-relo | --function-reloc | --function-relocs)
|
||||
warn=yes
|
||||
bind_now=yes
|
||||
shift
|
||||
;;
|
||||
-v | --verb | --verbo | --verbos | --verbose)
|
||||
verbose=yes
|
||||
shift
|
||||
;;
|
||||
-u | --u | --un | --unu | --unus | --unuse | --unused)
|
||||
unused=yes
|
||||
shift
|
||||
;;
|
||||
--v | --ve | --ver)
|
||||
echo >&2 $"ldd: option \`$1' is ambiguous"
|
||||
exit 1
|
||||
;;
|
||||
--) # Stop option processing.
|
||||
shift; break
|
||||
;;
|
||||
-*)
|
||||
echo >&2 'ldd:' $"unrecognized option" "\`$1'"
|
||||
echo >&2 $"Try \`ldd --help' for more information."
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
nonelf ()
|
||||
{
|
||||
# Maybe extra code for non-ELF binaries.
|
||||
return 1;
|
||||
}
|
||||
|
||||
add_env="LD_TRACE_LOADED_OBJECTS=1 LD_WARN=$warn LD_BIND_NOW=$bind_now"
|
||||
add_env="$add_env LD_LIBRARY_VERSION=\$verify_out"
|
||||
add_env="$add_env LD_VERBOSE=$verbose"
|
||||
if test "$unused" = yes; then
|
||||
add_env="$add_env LD_DEBUG=\"$LD_DEBUG${LD_DEBUG:+,}unused\""
|
||||
fi
|
||||
|
||||
# The following command substitution is needed to make ldd work in SELinux
|
||||
# environments where the RTLD might not have permission to write to the
|
||||
# terminal. The extra "x" character prevents the shell from trimming trailing
|
||||
# newlines from command substitution results. This function is defined as a
|
||||
# subshell compound list (using "(...)") to prevent parameter assignments from
|
||||
# affecting the calling shell execution environment.
|
||||
try_trace() (
|
||||
output=$(eval $add_env '"$@"' 2>&1; rc=$?; printf 'x'; exit $rc)
|
||||
rc=$?
|
||||
printf '%s' "${output%x}"
|
||||
return $rc
|
||||
)
|
||||
|
||||
case $# in
|
||||
0)
|
||||
echo >&2 'ldd:' $"missing file arguments"
|
||||
echo >&2 $"Try \`ldd --help' for more information."
|
||||
exit 1
|
||||
;;
|
||||
1)
|
||||
single_file=t
|
||||
;;
|
||||
*)
|
||||
single_file=f
|
||||
;;
|
||||
esac
|
||||
|
||||
result=0
|
||||
for file do
|
||||
# We don't list the file name when there is only one.
|
||||
test $single_file = t || echo "${file}:"
|
||||
case $file in
|
||||
*/*) :
|
||||
;;
|
||||
*) file=./$file
|
||||
;;
|
||||
esac
|
||||
if test ! -e "$file"; then
|
||||
echo "ldd: ${file}:" $"No such file or directory" >&2
|
||||
result=1
|
||||
elif test ! -f "$file"; then
|
||||
echo "ldd: ${file}:" $"not regular file" >&2
|
||||
result=1
|
||||
elif test -r "$file"; then
|
||||
RTLD=
|
||||
ret=1
|
||||
for rtld in ${RTLDLIST}; do
|
||||
if test -x $rtld; then
|
||||
dummy=`$rtld --version 2>&1`
|
||||
if test $? = 0; then
|
||||
verify_out=`${rtld} --verify "$file"`
|
||||
ret=$?
|
||||
case $ret in
|
||||
[02]) RTLD=${rtld}; break;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
done
|
||||
case $ret in
|
||||
1)
|
||||
# This can be a non-ELF binary or no binary at all.
|
||||
nonelf "$file" || {
|
||||
echo $" not a dynamic executable" >&2
|
||||
result=1
|
||||
}
|
||||
;;
|
||||
0|2)
|
||||
try_trace "$RTLD" "$file" || result=1
|
||||
;;
|
||||
*)
|
||||
echo 'ldd:' ${RTLD} $"exited with unknown exit code" "($ret)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo 'ldd:' $"error: you do not have read permission for" "\`$file'" >&2
|
||||
result=1
|
||||
fi
|
||||
done
|
||||
|
||||
exit $result
|
||||
# Local Variables:
|
||||
# mode:ksh
|
||||
# End:
|
BIN
additional-base-lib-deb-contents/usr/lib/x86_64-linux-gnu/additional-base-lib/libBrokenLocale.so.1
BIN
additional-base-lib-deb-contents/usr/lib/x86_64-linux-gnu/additional-base-lib/libBrokenLocale.so.1
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
additional-base-lib-deb-contents/usr/lib/x86_64-linux-gnu/additional-base-lib/libc_malloc_debug.so.0
BIN
additional-base-lib-deb-contents/usr/lib/x86_64-linux-gnu/additional-base-lib/libc_malloc_debug.so.0
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
additional-base-lib-deb-contents/usr/lib/x86_64-linux-gnu/additional-base-lib/libnss_compat.so.2
BIN
additional-base-lib-deb-contents/usr/lib/x86_64-linux-gnu/additional-base-lib/libnss_compat.so.2
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
additional-base-lib-deb-contents/usr/lib/x86_64-linux-gnu/additional-base-lib/libnss_hesiod.so.2
BIN
additional-base-lib-deb-contents/usr/lib/x86_64-linux-gnu/additional-base-lib/libnss_hesiod.so.2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
|
||||
|
||||
|
205
make-deb.sh
Executable file
205
make-deb.sh
Executable file
@ -0,0 +1,205 @@
|
||||
#!/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
|
||||
|
||||
ABL_VERSION=9
|
||||
|
||||
check(){
|
||||
if [ "$1" != 0 ]
|
||||
then
|
||||
echo "Error"
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
echo "download packages:"
|
||||
mkdir ./downloads
|
||||
echo "download libc6..."
|
||||
wget "$LIBC6_DOWNLOAD_URL" -c -O ./downloads/libc6.deb
|
||||
check $?
|
||||
echo "download libc-bin..."
|
||||
wget "$LIBC_BIN_DOWNLOAD_URL" -c -O ./downloads/libc-bin.deb
|
||||
check $?
|
||||
echo "download libstdc++6..."
|
||||
wget "$LIBSTDCxx6_DOWNLOAD_URL" -c -O ./downloads/libstdc++6.deb
|
||||
check $?
|
||||
|
||||
echo
|
||||
echo "extract packages:"
|
||||
echo "extract libc6..."
|
||||
dpkg -x ./downloads/libc6.deb ./downloads/libc6
|
||||
check $?
|
||||
dpkg -e ./downloads/libc6.deb ./downloads/libc6/DEBIAN
|
||||
check $?
|
||||
echo "extract libc-bin..."
|
||||
dpkg -x ./downloads/libc-bin.deb ./downloads/libc-bin
|
||||
check $?
|
||||
dpkg -e ./downloads/libc-bin.deb ./downloads/libc-bin/DEBIAN
|
||||
check $?
|
||||
echo "extract libstdc++6..."
|
||||
dpkg -x ./downloads/libstdc++6.deb ./downloads/libstdc++6
|
||||
check $?
|
||||
dpkg -e ./downloads/libstdc++6.deb ./downloads/libstdc++6/DEBIAN
|
||||
check $?
|
||||
|
||||
echo
|
||||
echo "check packages:"
|
||||
echo "check version libc6==libc-bin"
|
||||
LIBC6_VERSION=`cat ./downloads/libc6/DEBIAN/control | grep "^Version: .*"`
|
||||
check $?
|
||||
LIBC6_VERSION=${LIBC6_VERSION:9}
|
||||
LIBC_BIN_VERSION=`cat ./downloads/libc-bin/DEBIAN/control | grep "^Version: .*"`
|
||||
check $?
|
||||
LIBC_BIN_VERSION=${LIBC_BIN_VERSION:9}
|
||||
LIBSTDCxx6_VERSION=`cat ./downloads/libstdc++6/DEBIAN/control | grep "^Version: .*"`
|
||||
check $?
|
||||
LIBSTDCxx6_VERSION=${LIBSTDCxx6_VERSION:9}
|
||||
|
||||
echo "$LIBC6_VERSION==$LIBC_BIN_VERSION"
|
||||
[ "$LIBC6_VERSION" = "$LIBC_BIN_VERSION" ]
|
||||
check $?
|
||||
|
||||
echo "check arch libc6==libc-bin"
|
||||
LIBC6_ARCH=`cat ./downloads/libc6/DEBIAN/control | grep "^Architecture: .*"`
|
||||
check $?
|
||||
LIBC6_ARCH=${LIBC6_ARCH:14}
|
||||
LIBC_BIN_ARCH=`cat ./downloads/libc-bin/DEBIAN/control | grep "^Architecture: .*"`
|
||||
check $?
|
||||
LIBC_BIN_ARCH=${LIBC_BIN_ARCH:14}
|
||||
|
||||
echo "$LIBC6_ARCH==$LIBC_BIN_ARCH"
|
||||
[ "$LIBC6_ARCH" = "$LIBC_BIN_ARCH" ]
|
||||
check $?
|
||||
|
||||
echo "check arch libc6==libstdc++6"
|
||||
LIBSTDCxx6_ARCH=`cat ./downloads/libstdc++6/DEBIAN/control | grep "^Architecture: .*"`
|
||||
check $?
|
||||
LIBSTDCxx6_ARCH=${LIBSTDCxx6_ARCH:14}
|
||||
|
||||
echo "$LIBC6_ARCH==$LIBSTDCxx6_ARCH"
|
||||
[ "$LIBC6_ARCH" = "$LIBSTDCxx6_ARCH" ]
|
||||
check $?
|
||||
|
||||
echo
|
||||
echo "collect information:"
|
||||
echo "glibc version:"
|
||||
GLIBC_VERSION=$LIBC6_VERSION
|
||||
echo "$GLIBC_VERSION"
|
||||
|
||||
echo "deb package architecture:"
|
||||
DEBIAN_DEB_ARCH=$LIBC6_ARCH
|
||||
echo "$DEBIAN_DEB_ARCH"
|
||||
|
||||
echo "debian multiarch directory name:"
|
||||
DEBIAN_MULTIARCH=`dpkg-architecture -A "$DEBIAN_DEB_ARCH" | grep "^DEB_TARGET_MULTIARCH=.*"`
|
||||
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"`
|
||||
check $?
|
||||
echo "$LD_SO_LOCATION"
|
||||
|
||||
echo
|
||||
echo "build package directories..."
|
||||
mkdir ./deb-contents
|
||||
mkdir ./deb-contents/DEBIAN
|
||||
mkdir ./deb-contents/usr
|
||||
mkdir ./deb-contents/usr/bin
|
||||
mkdir ./deb-contents/usr/lib
|
||||
mkdir "./deb-contents/usr/lib/$DEBIAN_MULTIARCH"
|
||||
|
||||
echo
|
||||
echo "gather files:"
|
||||
|
||||
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
|
||||
check $?
|
||||
|
||||
echo "chmod..."
|
||||
chmod a+x ./deb-contents/usr/bin/*
|
||||
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 libc6 components..."
|
||||
cp -r "./downloads/libc6/${LIBC_LIB_DIR}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"
|
||||
check $?
|
||||
|
||||
echo "copy ldd script..."
|
||||
cp "./downloads/libc-bin/usr/bin/ldd" "./deb-contents/usr/lib/${DEBIAN_MULTIARCH}/additional-base-lib/ldd"
|
||||
check $?
|
||||
|
||||
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
|
||||
check $?
|
||||
|
||||
echo
|
||||
echo "complete with no error!"
|
224
make-rpm.sh
Executable file
224
make-rpm.sh
Executable file
@ -0,0 +1,224 @@
|
||||
#!/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."
|
||||
|
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