Compare commits

...

2 Commits

24 changed files with 404 additions and 9 deletions

View File

@ -11,8 +11,71 @@ ln /pkg/gnu/7z/bin/7zz /pkg/gnu/7z/bin/7z
```
``` sh *** config ***
cat > /pkg/gnu/7z/bin/unzip <<'EOF'
#!/bin/bash
TARGET_DIR=""
QUIET=0
TARBALL=""
while [ $# -gt 0 ]; do
case "$1" in
-d)
TARGET_DIR="$2"
shift 2
;;
-q)
QUIET=1
shift
;;
-o)
shift
;;
-t)
7z t "$2" >/dev/null 2>&1
exit $?
;;
-l)
7z l "$2"
exit $?
;;
-*)
shift
;;
*)
TARBALL="$1"
shift
;;
esac
done
if [ -z "$TARBALL" ]; then
echo "unzip wrapper: no archive specified" >&2
exit 1
fi
if [ -n "$TARGET_DIR" ]; then
mkdir -p "$TARGET_DIR"
if [ $QUIET -eq 1 ]; then
7z x -y -bso0 -bsp0 -o"$TARGET_DIR" "$TARBALL" >/dev/null 2>&1
else
7z x -y -o"$TARGET_DIR" "$TARBALL"
fi
else
if [ $QUIET -eq 1 ]; then
7z x -y -bso0 -bsp0 "$TARBALL" >/dev/null 2>&1
else
7z x -y "$TARBALL"
fi
fi
exit $?
EOF
chmod +x /pkg/gnu/7z/bin/unzip
```
cat > /pkg/gnu/7z/bin/unzip <<EOF
#!/bin/bash
7z x "$@"
```

View File

