diff options
author | Silvino Silva <silvino@bk.ru> | 2019-03-02 19:11:42 +0000 |
---|---|---|
committer | Silvino Silva <silvino@bk.ru> | 2019-03-02 19:11:42 +0000 |
commit | 1eed6373ec0acf9bf7167dd1fa851a6db95f660d (patch) | |
tree | 7cd973cf0575f1a556d6d9722684cb0d6e9f610f /core | |
parent | e1c4cbc1da6cdfceb1b0046c7f47d345aecd9539 (diff) | |
download | doc-1eed6373ec0acf9bf7167dd1fa851a6db95f660d.tar.gz |
fix core script backup-ports.sh
Diffstat (limited to 'core')
-rw-r--r-- | core/scripts/backup-ports.sh | 84 |
1 files changed, 42 insertions, 42 deletions
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 \ |