commit 8b0a2d5f9194e67d2eb805a4631261ca23cfa013 Author: Alexander Zhirov Date: Tue Mar 12 02:55:36 2024 +0300 Первый релиз скрипта сборки AppImage diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d8a1d07 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +cache/ +out/ diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..926dc04 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Используйте IntelliSense, чтобы узнать о возможных атрибутах. + // Наведите указатель мыши, чтобы просмотреть описания существующих атрибутов. + // Для получения дополнительной информации посетите: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "bashdb", + "request": "launch", + "name": "Bash-Debug (simplest configuration)", + "program": "${file}", + "args": ["horizon"] + } + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..4374add --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +# AppImage Builder + +### Иерархия исходного пакета + +``` +/my_package +├── build.sh +├── files +│ ├── AppRun +│ ├── my_program.desktop +│ └── my_program.png +└── sources +``` + +### Обязательные файлы для сборки: + +- `sources` - файл с ссылками на пакеты + зависимости для сборки AppImage +- `files/*` - файлы для запуска AppImage (`AppRun`, `*.desktop`, `*.png`) + +### Необязательный файл + +- `build.sh` - скрипт постобработки после распаковки `sources` файлов + +Для внутреннего `build.sh` доступны 2 глобальгые переменные для работы: + +- `current_path` - текущая директория пакета +- `app_path` - временная директория сборки пакета (иерархия будущего AppImage) diff --git a/src/appimage-builder.sh b/src/appimage-builder.sh new file mode 100755 index 0000000..9d5cfa3 --- /dev/null +++ b/src/appimage-builder.sh @@ -0,0 +1,234 @@ +#!/bin/bash +# title :appimage-builder.sh +# description :Script for building AppImage +# author :Alexander Zhirov +# date :20240312 +# version :0.1.0 +# usage :bash appimage-builder.sh +#=============================================================================== + +# Пакеты AppImageTool +# https://github.com/AppImage/appimagetool/releases +# Среда выполнения +# https://github.com/AppImage/type2-runtime/releases + +set -e + +version="0.1.0" + +# Определения по умолчанию +# Приложение для сборки AppImage +appimage_tool=$(which appimagetool-x86_64.AppImage) +# Среда выполнения +appimage_runtime=$(which runtime-x86_64) +# Output +appimage_output="${HOME}" +# Директория с рецептами +appimage_input="./apps" +# Директория с кэшем +appimage_cache="${HOME}/appimage_cache" +# Список приложений для сборки +appimage_apps=() + +# Дополнительные необходимые утилиты +rpm2cpio=$(which rpm2cpio) +cpio=$(which cpio) + +if [ ! -x ${rpm2cpio} ]; then + echo "Отсутствует утилита rpm2cpio" + exit 1 +fi + +if [ ! -x ${cpio} ]; then + echo "Отсутствует утилита cpio" + exit 1 +fi + +extrpm() { + local rpm="${1}" + local destination_path="${2}" + + ${rpm2cpio} ${rpm} | ${cpio} -idmvD ${destination_path} +} + +build_appimage() { + local pkg="${1}" + local name=$(basename ${pkg}) + local build="${pkg}/build.sh" + local sources="${pkg}/sources" + local files="${pkg}/files" + local cache="${appimage_cache}/${name}" + + # Временные директории для сборки + local tmp="/tmp/appimage_${name}_$(date "+%Y%m%d%H%M%S")" + local src="${tmp}/src" + local app="${tmp}/app" + + if [ ! -f ${sources} ]; then + echo "${name}: не найдено исходных файлов для упаковки" + return + fi + + if [ ! -s ${sources} ]; then + echo "${name}: не найдено ни одного источника" + return + fi + + if [ ! -d ${files} ]; then + echo "${files}: не найдена директория с файлами" + return + fi + + if ! [ "$(ls -A ${files})" ]; then + echo "${files}: отсутствуют файлы для сборки AppImage" + return + fi + + # Создание директорий для сборки AppImage + mkdir -pv ${src} ${app} ${cache} + + # Список файлов для скачивания + local source_files="$(cat ${sources} | grep -v "^#")" + + for source_file in ${source_files}; do + wget -N -P ${cache} ${source_file} + done + + # Извлечение из rpm пакетов внутренностей + for rpm in $(find ${cache} -name "*.rpm"); do + extrpm ${rpm} ${app} + done + + # Извлечение из deb пакетов внутренности data.tar.* архивов + for deb in $(find ${cache} -name "*.deb"); do + local tar_name=$(ar t ${deb} | grep data) + local tar_archive="${src}/${tar_name}" + ar xv ${deb} ${tar_name} --output ${src} + tar xvf ${tar_archive} -C ${app} + rm -v ${tar_archive} + done + + # Перенос необходмых файлов для сборки AppImage в директорию сборки + cp -rv ${files}/* ${app} + + # Запуск внутреннего скрипта сборки (если имеется) + if [ -f ${build} ]; then + export current_path=$(dirname ${build}) + export app_path=${app} + ${build} + unset ${current_path} + unset ${app_path} + fi + + local name_appimage=$(grep "Name" ${files}/*.desktop | sed 's/Name=//' | tr ' ' '_')-x86_64.AppImage + + ${appimage_tool} -v --runtime-file ${appimage_runtime} ${app} ${appimage_output}/${name_appimage} + + rm -rvf ${tmp} +} + +help_scritp() { + echo -e "\n" \ + "Использование: ${0} [ОПЦИИ]... [СПИСОК ПАКЕТОВ ДЛЯ СБОРКИ]\n" \ + "Основные опции:\n" \ + "\t-t\t--appimage-tool\t\tИнструмент сборки AppImage\n" \ + "\t-r\t--appimage-runtime\tИнструмент времени выполнения\n" \ + "\t-i\t--input-path\t\tДиректория с пакетами исходных файлов\n" \ + "\t-o\t--output-path\t\tДиректория сохранения собранных AppImage\n" \ + "\t-c\t--cache-path\t\tДиректория кеша для пакетов sources\n" \ + "Дополнительно:\n" \ + "\t-h\t--help\t\t\tПоказать справку\n" \ + "\t-v\t--version\t\tВерсия скрипта\n" +} + +main() { + while [[ $# -gt 0 ]]; do + key="${1}" + value="${2}" + case "${key}" in + -t|--appimage-tool) + appimage_tool="${value}" + shift + ;; + -r|--appimage-runtime) + appimage_runtime="${value}" + shift + ;; + -i|--input-path) + appimage_input="${value}" + shift + ;; + -o|--output-path) + appimage_output="${value}" + shift + ;; + -c|--cache-path) + appimage_cache="${value}" + shift + ;; + -h|--help) + help_scritp + exit 0 + ;; + -v|--version) + echo "Версия скрипта: ${version}" + exit 0 + ;; + *) + appimage_apps+=("${key}") + ;; + esac + shift + done + + if [ ! -f ${appimage_tool} ]; then + echo "Отсутствует инструмент сборки $(basename ${appimage_tool})" + exit 1 + fi + + if [ ! -x ${appimage_tool} ]; then + echo "Инструмент сборки $(basename ${appimage_tool}) должен быть исполняемым" + exit 1 + fi + + if [ ! -f ${appimage_runtime} ]; then + echo "Отсутствует инструмент времени выполнения $(basename ${appimage_runtime})" + exit 1 + fi + + if [ ! -x ${appimage_runtime} ]; then + echo "Инструмент времени выполнения $(basename ${appimage_runtime}) должен быть исполняемым" + exit 1 + fi + + if [ ! -d ${appimage_input} ]; then + echo "Не установлена директория исхоных файлов для сборки AppImage" + exit 1 + fi + + if [ ! -d ${appimage_output} ]; then + echo "Не установлена директория для сохранения AppImage" + exit 1 + fi + + if [ ! -d ${appimage_cache} ]; then + echo "Не определена директория для кеша. Будет использована директория по умолчанию" + appimage_cache="/tmp/appimage_cache" + mkdir -p "${appimage_cache}" + fi + + echo "Инструмент сборки: ${appimage_tool}" + echo "Инструмент времени выполнения: ${appimage_runtime}" + echo "Директория исходных файлов: ${appimage_input}" + echo "Директория для сохранения AppImage: ${appimage_input}" + echo "Директория для кеша: ${appimage_cache}" + echo "Список собираемых пакетов: ${appimage_apps[@]}" + + local pkgs=$(printf "%s\n" "${appimage_apps[@]}" | xargs -I {} find ${appimage_input} -name {} -mindepth 1 -maxdepth 1 -type d) + + for pkg in ${pkgs}; do + build_appimage ${pkg} + done +} + +main "${@}" diff --git a/src/apps/horizon/build.sh b/src/apps/horizon/build.sh new file mode 100755 index 0000000..5669318 --- /dev/null +++ b/src/apps/horizon/build.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +patches="${current_path}/patches" + +patch -d ${app_path} -p0 < ${patches}/vmware-view.patch diff --git a/src/apps/horizon/files/AppRun b/src/apps/horizon/files/AppRun new file mode 100755 index 0000000..67ff0a0 --- /dev/null +++ b/src/apps/horizon/files/AppRun @@ -0,0 +1,21 @@ +#!/bin/sh + +export LD_LIBRARY_PATH="usr/lib;usr/lib/x86_64-linux-gnu;" + +readlink_file() { + next_path=$1 + i=0 + while [ "$i" != 10 ] && [ "x$next_path" != "x$path" ]; do + path=$next_path + next_path=$(readlink "$path" || echo $path) + ((++i)) + done + echo "$path" +} + +basedir() { + file=$(readlink -f "$1") || $(readlink_file "$1") + echo $(cd "$(dirname "$file")" && pwd -P) +} + +cd "$(basedir "$0")" && usr/bin/vmware-view diff --git a/src/apps/horizon/files/vmware-view.desktop b/src/apps/horizon/files/vmware-view.desktop new file mode 100644 index 0000000..c259b47 --- /dev/null +++ b/src/apps/horizon/files/vmware-view.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Type=Application +Icon=vmware-view +Exec=vmware-view %u +MimeType=x-scheme-handler/vmware-view +Categories=Network; +Name=VMware Horizon Client diff --git a/src/apps/horizon/files/vmware-view.png b/src/apps/horizon/files/vmware-view.png new file mode 100644 index 0000000..0860f5d Binary files /dev/null and b/src/apps/horizon/files/vmware-view.png differ diff --git a/src/apps/horizon/patches/vmware-view.patch b/src/apps/horizon/patches/vmware-view.patch new file mode 100644 index 0000000..4fc7eb8 --- /dev/null +++ b/src/apps/horizon/patches/vmware-view.patch @@ -0,0 +1,44 @@ +--- usr/bin/vmware-view 2024-01-19 03:02:08.000000000 -0500 ++++ usr/bin/vmware-view 2024-02-26 02:41:04.027931625 -0500 +@@ -5,18 +5,18 @@ + # This script manages the VMware Horizon Client + # + +-libpath="/usr/lib/vmware" +-binPath="/usr/lib/vmware/view" ++libpath="usr/lib/vmware" ++binPath="usr/lib/vmware/view" + html5mmrlibPath="$libpath/view/html5mmr" + usbdlibPath="$libpath/view/usb" +-vdp_servicePath="/usr/lib/pcoip/vchan_plugins" ++vdp_servicePath="usr/lib/pcoip/vchan_plugins" + libtsdrClient="$libpath/view/vdpService/libtsdrClient.so" +-snapPath="/snap/gnome-system-monitor/current/usr/lib/x86_64-linux-gnu" ++snapPath="snap/gnome-system-monitor/current/usr/lib/x86_64-linux-gnu" + pid_self=$$ + + # Set media provider install path base on $VMWARE_HORIZON_MEDIA_PROVIDER_PATH + if [[ "$VMWARE_HORIZON_MEDIA_PROVIDER_PATH" = "" ]]; then +- mediaproviderPath="/usr/lib/vmware/mediaprovider" ++ mediaproviderPath="usr/lib/vmware/mediaprovider" + else + mediaproviderPath="$VMWARE_HORIZON_MEDIA_PROVIDER_PATH" + fi +@@ -36,7 +36,7 @@ + # Get the home path + homePath= + if [[ $HOME = "" ]]; then +- homePath="/home/$user" ++ homePath="home/$user" + else + homePath=$HOME + fi +@@ -104,7 +104,7 @@ + echo $stdin_arg | "$binPath/bin/$binFile" "$@" + fi + else +- echo "File not exists:/usr/lib/vmware/view/bin/$binFile" ++ echo "File not exists:usr/lib/vmware/view/bin/$binFile" + exit 1 + fi + diff --git a/src/apps/horizon/sources b/src/apps/horizon/sources new file mode 100644 index 0000000..add0560 --- /dev/null +++ b/src/apps/horizon/sources @@ -0,0 +1,2 @@ +https://download3.vmware.com/software/CART24FQ4_LIN64_DebPkg_2312/VMware-Horizon-Client-2312-8.12.0-23149323.x64.deb +http://ftp.debian.org/debian/pool/main/libu/libudev0-shim/libudev0_200-1_amd64.deb diff --git a/src/apps/icaclient/build.sh b/src/apps/icaclient/build.sh new file mode 100755 index 0000000..e99e017 --- /dev/null +++ b/src/apps/icaclient/build.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +lang="ru" + +# Удаление ссылок +find ${app_path}/opt/Citrix/ICAClient/config -type l -exec unlink {} \; + +# Перенос конфигурации в стандартную директорию +cp -vf ${app_path}/opt/Citrix/ICAClient/nls/${lang}.UTF-8/eula.txt ${app_path}/opt/Citrix/ICAClient +mv -vf ${app_path}/etc/icaclient/config/* ${app_path}/opt/Citrix/ICAClient/config +cp -rv ${app_path}/opt/Citrix/ICAClient/nls/${lang}/* ${app_path}/opt/Citrix/ICAClient/config +mv -vf ${app_path}/etc/icaclient/nls/${lang}/module.ini ${app_path}/opt/Citrix/ICAClient/config + +# Удаление ненужных директорий +rm -rvf ${app_path}/etc ${app_path}/usr/share ${app_path}/lib/systemd diff --git a/src/apps/icaclient/files/AppRun b/src/apps/icaclient/files/AppRun new file mode 100755 index 0000000..456fe00 --- /dev/null +++ b/src/apps/icaclient/files/AppRun @@ -0,0 +1,21 @@ +#!/bin/sh + +export LD_LIBRARY_PATH="lib/x86_64-linux-gnu;lib;lib64;usr/lib;usr/lib/x86_64-linux-gnu;" + +readlink_file() { + next_path=$1 + i=0 + while [ "$i" != 10 ] && [ "x$next_path" != "x$path" ]; do + path=$next_path + next_path=$(readlink "$path" || echo $path) + ((++i)) + done + echo "$path" +} + +basedir() { + file=$(readlink -f "$1") || $(readlink_file "$1") + echo $(cd "$(dirname "$file")" && pwd -P) +} + +cd "$(basedir "$0")" && LD_PRELOAD=usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0 opt/Citrix/ICAClient/selfservice --icaroot opt/Citrix/ICAClient diff --git a/src/apps/icaclient/files/receiver.png b/src/apps/icaclient/files/receiver.png new file mode 100644 index 0000000..705130d Binary files /dev/null and b/src/apps/icaclient/files/receiver.png differ diff --git a/src/apps/icaclient/files/selfservice.desktop b/src/apps/icaclient/files/selfservice.desktop new file mode 100644 index 0000000..73648a3 --- /dev/null +++ b/src/apps/icaclient/files/selfservice.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Name=Citrix Workspace +Icon=receiver +Categories=Network; +Exec=opt/Citrix/ICAClient/selfservice --icaroot opt/Citrix/ICAClient diff --git a/src/apps/icaclient/sources b/src/apps/icaclient/sources new file mode 100644 index 0000000..2be4414 --- /dev/null +++ b/src/apps/icaclient/sources @@ -0,0 +1,24 @@ +https://ftp.zhirov.kz/repositories/other/corporate/icaclient_23.11.0.82_amd64.deb +http://security.debian.org/debian-security/pool/updates/main/w/webkit2gtk/libwebkit2gtk-4.0-37_2.42.5-1~deb12u1_amd64.deb +http://security.debian.org/debian-security/pool/updates/main/w/webkit2gtk/libjavascriptcoregtk-4.0-18_2.42.5-1~deb12u1_amd64.deb +http://ftp.ru.debian.org/debian/pool/main/i/icu/libicu72_72.1-3_amd64.deb +http://ftp.ru.debian.org/debian/pool/main/g/gst-plugins-bad1.0/libgstreamer-plugins-bad1.0-0_1.22.0-4+deb12u5_amd64.deb +http://ftp.ru.debian.org/debian/pool/main/libj/libjpeg-turbo/libjpeg62-turbo_2.1.5-2_amd64.deb +http://ftp.ru.debian.org/debian/pool/main/liba/libavif/libavif15_0.11.1-1_amd64.deb +http://ftp.ru.debian.org/debian/pool/main/libm/libmanette/libmanette-0.2-0_0.2.6-3+b1_amd64.deb +http://ftp.ru.debian.org/debian/pool/main/d/dav1d/libdav1d6_1.0.0-2_amd64.deb +http://ftp.ru.debian.org/debian/pool/main/libg/libgav1/libgav1-1_0.18.0-1+b1_amd64.deb +http://ftp.ru.debian.org/debian/pool/main/r/rust-rav1e/librav1e0_0.5.1-6_amd64.deb +http://ftp.ru.debian.org/debian/pool/main/s/svt-av1/libsvtav1enc1_1.4.1+dfsg-1_amd64.deb +http://ftp.ru.debian.org/debian/pool/main/a/aom/libaom3_3.6.0-1_amd64.deb +http://ftp.ru.debian.org/debian/pool/main/liby/libyuv/libyuv0_0.0~git20230123.b2528b0-1_amd64.deb +http://ftp.ru.debian.org/debian/pool/main/a/abseil/libabsl20220623_20220623.1-1_amd64.deb +http://ftp.ru.debian.org/debian/pool/main/g/gcc-12/libstdc++6_12.2.0-14_amd64.deb +http://ftp.ru.debian.org/debian/pool/main/g/glib2.0/libglib2.0-0_2.74.6-2_amd64.deb +http://ftp.ru.debian.org/debian/pool/main/libs/libselinux/libselinux1_3.4-1+b6_amd64.deb +http://ftp.ru.debian.org/debian/pool/main/libf/libffi/libffi8_3.4.4-1_amd64.deb +http://ftp.ru.debian.org/debian/pool/main/g/gstreamer1.0/libgstreamer1.0-0_1.22.0-2_amd64.deb +http://ftp.ru.debian.org/debian/pool/main/g/gst-plugins-base1.0/libgstreamer-plugins-base1.0-0_1.22.0-3+deb12u1_amd64.deb +http://ftp.ru.debian.org/debian/pool/main/g/gst-plugins-base1.0/libgstreamer-gl1.0-0_1.22.0-3+deb12u1_amd64.deb +# http://ftp.ru.debian.org/debian/pool/main/libs/libsecret/libsecret-1-0_0.20.5-3_amd64.deb +# http://ftp.ru.debian.org/debian/pool/main/a/at-spi2-core/libatk-bridge2.0-0_2.46.0-5_amd64.deb