@ -6,3 +6,7 @@ https://root-kit.ru/AeroLinux/AeroPkg.git
cargo build --release
./install.sh
```
``` sh *** config ***
id aeropkg &>/dev/null || useradd -m -s /bin/bash aeropkg
```

View File

@ -12,5 +12,7 @@ s6-svscanctl -h /pkg/gnu/s6/etc/service/current
``` sh *** off ***
pkgname_flat=${pkgname//\//\~}
pkgname_flat=${pkgname_flat%\~s6}
rm /pkg/gnu/s6/etc/service/current/$pkgname_flat
s6-svscanctl -h /pkg/gnu/s6/etc/service/current
```

14
assets/var/gnu/icu.md Normal file
View File

@ -0,0 +1,14 @@
icu
=
https://github.com/unicode-org/icu/archive/refs/tags/release-78.3.tar.gz
``` sh *** build ***
cd icu4c/source
./configure --prefix="$pkgpath" \
--enable-shared \
--enable-static \
--disable-samples \
--disable-tests
make -j"$(nproc)"
make install
```

View File

View File

@ -0,0 +1,36 @@
libreoffice/core
=
https://github.com/LibreOffice/core.git
``` sh *** build ***
/pkg/gnu/perl/bin/cpan Archive::Zip
pkg enable openjdk17 2>/dev/null || true
/pkg/gnu/python3/bin/pip3 install --root-user-action=ignore meson
echo "--with-parallelism=$(nproc)" >> autogen.input
echo "--prefix=$pkgpath" >> autogen.input
rm -f /pkg/gnu/libreoffice/core/src/autogen.lastrun
chown -R aeropkg:aeropkg /pkg/gnu/libreoffice/core
mkdir -p /pkg/gnu/libreoffice/core
chown -R aeropkg:aeropkg /pkg/gnu/libreoffice/core
chmod -R o+rX /pkg/gnu/nss /pkg/gnu/nspr /pkg/gnu/python3 /pkg/gnu/perl
su -m aeropkg -c "
cd /pkg/gnu/libreoffice/core/src
./autogen.sh
"
su -m aeropkg -c "
cd /pkg/gnu/libreoffice/core/src
make
"
cd /pkg/gnu/libreoffice/core/src
make install
```
``` cfg *** build deps ***
icu
```

View File

@ -0,0 +1,91 @@
--with-system-icu
--enable-release-build
--enable-optimized
# ===== Только headless, без GUI =====
--disable-gui
--disable-gtk3
--disable-qt5
--disable-qt6
--disable-kf5
--disable-kf6
--disable-cairo-canvas
--disable-dbus
--disable-avahi
--disable-sdremote
--disable-sdremote-bluetooth
--disable-gstreamer-1-0
--disable-dconf
--disable-avmedia
# ===== Без языков программирования =====
--without-java
--without-dotnet
#--disable-scripting # Work in progress, опции пока не поддерживаются адекватно
#--disable-scripting-beanshell
#--disable-scripting-javascript
--enable-python=system
# ===== Без баз данных =====
#--disable-database-connectivity #work in progress пока не работает
--disable-postgresql-sdbc
--disable-mariadb-sdbc
--disable-firebird-sdbc
--disable-report-builder
--disable-coinmp
# ===== Без расширений и SDK =====
--disable-odk
#--disable-extensions # Work in progress, пока не собирается с ней
--disable-extension-integration
--disable-extension-update
--disable-epm
# ===== Без отладки и crash-репортов =====
--disable-breakpad
--disable-crashdump
--disable-fuzzers
--disable-cve-tests
--disable-nan-tests
# ===== Без онлайн-функций =====
--disable-online-update
--disable-online-update-mar
--without-webdav
--disable-ldap
--disable-opencl
--disable-opengl
--disable-skia
# ===== Без Kerberos/GSSAPI =====
--without-krb5
--without-gssapi
# ===== Без документации и шрифтов =====
--without-helppack-integration
--without-help
--without-fonts
--without-myspell-dicts
--with-templates=no
--with-galleries=no
# ===== Минимальные темы (или вообще без тем) =====
--with-theme=no
# ===== Без лишних библиотек =====
--disable-zxing
--disable-gpgmepp
--disable-lotuswordpro
--disable-librelogo
--disable-poppler
--disable-pdfimport
# ===== Только английский =====
--with-lang=en-US
# ===== Без пакетов =====
--without-package-format
# ===== Ускорение сборки =====
--disable-dependency-tracking
--disable-pch

View File

@ -0,0 +1,3 @@
libreoffice/cups
=

View File

@ -0,0 +1,52 @@
#!/bin/sh
# Универсальный фильтр CUPS для конвертации офисных документов в PDF
LO_BIN="/pkg/gnu/libreoffice/core/lib/libreoffice/program/soffice"
LOG_FILE="/tmp/office-to-pdf-debug.log"
echo "=== Filter started at $(date) ===" > "$LOG_FILE"
echo "Arguments: $@" >> "$LOG_FILE"
echo "Input file arg (\$6): $6" >> "$LOG_FILE"
if [ $# -lt 5 ]; then
echo "ERROR: $0 job-id user title copies options [file]" >&2
exit 1
fi
TEMP_DIR=$(mktemp -d)
# Гарантируем очистку временной директории при завершении скрипта
trap "rm -rf '$TEMP_DIR'" EXIT
if [ -n "$6" ]; then
INPUT_FILE="$6"
else
INPUT_FILE="$TEMP_DIR/input"
cat > "$INPUT_FILE"
fi
USER_PROFILE="$TEMP_DIR/user_profile"
mkdir -p "$USER_PROFILE"
echo "Running LibreOffice..." >> "$LOG_FILE"
# Запуск с HOME во временной папке и флагами, предотвращающими зависания
HOME="$TEMP_DIR" "$LO_BIN" --headless --invisible --norestore --nofirststartwizard "-env:UserInstallation=file://$USER_PROFILE" --convert-to pdf --outdir "$TEMP_DIR" "$INPUT_FILE" >> "$LOG_FILE" 2>&1
EXIT_CODE=$?
echo "LibreOffice exit code: $EXIT_CODE" >> "$LOG_FILE"
echo "Contents of TEMP_DIR:" >> "$LOG_FILE"
ls -la "$TEMP_DIR" >> "$LOG_FILE"
# ИСПРАВЛЕНИЕ: Ищем созданный PDF файл, так как LO использует имя исходного файла
OUTPUT_FILE=$(find "$TEMP_DIR" -maxdepth 1 -name "*.pdf" -type f | head -n 1)
if [ -n "$OUTPUT_FILE" ] && [ -f "$OUTPUT_FILE" ]; then
echo "SUCCESS: PDF created at $OUTPUT_FILE" >> "$LOG_FILE"
# Передаем содержимое PDF в CUPS
cat "$OUTPUT_FILE"
exit 0
else
echo "ERROR: LibreOffice conversion failed (No PDF found in temp dir)" >> "$LOG_FILE"
echo "ERROR: LibreOffice conversion failed" >&2
exit 1
fi

View File

@ -0,0 +1,14 @@
# Форматы Microsoft Office
application/vnd.openxmlformats-officedocument.wordprocessingml.document application/pdf 100 office-to-pdf
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet application/pdf 100 office-to-pdf
application/vnd.ms-word application/pdf 100 office-to-pdf
application/vnd.ms-excel application/pdf 100 office-to-pdf
# Форматы OpenDocument (ODF)
application/vnd.oasis.opendocument.text application/pdf 100 office-to-pdf
application/vnd.oasis.opendocument.spreadsheet application/pdf 100 office-to-pdf
application/vnd.oasis.opendocument.presentation application/pdf 100 office-to-pdf
# Текстовые и другие форматы
application/rtf application/pdf 100 office-to-pdf
text/csv application/pdf 100 office-to-pdf

View File

@ -0,0 +1,13 @@
# Microsoft Office Open XML (DOCX, XLSX, PPTX)
application/vnd.openxmlformats-officedocument.wordprocessingml.document string(0,"\x50\x4b\x03\x04") filename( *.docx )
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet string(0,"\x50\x4b\x03\x04") filename( *.xlsx )
application/vnd.openxmlformats-officedocument.presentationml.presentation string(0,"\x50\x4b\x03\x04") filename( *.pptx )
# Старые форматы Microsoft (DOC, XLS) - OLE2 compound document
application/vnd.ms-word string(0,"\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1") filename( *.doc )
application/vnd.ms-excel string(0,"\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1") filename( *.xls )
# OpenDocument (ODT, ODS, ODP)
application/vnd.oasis.opendocument.text string(0,"\x50\x4b\x03\x04") filename( *.odt )
application/vnd.oasis.opendocument.spreadsheet string(0,"\x50\x4b\x03\x04") filename( *.ods )
application/vnd.oasis.opendocument.presentation string(0,"\x50\x4b\x03\x04") filename( *.odp )

View File

@ -12,5 +12,7 @@ s6-svscanctl -h /pkg/gnu/s6/etc/service/current
``` sh *** off ***
pkgname_flat=${pkgname//\//\~}
pkgname_flat=${pkgname_flat%\~s6}
rm /pkg/gnu/s6/etc/service/current/$pkgname_flat
s6-svscanctl -h /pkg/gnu/s6/etc/service/current
```

View File

@ -11,6 +11,37 @@ cp -aL dist/*/lib/* lib/nss
cp -aL dist/public/nss/* include/nss/
```
``` sh *** config ***
mkdir -p lib/pkgconfig
cat > lib/pkgconfig/nss.pc <<'EOF'
prefix=/pkg/gnu/nss
exec_prefix=${prefix}
libdir=${exec_prefix}/lib/nss
includedir=${prefix}/include/nss
Name: NSS
Description: Network Security Services
Version: 3.126
Requires: nspr >= 4.8
Libs: -L${libdir} -lssl3 -lsmime3 -lnss3 -lnssutil3
Cflags: -I${includedir}
EOF
cat > lib/pkgconfig/nss-util.pc <<'EOF'
prefix=/pkg/gnu/nss
exec_prefix=${prefix}
libdir=${exec_prefix}/lib/nss
includedir=${prefix}/include/nss
Name: NSS-Util
Description: Network Security Services Utility Library
Version: 3.126
Requires: nspr >= 4.8
Libs: -L${libdir} -lnssutil3
Cflags: -I${includedir}
EOF
```
``` cfg *** build deps ***
nspr
```

View File

@ -12,5 +12,7 @@ s6-svscanctl -h /pkg/gnu/s6/etc/service/current
``` sh *** off ***
pkgname_flat=${pkgname//\//\~}
pkgname_flat=${pkgname_flat%\~s6}
rm /pkg/gnu/s6/etc/service/current/$pkgname_flat
s6-svscanctl -h /pkg/gnu/s6/etc/service/current
```

View File

@ -12,5 +12,7 @@ s6-svscanctl -h /pkg/gnu/s6/etc/service/current
``` sh *** off ***
pkgname_flat=${pkgname//\//\~}
pkgname_flat=${pkgname_flat%\~s6}
rm /pkg/gnu/s6/etc/service/current/$pkgname_flat
s6-svscanctl -h /pkg/gnu/s6/etc/service/current
```

View File

@ -0,0 +1,7 @@
scan
=
``` config
python -m venv venv
venv/bin/pip install fastapi "uvicorn[standard]" python-multipart
```

View File

@ -16,6 +16,6 @@ pip install einops scikit-image opencv-python-headless tqdm
``` sh *** upload_weights ***
mkdir -p data/weights
#rsync -avz ~/Downloads/mbd.pkl a:/pkg/gnu/unitprint/backend/scan/DocRes/data/weights
#rsync -avz ~/Downloads/docres.pkl a:/pkg/gnu/unitprint/backend/scan/DocRes/data/weights
rsync -avz ~/Downloads/mbd.pkl a:/pkg/gnu/unitprint/backend/scan/DocRes/data/weights/
rsync -avz ~/Downloads/docres.pkl a:/pkg/gnu/unitprint/backend/scan/DocRes/data/weights/
```

View File

@ -0,0 +1,18 @@
<pkgname>/s6
=
``` sh *** set ***
pkgname_flat=${pkgname//\//\~}
pkgname_flat=${pkgname_flat%\~s6}
rm -f /pkg/gnu/s6/etc/service/current/$pkgname_flat
ln -sf $(pwd) /pkg/gnu/s6/etc/service/current/$pkgname_flat
s6-svscanctl -h /pkg/gnu/s6/etc/service/current
```
``` sh *** off ***
pkgname_flat=${pkgname//\//\~}
pkgname_flat=${pkgname_flat%\~s6}
rm /pkg/gnu/s6/etc/service/current/$pkgname_flat
s6-svscanctl -h /pkg/gnu/s6/etc/service/current
```

View File

@ -0,0 +1,3 @@
#!/pkg/gnu/bin/zsh
/pkg/gnu/unitprint/backend/scan/venv/bin/python /pkg/gnu/unitprint/backend/scan/api.py

View File

@ -1,6 +1,6 @@
server {
listen 80;
server_name local.unitprint.ru unitprint.ru 192.168.1.129;
server_name unitprint.ru www.unitprint.ru 192.168.1.129;
access_log /pkg/gnu/unitprint/nginx/run/unitprint.access.log;
error_log /pkg/gnu/unitprint/nginx/run/unitprint.error.log;
@ -12,6 +12,22 @@ server {
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml;
gzip_min_length 1000;
location /api/scan/ {
proxy_pass http://127.0.0.1:15200/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 50M;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
proxy_connect_timeout 300s;
}
location /api/ {
proxy_pass http://127.0.0.1:3000/;

View File

@ -6,8 +6,12 @@ ssh://git@root-kit.ru:17458/UnitPrint/web-app.git
save_source
```
``` sh *** patch ***
npm install
```
``` sh *** build ***
git pull
git pull || true
npm install
npm run build
rm -rf ../dist
@ -15,9 +19,11 @@ cp -rPl dist ..
```
``` sh *** config ***
rm -f src/.aeropkg.applied-build
rm -f build-script.md
chmod o+x /pkg/gnu/unitprint
chown -R nginx:nginx /pkg/gnu/unitprint/web-app/dist
nginx -s reload
```
``` sh *** init ***

4
dev.sh
View File

@ -22,8 +22,8 @@ cp -f "$SCRIPT_DIR/target/release/pkg" "$SCRIPT_DIR/target/release/bin"
echo "Installing to '$INSTALL_PATH'..."
rsync -a --exclude='etc/' "$SCRIPT_DIR/assets/" "$SCRIPT_DIR/target/release/bin" "$INSTALL_PATH/"
PATH="/bin:/pkg/musl/bin:/pkg/musl/sbin:/pkg/gnu/bin:/pkg/gnu/sbin" chroot /mnt/aerolinux /pkg/gnu/aeropkg/bin/pkg link aeropkg
rsync -a --exclude='etc/' "$SCRIPT_DIR/assets/" "$SCRIPT_DIR/target/release/bin" air:"$INSTALL_PATH/"
ssh air /pkg/gnu/aeropkg/bin/pkg link aeropkg
#rsync -a --exclude='etc/' "$SCRIPT_DIR/assets/" "$SCRIPT_DIR/target/release/bin" air:"$INSTALL_PATH/"
#ssh air /pkg/gnu/aeropkg/bin/pkg link aeropkg
rsync -a --exclude='etc/index-conflict.md' "$SCRIPT_DIR/assets/" "$SCRIPT_DIR/target/release/bin" aura:"$INSTALL_PATH/"
ssh aura /pkg/gnu/aeropkg/bin/pkg link aeropkg

View File

@ -1,7 +1,9 @@
use std::path::Path;
use std::fs;
use std::os::unix::fs::MetadataExt;
use std::process::Command;
use crate::commands::link::link;
use crate::utils::parser::{self, pkginfo, env::get_custom_env};
use crate::utils::shell;
use super::run::download::download;
@ -11,6 +13,7 @@ use super::run::config::config;
pub fn install(repo: &String, pkgname: &String) {
let pkg_dir = crate::commands::get_aeropkg_base().join(repo).join(pkgname);
let pkg_md_path = &crate::commands::get_aeropkg_var().join(format!("{}/{}.md", repo, pkgname));
let builded_pkg_md_path = &crate::commands::get_aeropkg_base().join(repo).join(pkgname).join("build-script.md");
if builded_pkg_md_path.exists() {
@ -34,6 +37,13 @@ pub fn install(repo: &String, pkgname: &String) {
}
};
config(repo, pkgname);
let pkgdata = crate::commands::get_aeropkg_var().join(repo).join(pkgname).join(".pkgdata");
if pkgdata.exists() {
let status = Command::new("cp").args(["-rPlf", &format!("{}/.", pkgdata.to_string_lossy()), &pkg_dir.to_string_lossy()]).status();
if let Err(e) = status { eprintln!("Warning: failed to copy .pkgdata for {}/{}: {}", repo, pkgname, e) }
}
if !pkg_dir.join("disabled").exists() { link(repo, pkgname) }
let full_env = &get_custom_env(repo, pkgname, pkg_md_path);
shell::run_install_repo_hook_script(repo, full_env);
shell::run_install_hook_script(full_env);

View File

@ -19,21 +19,27 @@ pub fn download(repo: &String, pkgname: &String) {
let pkgpath = &crate::commands::get_aeropkg_base().join(repo).join(pkgname);
fs::create_dir_all(&pkgpath).ok();
let pkgdata = crate::commands::get_aeropkg_var().join(repo).join(pkgname).join(".pkgdata.patch");
let src = pkgpath.join("src");
if src.exists() {
let src_url = fs::read_to_string(src.join(".aeropkg.download-url")).unwrap_or("".to_string());
if pkgdata.exists() {
let status = Command::new("cp").args(["-rPlf", &format!("{}/.", pkgdata.to_string_lossy()), &src.to_string_lossy()]).status();
if let Err(e) = status { eprintln!("Warning: failed to copy .pkgdata for {}/{}: {}", repo, pkgname, e) }
}
if url == src_url { return }
else {
fs::remove_dir_all(&src).unwrap()
}
}
let pkgdata = crate::commands::get_aeropkg_var().join(repo).join(pkgname).join(".pkgdata.patch");
if pkgdata.exists() {
let status = Command::new("cp").args(["-rPlf", &format!("{}/.", pkgdata.to_string_lossy()), &src.to_string_lossy()]).status();
if let Err(e) = status { eprintln!("Warning: failed to copy .pkgdata for {}/{}: {}", repo, pkgname, e) }
}
let full_env = get_install_env(repo, pkgname, pkg_md_path, "download");
if url.ends_with(".git") || url.starts_with("git://") {