diff options
author | Silvino <silvino@bk.ru> | 2021-02-25 23:22:17 +0000 |
---|---|---|
committer | Silvino <silvino@bk.ru> | 2021-02-25 23:22:17 +0000 |
commit | d12b35a47b9a872ecb5e037f1c2b02e1ea8927fb (patch) | |
tree | 8fdac6dfc8cabb9f85a2db3a3bd628cfe44438cd /linux/scripts/restore-ports.sh | |
parent | 0a6b0fc9769daf0932cb207c3285baa31547b489 (diff) | |
parent | a3628fc49db4d88ff3e4067268650710d1da3f6f (diff) | |
download | doc-d12b35a47b9a872ecb5e037f1c2b02e1ea8927fb.tar.gz |
merge openbsd branch into develop
new directory layout
Diffstat (limited to 'linux/scripts/restore-ports.sh')
-rw-r--r-- | linux/scripts/restore-ports.sh | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/linux/scripts/restore-ports.sh b/linux/scripts/restore-ports.sh new file mode 100644 index 0000000..cf886ab --- /dev/null +++ b/linux/scripts/restore-ports.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +BUILD_NAME=R1D9 +BUILD_VERSION=3.4.1 +WORK_DIR=/usr/ports/work/${BUILD_NAME}-${BUILD_VERSION} + +prepare_archive() { + mkdir -p ${WORK_DIR} + wget --directory-prefix=${WORK_DIR} https://tribu.semdestino.org/mirror/releases/archives/${BUILD_NAME}-${BUILD_VERSION}.tar.gz + echo "extracting ${WORK_DIR}/${BUILD_NAME}-${BUILD_VERSION}.tar.gz..." + tar -C ${WORK_DIR} -xf ${WORK_DIR}/${BUILD_NAME}-${BUILD_VERSION}.tar.gz + rm ${WORK_DIR}/${BUILD_NAME}-${BUILD_VERSION}.tar.gz +} + +extract_archives() { + while read COLL_VERSION; do + COLL_NAME=$(echo $COLL_VERSION | cut -d "-" -f 1) + COLL_RELEASE=$(echo $COLL_VERSION | cut -d "-" -f 2) + echo "extracting ${COLL_VERSION}.tar to /usr/ports/packages" + tar -C /usr/ports/packages -xf ${WORK_DIR}/${COLL_VERSION}.tar + rm ${WORK_DIR}/${COLL_VERSION}.tar + done < ${WORK_DIR}/metadata/ports-releases +} + +update_system() { + mkdir -p ${WORK_DIR}/etc/ports + tar -C ${WORK_DIR}/etc/ports -xf ${WORK_DIR}/etc_ports.tar.gz + cp ${WORK_DIR}/etc/ports/*.git /etc/ports/ + + while read COLL_VERSION; do + COLL_NAME=$(echo $COLL_VERSION | cut -d "-" -f 1) + ports -u $COLL_NAME + done < ${WORK_DIR}/metadata/ports-releases + + # first update with prt-get + prt-get sysup + prt-get --pre-install --post-install update $(prt-get listinst) + prt-get depinst $(prt-get printf "%p %n\n" | grep "/usr/ports/core" | cut -d " " -f 2) + prt-get update $(revdep) + + rejmerge +} + +install_distro() { + while read PACKAGE; do + prt-get depinst $(echo $PACKAGE | cut -d "#" -f 1); + done < ${WORK_DIR}/all-installed.pkg +} + +prepare_archive +extract_archives +update_system +install_distro |