diff --git a/assets/var/gnu/cups-filters.md b/assets/var/gnu/cups-filters.md index d64b24d..a208046 100644 --- a/assets/var/gnu/cups-filters.md +++ b/assets/var/gnu/cups-filters.md @@ -10,7 +10,7 @@ sed -i 's/int (\*proc_func)()/int (*proc_func)(FILE *, FILE *, void *)/' filter/ ./autogen.sh ./configure --prefix=$pkgpath make -j$(nproc) -make install +make install CUPS_DATADIR=$pkgpath/share/cups ``` ``` cfg *** build deps *** diff --git a/assets/var/gnu/cups.md b/assets/var/gnu/cups.md index ec34def..1c2eaec 100644 --- a/assets/var/gnu/cups.md +++ b/assets/var/gnu/cups.md @@ -7,3 +7,26 @@ https://github.com/OpenPrinting/cups/archive/refs/tags/v2.4.19.tar.gz make -j$(nproc) make install ``` + +``` sh *** config *** +ln -sf /pkg/gnu/bin/foomatic-ppdfile lib/cups/driver/foomatic +sed -i 's|^#ServerBin /pkg/gnu/cups/lib/cups|ServerBin /pkg/gnu/lib/cups|' etc/cups/cups-files.conf +sed -i 's|^#DataDir /pkg/gnu/cups/share/cups|DataDir /pkg/gnu/share/cups|' etc/cups/cups-files.conf +sed -i 's|^#TempDir /pkg/gnu/cups/var/spool/cups/tmp|TempDir /pkg/gnu/cups/var/spool/cups/tmp|' etc/cups/cups-files.conf +chmod 1777 /pkg/gnu/cups/var/spool/cups/tmp +grep -q "SetEnv TMPDIR" /pkg/gnu/cups/etc/cups/cupsd.conf || \ +echo 'SetEnv TMPDIR /pkg/gnu/cups/var/spool/cups/tmp' >> /pkg/gnu/cups/etc/cups/cupsd.conf + +#sed -i 's|^#User nobody|User nobody|' /pkg/gnu/cups/etc/cups/cups-files.conf +#sed -i 's|^#Group lp|Group lp|' /pkg/gnu/cups/etc/cups/cups-files.conf +#echo 'SetEnv GS_OPTIONS -dNOSAFER' >> /pkg/gnu/cups/etc/cups/cupsd.conf + +usermod -aG lp nobody 2>/dev/null || gpasswd -a nobody lp +chmod 750 /pkg/gnu/cups/var/spool/cups +chown root:lp /pkg/gnu/cups/var/spool/cups +``` + +``` cfg *** build deps *** +libusb +foomatic-db-engine +``` diff --git a/assets/var/gnu/foomatic-db.md b/assets/var/gnu/foomatic-db.md index 01e9bab..5daac63 100644 --- a/assets/var/gnu/foomatic-db.md +++ b/assets/var/gnu/foomatic-db.md @@ -8,3 +8,7 @@ https://github.com/OpenPrinting/foomatic-db.git make -j$(nproc) make install ``` + +``` cfg *** run deps *** +foomatic-db-engine +``` diff --git a/assets/var/gnu/git.md b/assets/var/gnu/git.md index edcdd1d..55522c7 100644 --- a/assets/var/gnu/git.md +++ b/assets/var/gnu/git.md @@ -12,10 +12,9 @@ make install ``` sh *** config *** mkdir -p /pkg/gnu/git/etc git config --system http.sslCAInfo /pkg/gnu/openssl/ssl/cacert.pem -git config --global url."https://github.com/".insteadOf "git@github.com:" ``` -``` cfg *** build deps *** +``` cfg *** build deps *** curl pcre2 zlib @@ -24,4 +23,14 @@ libxcrypt ``` cfg *** run deps *** perl +less +``` + +``` sh *** set *** +git config --global url."https://github.com/".insteadOf "git@github.com:" +git config --global alias.whoim '!echo "Name: $(git config user.name)" && echo "Email: $(git config user.email)"' +git config --global alias.im '!echo "Name: $(git config user.name)" && echo "Email: $(git config user.email)"' +git config --global alias.trace '!git config user.name "TraceLumen" && git config user.email "tracelumen@root-kit.ru" && echo "Author set to Trace"' +git config --global alias.sam '!git config user.name "sam" && git config user.email "svvivel@gmail.com" && echo "Author set to sam"' +git config --global core.editor nvim ``` diff --git a/assets/var/gnu/glu.md b/assets/var/gnu/glu.md index 34441bb..14e3270 100644 --- a/assets/var/gnu/glu.md +++ b/assets/var/gnu/glu.md @@ -10,6 +10,6 @@ ninja ninja install ``` -``` cfg *** build deps *** +``` cfg *** build run deps *** mesa ``` diff --git a/assets/var/gnu/groff.md b/assets/var/gnu/groff.md new file mode 100644 index 0000000..7ca7d89 --- /dev/null +++ b/assets/var/gnu/groff.md @@ -0,0 +1,9 @@ +groff 1.24.1 += +https://ftp.gnu.org/gnu/groff/groff-1.24.1.tar.gz + +``` sh *** build *** +./configure --prefix=$pkgpath +make -j$(nproc) +make install +``` diff --git a/assets/var/gnu/hplip.md b/assets/var/gnu/hplip.md index 0715068..aca2033 100644 --- a/assets/var/gnu/hplip.md +++ b/assets/var/gnu/hplip.md @@ -70,8 +70,15 @@ PyMODINIT_FUNC PyInit_pcardext(void)\ sed -i 's/static column = 0 ;/static int column = 0 ;/' prnt/hpps/pserror.c ``` +./configure --prefix=/pkg/gnu/hplip --disable-network-build --disable-pcard-build + ``` sh *** build *** -./configure --prefix=$pkgpath --disable-network-build --disable-pcard-build +./configure \ + --prefix=$pkgpath \ + --disable-network-build \ + --disable-pcard-build \ + --with-cupsfilterdir=$pkgpath/lib/cups/filter \ + --with-cupsbackenddir=$pkgpath/lib/cups/backend make -j$(nproc) make install ``` diff --git a/assets/var/gnu/less.md b/assets/var/gnu/less.md new file mode 100644 index 0000000..4434cb7 --- /dev/null +++ b/assets/var/gnu/less.md @@ -0,0 +1,15 @@ +less += +https://github.com/gwsw/less.git + +``` sh *** build *** +make -f Makefile.aut distfiles +autoreconf -i +./configure --prefix=$pkgpath +make -j$(nproc) +make install +``` + +``` sh *** run deps *** +groff +``` diff --git a/assets/var/gnu/mupdf.md b/assets/var/gnu/mupdf.md index 9b8132e..1d3a10e 100644 --- a/assets/var/gnu/mupdf.md +++ b/assets/var/gnu/mupdf.md @@ -9,5 +9,9 @@ make prefix=/pkg/gnu/mupdf install ``` cfg *** build deps *** glu +``` + +``` cfg *** build run deps *** +glu llvm ``` diff --git a/assets/var/gnu/python3.md b/assets/var/gnu/python3.md index dea8cfb..3951bc2 100644 --- a/assets/var/gnu/python3.md +++ b/assets/var/gnu/python3.md @@ -10,7 +10,7 @@ make install ``` sh *** config *** pip3 install setuptools -ln bin/python3 bin/python +ln -f bin/python3 bin/python ``` ``` cfg *** build deps *** diff --git a/assets/var/gnu/unitprint/backend-local.md b/assets/var/gnu/unitprint/backend-local.md index 2fb1670..32e5928 100644 --- a/assets/var/gnu/unitprint/backend-local.md +++ b/assets/var/gnu/unitprint/backend-local.md @@ -1,20 +1,41 @@ +unitprint/backend-local += +ssh://git@root-kit.ru:17458/UnitPrint/backend-local.git +``` env *** env *** +disable +``` - - - - - - -cargo new backend-local - +``` sh *** build *** +cargo build --release +mkdir ../bin +cp -l target/release/backend-local ../bin +``` ``` cfg *** run deps *** cups cups-filters foomatic-db -foomatic-db-engine hplip ``` -Для раздачи инета службу поднять/конфиг сделать под unitprint ей +``` sh *** setup *** +PRINTER_URI=$(lpinfo -v | awk '/^direct usb:\/\// {print $2; exit}') +MODEL=$(python3 -c "import urllib.parse,sys; print(urllib.parse.unquote('$PRINTER_URI'.split('/')[-1].split('?')[0]))") +PPD_PATH=$(lpinfo -m | grep -i "$MODEL" | grep -iv 'postscript' | grep -i 'hpcups' | head -n1 | awk '{print $1}') +if [[ -z "$PPD_PATH" ]]; then + PPD_PATH=$(lpinfo -m | grep -i "$MODEL" | grep -iv 'postscript' | head -n1 | awk '{print $1}') +fi + +echo "URI: $PRINTER_URI" +echo "Model: $MODEL" +echo "PPD: $PPD_PATH" + +lpadmin -p Auto_HP_P2015 -E -v "$PRINTER_URI" -m "$PPD_PATH" +lpadmin -d Auto_HP_P2015 + +echo "Default printer set:" +lpstat -d + +lpoptions -p Auto_HP_P2015 -o PageSize=A4 +``` diff --git a/assets/var/gnu/unitprint/backend-local/s6.md b/assets/var/gnu/unitprint/backend-local/s6.md new file mode 100644 index 0000000..d9966ca --- /dev/null +++ b/assets/var/gnu/unitprint/backend-local/s6.md @@ -0,0 +1,11 @@ +unitprint/backend-local/s6 += + + +``` sh *** set *** +ln -sf $(pwd) /pkg/gnu/s6/etc/service/current/unitprint-backend-local +``` + +``` sh *** off *** +rm /pkg/gnu/s6/etc/service/current/unitprint-backend-local +``` diff --git a/assets/var/gnu/unitprint/backend-local/s6/.pkgdata/run b/assets/var/gnu/unitprint/backend-local/s6/.pkgdata/run new file mode 120000 index 0000000..335ed1d --- /dev/null +++ b/assets/var/gnu/unitprint/backend-local/s6/.pkgdata/run @@ -0,0 +1 @@ +../bin/backend-local \ No newline at end of file diff --git a/assets/var/gnu/unitprint/backend/scan/DocRes.md b/assets/var/gnu/unitprint/backend/scan/DocRes.md index 26be60e..eefd713 100644 --- a/assets/var/gnu/unitprint/backend/scan/DocRes.md +++ b/assets/var/gnu/unitprint/backend/scan/DocRes.md @@ -1,9 +1,11 @@ unitprint/backend/scan/DocRes = -https://github.com/ZZZHANG-jx/DocRes.git +ssh://git@root-kit.ru:17458/UnitPrint/scan-DocRes.git +git remote set-url origin ssh://git@root-kit.ru:17458/UnitPrint/scan-DocScanner.git ``` sh *** build *** -mv * .. +cp -rfPl * .. +cp -rfPl .* .. ``` ``` sh *** config *** @@ -17,44 +19,3 @@ 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 ``` - -mkdir -p ~/.config/miopen -export MIOPEN_USER_DB_PATH="/root/.config/miopen" -export MIOPEN_FIND_MODE=3 -export HIP_VISIBLE_DEVICES=0 - -time ../../venv/bin/python inference.py \ - --task deshadowing \ - --im_path ./IMG_20260905_172410_rec.jpg \ - --out_folder ./ - -time python inference.py \ - --task appearance \ - --im_path ./output_pipeline/IMG_20260905_172410_rec_deshadowing.png \ - --out_folder ./output_pipeline - -time python inference.py \ - --task deblurring \ - --im_path ./output_pipeline/IMG_20260905_172410_rec_deshadowing_appearance.png \ - --out_folder ./output_pipeline - -time python inference.py \ - --task deblurring \ - --im_path ../../DocScanner/src/rectified/IMG_20260905_172410_rec.png \ - --out_folder ./output_pipeline - -time python inference.py \ - --task appearance \ - --im_path ./output_pipeline/IMG_20260905_172410_rec_deblurring.png \ - --out_folder ./output_pipeline - -# 3. Appearance -time python inference.py \ - --task appearance \ - --im_path ./output_pipeline/IMG_20260905_172410_rec_deshadowing.png \ - --out_folder ./output_pipeline - -time python inference.py \ - --task dewarping \ - --im_path /pkg/gnu/unitprint/DocScanner/src/distorted/IMG_20260905_172410.jpg \ - --out_folder ./output_pipeline diff --git a/assets/var/gnu/unitprint/backend/scan/DocScanner.md b/assets/var/gnu/unitprint/backend/scan/DocScanner.md index 135f914..014ca89 100644 --- a/assets/var/gnu/unitprint/backend/scan/DocScanner.md +++ b/assets/var/gnu/unitprint/backend/scan/DocScanner.md @@ -1,9 +1,10 @@ unitprint/backend/scan/DocScanner = -https://root-kit.ru/UnitPrint/scan-DocScanner.git +ssh://git@root-kit.ru:17458/UnitPrint/scan-DocScanner.git ``` sh *** build *** -mv * .. +cp -rfPl * .. +cp -rfPl .* .. ``` ``` sh *** config *** diff --git a/assets/var/gnu/unitprint/web-app.md b/assets/var/gnu/unitprint/web-app.md index b831f60..b5d6d09 100644 --- a/assets/var/gnu/unitprint/web-app.md +++ b/assets/var/gnu/unitprint/web-app.md @@ -7,7 +7,16 @@ save_source=true ``` ``` sh *** build *** -ls +git pull +npm install +npm run build +rm -rf ../dist +cp -rPl dist .. +``` + +``` sh *** config *** +chmod o+x /pkg/gnu/unitprint +chown -R nginx:nginx /pkg/gnu/unitprint/web-app/dist ``` ``` sh *** init *** @@ -16,5 +25,3 @@ npm create vite@latest . -- --template svelte --no-interactive --overwrite npm install ``` -chmod o+x /pkg/gnu/unitprint -chown -R nginx:nginx /pkg/gnu/unitprint/web-app/dist diff --git a/assets/var/gnu/usbutils.md b/assets/var/gnu/usbutils.md new file mode 100644 index 0000000..ca8b825 --- /dev/null +++ b/assets/var/gnu/usbutils.md @@ -0,0 +1,10 @@ +usbutils += + +``` sh *** build *** +mkdir -p build +cd build +meson setup --prefix=$pkgpath --libdir=lib --buildtype=release .. +ninja +ninja install +``` diff --git a/dev.sh b/dev.sh index 2a94255..44555e7 100755 --- a/dev.sh +++ b/dev.sh @@ -20,11 +20,11 @@ mkdir -p "$SCRIPT_DIR/target/release/bin" cp -f "$SCRIPT_DIR/target/release/pkg" "$SCRIPT_DIR/target/release/bin" echo "Installing to '$INSTALL_PATH'..." -rsync -a --delete --exclude='etc/' "$SCRIPT_DIR/assets/" "$SCRIPT_DIR/target/release/bin" "$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 --delete --exclude='etc/' "$SCRIPT_DIR/assets/" "$SCRIPT_DIR/target/release/bin" air:"$INSTALL_PATH/" +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 --delete --exclude='etc/index-conflict.md' "$SCRIPT_DIR/assets/" "$SCRIPT_DIR/target/release/bin" aura:"$INSTALL_PATH/" +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 BIN_PATH="$INSTALL_PATH/bin/pkg" diff --git a/install.sh b/install.sh index 625d2a2..7ffe2f2 100755 --- a/install.sh +++ b/install.sh @@ -20,7 +20,7 @@ mkdir -p "$SCRIPT_DIR/target/release/bin" cp -f "$SCRIPT_DIR/target/release/pkg" "$SCRIPT_DIR/target/release/bin" echo "Installing to '$INSTALL_PATH'..." -rsync -a --delete --exclude='etc/' "$SCRIPT_DIR/assets/" "$SCRIPT_DIR/target/release/bin" "$INSTALL_PATH/" +rsync -a --exclude='etc/' "$SCRIPT_DIR/assets/" "$SCRIPT_DIR/target/release/bin" "$INSTALL_PATH/" "$INSTALL_PATH/bin/pkg" link aeropkg diff --git a/src/commands/install.rs b/src/commands/install.rs index a6d5bcf..0f46a4c 100644 --- a/src/commands/install.rs +++ b/src/commands/install.rs @@ -19,9 +19,16 @@ pub fn install(repo: &String, pkgname: &String) { check_build_dependency(repo, pkg_md_path); check_run_dependency(pkg_md_path); - download(repo, pkgname); - patch(repo, pkgname); - build(repo, pkgname); + match parser::pkginfo::get_url(pkg_md_path) { + Ok(_) => { + download(repo, pkgname); + patch(repo, pkgname); + build(repo, pkgname); + } + Err(e) => { + panic!("Failed to parse URL: {}", e) + } + }; config(repo, pkgname); let full_env = &get_custom_env(repo, pkgname, pkg_md_path); shell::run_install_repo_hook_script(repo, full_env); diff --git a/src/commands/run/config.rs b/src/commands/run/config.rs index ffbfba5..0cf7b50 100644 --- a/src/commands/run/config.rs +++ b/src/commands/run/config.rs @@ -1,24 +1,29 @@ use crate::commands::link::link; use crate::utils::parser::{self, env::get_install_env}; use crate::utils::shell; - +use std::process::Command; pub fn config(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 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 pkgdata = crate::commands::get_aeropkg_var().join(repo).join(pkgname).join(".pkgdata"); - let config_script = match parser::get_config_script(pkg_md_path) { + if pkgdata.exists() { + let status = Command::new("cp").args(["-rPl", &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) } + } + + let config_script = match parser::get_config_script(&pkg_md_path) { Ok(script) => script, - Err(_) => { return } + Err(_) => return, }; - let full_env = get_install_env(repo, pkgname, pkg_md_path, "config"); - shell::run_install_script(&config_script, pkg_dir, &full_env); + let full_env = get_install_env(repo, pkgname, &pkg_md_path, "config"); + shell::run_install_script(&config_script, &pkg_dir, &full_env); shell::run_install_repo_stage_hook_script(repo, "config", &full_env); shell::run_install_stage_hook_script("download", &full_env); - - if !crate::commands::get_aeropkg_base().join(repo).join(pkgname).join("disabled").exists() { - link(repo, pkgname) + if !pkg_dir.join("disabled").exists() { + link(repo, pkgname); } } diff --git a/src/commands/run/download.rs b/src/commands/run/download.rs index 7eccc2b..6560079 100644 --- a/src/commands/run/download.rs +++ b/src/commands/run/download.rs @@ -9,8 +9,6 @@ pub fn download(repo: &String, pkgname: &String) { let pkg_md_path = &crate::commands::get_aeropkg_var().join(format!("{}/{}.md", repo, pkgname)); if !pkg_md_path.exists() { upload_from_repo(repo, pkgname, pkg_md_path) } - let full_env = get_install_env(repo, pkgname, pkg_md_path, "download"); - let url = match parser::pkginfo::get_url(pkg_md_path) { Ok(url) => url, Err(e) => { @@ -29,6 +27,14 @@ pub fn download(repo: &String, pkgname: &String) { 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(["-rPl", &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://") { let git_status = Command::new("git")