From 1eed6373ec0acf9bf7167dd1fa851a6db95f660d Mon Sep 17 00:00:00 2001 From: Silvino Silva Date: Sat, 2 Mar 2019 19:11:42 +0000 Subject: fix core script backup-ports.sh --- core/scripts/backup-ports.sh | 84 ++++++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 42 deletions(-) (limited to 'core/scripts') diff --git a/core/scripts/backup-ports.sh b/core/scripts/backup-ports.sh index 2951c59..dfdb55a 100644 --- a/core/scripts/backup-ports.sh +++ b/core/scripts/backup-ports.sh @@ -32,48 +32,48 @@ tar --xattrs -zcpf ${DEST_SYS}/etc_ports.tar.gz \ # must be using gwak instead of sed prt-get listinst -v | sed 's/ /#/g' | sed 's/$/.pkg.tar.gz/g' > ${DEST_SYS}/all-installed.pkg -#for filename in /etc/ports/*.git; do -# source $filename -# -# echo "${NAME} port collection release (exp; ${BUILD_VERSION}):" -# -# read RELEASE -# # backup ports collection -# echo "Backing up collection: ${NAME}" -# tar --xattrs -zcpf ${DEST_SYS}/${NAME}-ports-${RELEASE}.tar.gz \ -# --directory=/usr/ports/${NAME} \ -# --exclude=.git/ \ -# . -# -# # create list of installed packages -# prt-get printf "%i %p %n\n" | grep "yes /usr/ports/${NAME}" | cut -d " " -f 3 > ${DEST_SYS}/${NAME}-installed.pkg -# -# # backup collection packages -# while read PORT_NAME; do -# echo "Backing up package: ${NAME}/${PORT_NAME}" -# # get installed version not version on ports -# PACKAGE=$(grep "^${PORT_NAME}#" ${DEST_SYS}/all-installed.pkg) -# echo "Package: ${PACKAGE}"; -# -# # check if binary package exist -# if [ ! -f /usr/ports/packages/${PACKAGE} ]; then -# echo "Building package: ${PACKAGE};" -# sudo prt-get update ${PRT_GET_FLAGS} ${PORT_NAME} -# #(cd /usr/ports/${NAME}/${line} \ -# # && sudo pkgmk -uf) -# fi -# -# if [ -f /usr/ports/packages/${PACKAGE} ]; then -# echo ${PACKAGE} >> ${DEST_SYS}/${NAME}-backup.pkg -# tar rvf ${DEST_SYS}/${NAME}-${RELEASE}.tar \ -# --directory=/usr/ports/packages \ -# ${PACKAGE} -# else -# echo "Package ${PACKAGE} from ${PORT_NAME} port not found." -# echo ${PACKAGE} >> ${DEST_SYS}/${NAME}-notfound.pkg -# fi -# done < ${DEST_SYS}/${NAME}-installed.pkg -#done +for filename in /etc/ports/*.git; do + source $filename + + echo "${NAME} port collection release (exp; ${BUILD_VERSION}):" + + read RELEASE + # backup ports collection + echo "Backing up collection: ${NAME}" + tar --xattrs -zcpf ${DEST_SYS}/${NAME}-ports-${RELEASE}.tar.gz \ + --directory=/usr/ports/${NAME} \ + --exclude=.git/ \ + . + + # create list of installed packages + prt-get printf "%i %p %n\n" | grep "yes /usr/ports/${NAME}" | cut -d " " -f 3 > ${DEST_SYS}/${NAME}-installed.pkg + + # backup collection packages + while read PORT_NAME; do + echo "Backing up package: ${NAME}/${PORT_NAME}" + # get installed version not version on ports + PACKAGE=$(grep "^${PORT_NAME}#" ${DEST_SYS}/all-installed.pkg) + echo "Package: ${PACKAGE}"; + + # check if binary package exist + if [ ! -f /usr/ports/packages/${PACKAGE} ]; then + echo "Building package: ${PACKAGE};" + sudo prt-get update ${PRT_GET_FLAGS} ${PORT_NAME} + #(cd /usr/ports/${NAME}/${line} \ + # && sudo pkgmk -uf) + fi + + if [ -f /usr/ports/packages/${PACKAGE} ]; then + echo ${PACKAGE} >> ${DEST_SYS}/${NAME}-backup.pkg + tar rvf ${DEST_SYS}/${NAME}-${RELEASE}.tar \ + --directory=/usr/ports/packages \ + ${PACKAGE} + else + echo "Package ${PACKAGE} from ${PORT_NAME} port not found." + echo ${PACKAGE} >> ${DEST_SYS}/${NAME}-notfound.pkg + fi + done < ${DEST_SYS}/${NAME}-installed.pkg +done echo "Creating ${DEST_ARC}/${BUILD_NAME}-${BUILD_VERSION}.tar.gz ..." tar rvf ${DEST_ARC}/${BUILD_NAME}-${BUILD_VERSION}.tar.gz \ -- cgit 1.4.1-2-gfad0