make-deb.sh update

This commit is contained in:
CongTianKong 2023-08-16 16:48:59 +08:00
parent ac2e3327dd
commit c895d5fd5e
5 changed files with 31 additions and 168 deletions

@ -4,7 +4,7 @@ LIBC6_DOWNLOAD_URL=http://ftp.cn.debian.org/debian/pool/main/g/glibc/libc6_2.36-
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=7
ABL_VERSION=8
check(){
if [ "$1" != 0 ]
@ -113,39 +113,14 @@ mkdir ./deb-contents/usr/bin
mkdir ./deb-contents/usr/lib
mkdir "./deb-contents/usr/lib/$DEBIAN_MULTIARCH"
echo
echo "create control file..."
echo "Package: additional-base-lib" >> ./deb-contents/DEBIAN/control
echo "Version: $GLIBC_VERSION-$ABL_VERSION" >> ./deb-contents/DEBIAN/control
echo "Section: utils" >> ./deb-contents/DEBIAN/control
echo "Priority: optional" >> ./deb-contents/DEBIAN/control
echo "Architecture: $DEBIAN_DEB_ARCH" >> ./deb-contents/DEBIAN/control
echo "Maintainer: CongTianKong (gitee.com/CongTianKong)" >> ./deb-contents/DEBIAN/control
echo "Depends: bubblewrap, bash, coreutils, shared-mime-info, xdg-utils" >> ./deb-contents/DEBIAN/control
echo "Description: A script to run programs with newer libc." >> ./deb-contents/DEBIAN/control
echo " package built with make-deb.sh from additional-base-lib project." >> ./deb-contents/DEBIAN/control
echo " libc6 download URL: $LIBC6_DOWNLOAD_URL" >> ./deb-contents/DEBIAN/control
echo " libc-bin download URL: $LIBC_BIN_DOWNLOAD_URL" >> ./deb-contents/DEBIAN/control
echo " libstdc++6 download URL: $LIBSTDCxx6_DOWNLOAD_URL" >> ./deb-contents/DEBIAN/control
echo >> ./deb-contents/DEBIAN/control
check $?
echo
echo "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 "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_DIR_PREFIX=lib/$DEBIAN_MULTIARCH" >> ./deb-contents/usr/bin/ablrun-normal
cat ./scripts/ablrun-normal_part >> ./deb-contents/usr/bin/ablrun-normal
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..."
@ -186,6 +161,30 @@ echo "copy libstdc++..."
cp `rooted_readlink ./downloads/libstdc++6/usr/lib/${DEBIAN_MULTIARCH}/libstdc++.so.6 ./downloads/libstdc++6/` "./deb-contents/usr/lib/${DEBIAN_MULTIARCH}/additional-base-lib/libstdc++.so.6"
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"

@ -1,50 +0,0 @@
#!/bin/bash
if [ "$*" = "" ]
then
echo "usage: $0 [command [arguments ...]]"
echo " The script is part of additional-base-lib. The package provides a"
echo " simple way to solve the compatible problem between application and"
echo " glibc, powered by bubblewrap."
echo
echo " All the library files, which packed with additional-base-lib,"
echo " are taken from one GNU/Linux distribution. You may found information"
echo " in package control files. The scripts theirselves were created by"
echo " CongTianKong <https://gitee.com/CongTianKong>. There's no lisence"
echo " nor copyright restriction with The script. Feel free to deal with."
echo
echo " This script auto-detects normal executable and appimage, and then"
echo " uses specified script to run either. If you experienced issues,"
echo " you may want to use them directly."
echo " for appimage, you need ablrun-appimage."
echo " for normal executable, you need ablrun-normal."
exit
fi
if [ `whoami` = "root" ]
then
exec ablrun-normal "$@"
fi
if [ -e "$1" ]
then
ABL_FILENAME="$1"
else
ABL_FILENAME=`which $1`
if [ "$?" != "0" ]
then
echo "File not exists."
exit 1
fi
fi
ABL_FILETYPE=`xdg-mime query filetype "$ABL_FILENAME"`
if [ "$ABL_FILETYPE" != "application/vnd.appimage" ]
then
if [ "$ABL_FILETYPE" != "application/x-iso9660-appimage" ]
then
exec ablrun-normal "$@"
fi
fi
exec ablrun-appimage "$@"

@ -1,42 +0,0 @@
#!/bin/bash
if [ "$*" = "" ]
then
echo "usage: $0 [appimage-file [arguments ...]]"
echo " This is helper script to run appimages for additional-base-lib."
echo
echo " You have to ensure input file IS an appimage, for this script"
echo " does not check. If you input other files, It will become"
echo " unpredictable."
echo
echo " There is a more convenient script to handle both normal executable"
echo " and appimage, called ablrun."
echo " usage: ablrun [command [arguments ...]]"
exit
fi
ABLIMAGE_PARAMETERS=("$@")
coproc "$1" --appimage-mount
ABLIMAGE_PID=$!
cleanup() {
kill $ABLIMAGE_PID
exit
}
trap cleanup SIGHUP
trap cleanup SIGINT
trap cleanup SIGTERM
if [ ! -e /proc/$! ]
then
echo "Child process failed."
exit 1
fi
read -u ${COPROC[0]} ABLIMAGE_DIR
ablrun-normal "$ABLIMAGE_DIR/AppRun" ${ABLIMAGE_PARAMETERS[@]:1}
cleanup

@ -1,41 +0,0 @@
#some content, such as ABL_DIR_PREFIX, ABL_TARGET_LD_SO_PATH, is generated when building the package
if [ "$*" = "" ]
then
echo "usage: $0 [command [arguments ...]]"
echo " The script is part of additional-base-lib. The package provides a"
echo " simple way to solve the compatible problem between application and"
echo " glibc, powered by bubblewrap."
echo
echo " All the library files, which packed with additional-base-lib,"
echo " are taken from one GNU/Linux distribution. You may found information"
echo " in package control files. The scripts theirselves were created by"
echo " CongTianKong <https://gitee.com/CongTianKong>. There's no lisence"
echo " nor copyright restriction with The script. Feel free to deal with."
echo
echo " If you're going to run appimage with additional-base-lib, you may"
echo " need ablrun-appimage."
echo
echo " There is a more convenient script to handle both normal executable"
echo " and appimage, called ablrun."
echo " usage: ablrun [command [arguments ...]]"
exit
fi
ABL_LD_SO_PATH=`readlink -e $ABL_TARGET_LD_SO_PATH`
ABL_LIBC_SO_PATH=`readlink -e /${ABL_DIR_PREFIX}/libc.so.6`
if [ "$LD_LIBRARY_PATH" = "" ]
then
ABL_LIBRARY_PATH="/usr/${ABL_DIR_PREFIX}/additional-base-lib/"
else
ABL_LIBRARY_PATH="$LD_LIBRARY_PATH;/usr/${ABL_DIR_PREFIX}/additional-base-lib"
fi
exec bwrap \
--dev-bind / / \
--bind /usr/${ABL_DIR_PREFIX}/additional-base-lib/"$ABL_TARGET_LD_SO_PATH" "$ABL_LD_SO_PATH" \
--bind /usr/${ABL_DIR_PREFIX}/additional-base-lib/libc.so.6 "$ABL_LIBC_SO_PATH" \
--bind /usr/${ABL_DIR_PREFIX}/additional-base-lib/ldd /usr/bin/ldd \
--setenv LD_LIBRARY_PATH "$ABL_LIBRARY_PATH" \
-- "$@"

@ -1,6 +1,3 @@
#!/bin/bash
ABL_TARGET_LD_SO_PATH=/lib64/ld-linux-x86-64.so.2
ABL_DIR_PREFIX=lib/x86_64-linux-gnu
# some content, such as ABL_DIR_PREFIX, ABL_TARGET_LD_SO_PATH, is generated when building the package
if [ "$*" = "" ]
@ -12,7 +9,7 @@ then
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 scripts theirselves were created by"
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