diff options
author | B Stack <bgstack15@gmail.com> | 2019-12-01 09:14:04 -0500 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2019-12-01 09:14:04 -0500 |
commit | 0f26a24a298e7f22fd3bef1fb1d6554af156f453 (patch) | |
tree | 00bd71cf330923ee62f5723bb7b8f0485f4c94b8 /newest-package-for-devuan | |
parent | add map.bat (diff) | |
download | former-gists-0f26a24a298e7f22fd3bef1fb1d6554af156f453.tar.gz former-gists-0f26a24a298e7f22fd3bef1fb1d6554af156f453.tar.bz2 former-gists-0f26a24a298e7f22fd3bef1fb1d6554af156f453.zip |
add newest-package-for-devuan
Diffstat (limited to 'newest-package-for-devuan')
-rw-r--r-- | newest-package-for-devuan/description | 1 | ||||
-rw-r--r-- | newest-package-for-devuan/newest-package-for-devuan.sh | 75 |
2 files changed, 76 insertions, 0 deletions
diff --git a/newest-package-for-devuan/description b/newest-package-for-devuan/description new file mode 100644 index 0000000..8276073 --- /dev/null +++ b/newest-package-for-devuan/description @@ -0,0 +1 @@ +customize binary dpkgs for devuan
\ No newline at end of file diff --git a/newest-package-for-devuan/newest-package-for-devuan.sh b/newest-package-for-devuan/newest-package-for-devuan.sh new file mode 100644 index 0000000..c971095 --- /dev/null +++ b/newest-package-for-devuan/newest-package-for-devuan.sh @@ -0,0 +1,75 @@ +#!/bin/sh +# File: /mnt/public/www/smith122/repo/devuan-deb/newest-package-for-devuan.sh +# License: CC-BY-SA 4.0 +# Author: bgstack15 +# Startdate: 2019-11-29 21:28 +# Title: Script that Manipulates Dependencies for a Binary Dpkg +# Purpose: Download latest version of python3-ipalib and modify it for internal use +# History: +# Usage: +# /mnt/public/www/smith122/repo/devuan-deb/ +# Next steps include running update-devuan-deb.sh to update the apt repo. +# Reference: +# Original research +# dpkg-architecture --list-known +# Improve: +# Dependencies: +# curl, dpkg-deb, sed, grep + +# FUNCTIONS +#customize_package "${PACKAGE}" "${DEPENDS_REMOVE}" "${DEPENDS_ADD}" "${SOURCE_DIR}" "${OUT_DIR}" +customize_package() { + # weaknesses: this might struggle with adding or removing "foobar (>= 0.1.1~bz2)" or other complex version numbers. + ___cp_package="${1}" + ___cp_depends_remove="${2}" + ___cp_depends_add="${3}" + ___cp_source_dir="${4}" + ___cp_out_dir="${5}" + + # Learn latest version to fetch + ___cp_newfile="$( curl -L -s "${___cp_source_dir}" | grep -oE ">${___cp_package}.*<\/a" | sed -r -e 's/^>//;' -e 's/<\/a$//;' )" + echo "Discovered filename ${___cp_newfile}" + curl -L -s "${___cp_source_dir}/${___cp_newfile}" -o "${___cp_newfile}" 1>/dev/null 2>&1 + ___cp_tmpdir="temp_${$}_deb" + mkdir -p "${___cp_tmpdir}" + dpkg-deb -R "${___cp_newfile}" "${___cp_tmpdir}" + + # Remove the requested dependencies + echo "${___cp_depends_remove}" | tr ',' '\n' | while read word ; + do + if test "${word}" != "" ; + then + echo "Removing dependency ${word}" + sed -i -r -e "s/[:,]\s+${word}[^,]{0,13}(,)?/\1/;" "${___cp_tmpdir}/DEBIAN/control" + fi + done + + # Add the requested dependencies + echo "${___cp_depends_add}" | tr ',' '\n' | while read word ; + do + if test "${word}" != "" ; + then + echo "Adding dependency ${word}" + sed -i -r -e "/^Depends:/s/$/, ${word}/" "${___cp_tmpdir}/DEBIAN/control" + fi + done + # Remove trailing comma, just in case + sed -i -r -e '/^Depends:/s/,\s*$//;' "${___cp_tmpdir}/DEBIAN/control" + + # Calculate new file name + ___cp_newfile2="$( echo "${___cp_newfile}" | sed -r -e 's/((_(amd64|i386|all))?\..{1,6})$/+stackrpms\1/;' )" + dpkg-deb -b "${___cp_tmpdir}" "${___cp_newfile2}" + + # Move to outdir + test -e "${___cp_newfile2}" && mv "${___cp_newfile2}" "${___cp_out_dir}/" + + # Clean up + rm -rf "${___cp_tmpdir}" "${___cp_newfile}" +} + +PACKAGE=python3-ipalib +DEPENDS_REMOVE="systemd" +DEPENDS_ADD="" +SOURCE_DIR="http://ftp.us.debian.org/debian/pool/main/f/freeipa" +OUT_DIR="/mnt/public/www/smith122/repo/devuan-deb/p" +customize_package "${PACKAGE}" "${DEPENDS_REMOVE}" "${DEPENDS_ADD}" "${SOURCE_DIR}" "${OUT_DIR}" |