From c144bc5bba309f74d6edf8b3a045b9671887c279 Mon Sep 17 00:00:00 2001 From: shenmo Date: Mon, 31 Jul 2023 10:14:24 +0800 Subject: [PATCH] add-transhell --- make-deb.sh | 10 +++++++-- scripts/ablrun | 26 +++++++++--------------- scripts/transhell/ablrun_en_US.transhell | 7 +++++++ scripts/transhell/ablrun_zh_CN.transhell | 7 +++++++ 4 files changed, 32 insertions(+), 18 deletions(-) create mode 100644 scripts/transhell/ablrun_en_US.transhell create mode 100644 scripts/transhell/ablrun_zh_CN.transhell diff --git a/make-deb.sh b/make-deb.sh index 9270194..fcd78b9 100755 --- a/make-deb.sh +++ b/make-deb.sh @@ -121,7 +121,7 @@ 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 "Depends: bubblewrap, bash, coreutils, shared-mime-info, xdg-utils, 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 @@ -141,6 +141,10 @@ 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/ + 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 @@ -186,10 +190,12 @@ 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 echo "build deb package:" dpkg -b ./deb-contents "./additional-base-lib_${GLIBC_VERSION}-${ABL_VERSION}_${DEBIAN_DEB_ARCH}.deb" check $? echo -echo "complete with no error!" \ No newline at end of file +echo "complete with no error!" diff --git a/scripts/ablrun b/scripts/ablrun index 6b868b1..b15dc9d 100755 --- a/scripts/ablrun +++ b/scripts/ablrun @@ -1,23 +1,16 @@ #!/bin/bash +source /opt/durapps/transhell/transhell.sh +load_transhell + 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 -e "${TRANSHELL_CONTENT_USAGE}" + echo -e "${TRANSHELL_CONTENT_ADDITIONAL_BASE_LIB_INFO}" 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 . 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." + echo -e "${TRANSHELL_CONTENT_SCRIPT_AUTO_DETECT}" + echo -e "${TRANSHELL_CONTENT_APPIMAGE_INFO}" + echo -e "${TRANSHELL_CONTENT_NORMAL_EXECUTABLE_INFO}" exit fi @@ -33,7 +26,7 @@ else ABL_FILENAME=`which $1` if [ "$?" != "0" ] then - echo "File not exists." + echo -e "${TRANSHELL_CONTENT_FILE_NOT_EXISTS}" exit 1 fi fi @@ -48,3 +41,4 @@ then fi exec ablrun-appimage "$@" + diff --git a/scripts/transhell/ablrun_en_US.transhell b/scripts/transhell/ablrun_en_US.transhell new file mode 100644 index 0000000..67a2e7b --- /dev/null +++ b/scripts/transhell/ablrun_en_US.transhell @@ -0,0 +1,7 @@ +#!/bin/bash +TRANSHELL_CONTENT_USAGE="usage: \$0 [command [arguments ...]]" +TRANSHELL_CONTENT_ADDITIONAL_BASE_LIB_INFO="The script is part of additional-base-lib. The package provides a simple way to solve the compatible problem between application and glibc, powered by bubblewrap." +TRANSHELL_CONTENT_SCRIPT_AUTO_DETECT="This script auto-detects normal executable and appimage, and then uses specified script to run either. If you experienced issues, you may want 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 not exists." diff --git a/scripts/transhell/ablrun_zh_CN.transhell b/scripts/transhell/ablrun_zh_CN.transhell new file mode 100644 index 0000000..818b7aa --- /dev/null +++ b/scripts/transhell/ablrun_zh_CN.transhell @@ -0,0 +1,7 @@ +#!/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="文件不存在。"