diff options
Diffstat (limited to 'core/scripts/backup-system.sh')
-rw-r--r-- | core/scripts/backup-system.sh | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/core/scripts/backup-system.sh b/core/scripts/backup-system.sh index ad037ef..c28c706 100644 --- a/core/scripts/backup-system.sh +++ b/core/scripts/backup-system.sh @@ -217,42 +217,44 @@ do METADATA=${DEST_SYS}/meta-data mkdir -p $METADATA - # must be using gwak instead of sed, xargs and echo - prt-get listinst -v | sed -s s/" "/#/g | xargs -i echo {}.pkg.tar.gz > ${METADATA}/all_installed.pkg + # must be using gwak instead of sed + prt-get listinst -v | sed 's/ /#/g' | sed 's/$/.pkg.tar.gz/g' > ${METADATA}/all-installed.pkg for filename in /etc/ports/*.git; do source $filename + # backup ports collection echo "Backing up collection: $NAME" - # create list of installed packages - prt-get printf "%i %p %n#%v-%r.pkg.tar.gz\n" | grep "yes /usr/ports/${NAME}" | cut -d " " -f 3 > ${METADATA}/${NAME}-installed.pkg - - # backup collection ports tar --xattrs -zcpf $PORT_PRT/${NAME}-ports.tar.gz \ --directory=$ROOT_DIR/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 > ${METADATA}/${NAME}-installed.pkg + # backup collection packages while read line; do - if [ ! -f /usr/ports/packages/${line} ]; then - echo "Building package: ${line};\n" - PORT_NAME=$(echo ${line} | cut -d "#" -f 1) - sudo prt-get update -fr -if -is ${PORT_NAME} - (cd /usr/ports/${NAME}/${PORT_NAME} \ + echo "Backing up package: ${NAME}/${line}" + # get installed version not version on ports + PACKAGE="$(cat ${METADATA}/all-installed.pkg | grep "^${line}#")" + if [ ! -f /usr/ports/packages/${PACKAGE} ]; then + echo "Building package: ${PACKAGE};\n" + sudo prt-get update -fr -if -is ${line} + (cd /usr/ports/${NAME}/${line} \ && sudo pkgmk -uf) fi - if [ -f /usr/ports/packages/${line} ]; then - echo "Backing up package: ${NAME}/${line}" - echo ${line} >> ${METADATA}/backup.pkg - #cp /usr/ports/packages/${line} ${PORT_PKG}/${col}/ + if [ -f /usr/ports/packages/${PACKAGE} ]; then + echo ${PACKAGE} >> ${METADATA}/${NAME}-backup.pkg + #cp /usr/ports/packages/${PACKAGE} ${PORT_PKG}/${NAME}/ tar rvf ${PORT_PKG}/${NAME}.tar \ --directory=/usr/ports/packages \ - ${line} + ${PACKAGE} else echo "Package $PORT_NAME not found: ${line}" - echo ${line} >> ${METADATA}/${NAME}-notfound.pkg + echo ${PACKAGE} >> ${METADATA}/${NAME}-notfound.pkg fi done < ${METADATA}/${NAME}-installed.pkg done @@ -261,3 +263,7 @@ do *) echo "Please enter only y or n" esac done + +RELEASE_NAME=$(basename ${DEST_DIR}) +tar -zcpf ${RELEASE_NAME}.tar.gz ${RELEASE_NAME}/ +rm -rf ${DEST_DIR} |