From e1c4cbc1da6cdfceb1b0046c7f47d345aecd9539 Mon Sep 17 00:00:00 2001 From: Silvino Silva Date: Sat, 2 Mar 2019 16:06:25 +0000 Subject: core scripts backup revision and added portspage patch --- core/scripts/backup-ports.sh | 89 +++++++++++++++++++++++++++++++++++++++++++ core/scripts/backup-system.sh | 74 ----------------------------------- core/scripts/portspage.patch | 27 +++++++++++++ 3 files changed, 116 insertions(+), 74 deletions(-) create mode 100644 core/scripts/backup-ports.sh create mode 100644 core/scripts/portspage.patch (limited to 'core') diff --git a/core/scripts/backup-ports.sh b/core/scripts/backup-ports.sh new file mode 100644 index 0000000..2951c59 --- /dev/null +++ b/core/scripts/backup-ports.sh @@ -0,0 +1,89 @@ +#!/bin/bash + +DEST_SYS=/usr/ports/releases/stable +DEST_ARC=/usr/ports/releases/archives + +#PRT_GET_FLAGS="-fr -if -is" +PRT_GET_FLAGS="-fr" + +# Build Name = R1 (System number) D1 (Droid/Machine number) +BUILD_NAME="R1D9" +#echo "Give build NAME;" +#echo "${DEST_ARC}/NAME-0.0.0.targ.gz" +#read BUILD_NAME + +echo "Give build CRUX_RELEASE.VERSION (3.4.X);" +echo "${DEST_ARC}/${BUILD_NAME}-VERSION.tar.gz" +read BUILD_VERSION + +mkdir -p ${DEST_SYS} +mkdir -p ${DEST_ARC} + +echo "${BUILD_NAME}-${BUILD_VERSION}" >> ${DEST_SYS}/build_version + +# archive pkgutils data +tar --xattrs -zcpf ${DEST_SYS}/pkg-db.tar.gz \ + /var/lib/pkg/db . + +# archive ports data +tar --xattrs -zcpf ${DEST_SYS}/etc_ports.tar.gz \ + --directory=/etc/ports \ + . +# 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 + +echo "Creating ${DEST_ARC}/${BUILD_NAME}-${BUILD_VERSION}.tar.gz ..." +tar rvf ${DEST_ARC}/${BUILD_NAME}-${BUILD_VERSION}.tar.gz \ + --directory=${DEST_SYS} . + +cd ${DEST_ARC} && tar -zcpf ${BUILD_NAME}-${BUILD_VERSION}.tar.gz ${DEST_SYS}/ + +echo "Creating links to /usr/ports/installed" +pkg_installed + +echo "Creating ports page" +portspage --title=${BUILD_NAME}-${BUILD_VERSION} /usr/ports/installed > /usr/ports/installed/index.html + diff --git a/core/scripts/backup-system.sh b/core/scripts/backup-system.sh index 7faf676..17c8c6a 100644 --- a/core/scripts/backup-system.sh +++ b/core/scripts/backup-system.sh @@ -193,77 +193,3 @@ do *) echo "Please enter only y or n" esac done - -# Port System -while true -do - echo "Backup Port System ?" - echo "Please confirm (y or n) :" - read CONFIRM - case $CONFIRM in - n|N|no|NO|No) break ;; - y|Y|YES|yes|Yes) - echo "Accept - you entered $CONFIRM" - - # archive pkgutils data - tar --xattrs -zcpf $DEST_SYS/pkg-db.tar.gz \ - /var/lib/pkg/db - - # archive ports data - tar --xattrs -zcpf $DEST_SYS/etc_ports.tar.gz \ - --directory=/etc/ports \ - . - - METADATA=${DEST_SYS}/meta-data - mkdir -p $METADATA - - # 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" - 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 - 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/${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 \ - ${PACKAGE} - else - echo "Package $PORT_NAME not found: ${line}" - echo ${PACKAGE} >> ${METADATA}/${NAME}-notfound.pkg - fi - done < ${METADATA}/${NAME}-installed.pkg - done - break - ;; - *) echo "Please enter only y or n" - esac -done - -RELEASE_NAME=$(basename ${DEST_DIR}) -cd $(dirname ${DEST_DIR}) && tar -zcpf ${RELEASE_NAME}.tar.gz ${RELEASE_NAME}/ -rm -rf ${DEST_DIR} diff --git a/core/scripts/portspage.patch b/core/scripts/portspage.patch new file mode 100644 index 0000000..c94ea4a --- /dev/null +++ b/core/scripts/portspage.patch @@ -0,0 +1,27 @@ +220c220 +< print "

$options{title}

\n"; +--- +> print "

Mirror | Crux | Git | Build errors | Distfiles | $options{title}.tar.gz | Archive

\n"; +233c233,238 +< print " PortVersionDescription"; +--- +> print " +> Project page +> Port +> Package +> Description"; +> +244,248c249,255 +< print " "; +< $db{$port}{URL} ? print "$port" : print "$port"; +< print "$db{$port}{version}-$db{$port}{release}"; +< print $db{$port}{Description} if $db{$port}{Description}; +< print ""; +--- +> my $port_collection=`prt-get info $port | grep "Path:" | cut -d ":" -f 2 | xargs basename`; +> print " "; +> $db{$port}{URL} ? print "$port" : print "$port"; +> #print "$db{$port}{version}-$db{$port}{release}"; +> print "$db{$port}{version}-$db{$port}{release}"; +> print "$port#$db{$port}{version}-$db{$port}{release}.pkg.tar.gz"; +> print "$db{$port}{Description}" if $db{$port}{Description}; -- cgit 1.4.1-2-gfad0 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') 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 From d3ff0010a7b7dbd1cf055d04421d91954201efa0 Mon Sep 17 00:00:00 2001 From: Silvino Silva Date: Sat, 2 Mar 2019 20:15:50 +0000 Subject: fix core script backup-ports.sh remove /usr/ports/installed --- core/scripts/backup-ports.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'core') diff --git a/core/scripts/backup-ports.sh b/core/scripts/backup-ports.sh index dfdb55a..3e42c49 100644 --- a/core/scripts/backup-ports.sh +++ b/core/scripts/backup-ports.sh @@ -82,6 +82,7 @@ tar rvf ${DEST_ARC}/${BUILD_NAME}-${BUILD_VERSION}.tar.gz \ cd ${DEST_ARC} && tar -zcpf ${BUILD_NAME}-${BUILD_VERSION}.tar.gz ${DEST_SYS}/ echo "Creating links to /usr/ports/installed" +rm -r /usr/ports/installed pkg_installed echo "Creating ports page" -- cgit 1.4.1-2-gfad0 From accd5243374fba50577e3e3e80135ed5eef7c324 Mon Sep 17 00:00:00 2001 From: Silvino Silva Date: Sun, 3 Mar 2019 02:46:25 +0000 Subject: fix core scripts backup-ports.sh archive --- core/scripts/backup-ports.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'core') diff --git a/core/scripts/backup-ports.sh b/core/scripts/backup-ports.sh index 3e42c49..46fd4c6 100644 --- a/core/scripts/backup-ports.sh +++ b/core/scripts/backup-ports.sh @@ -28,6 +28,7 @@ tar --xattrs -zcpf ${DEST_SYS}/pkg-db.tar.gz \ # archive ports data tar --xattrs -zcpf ${DEST_SYS}/etc_ports.tar.gz \ --directory=/etc/ports \ + . . # 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 @@ -76,10 +77,9 @@ for filename in /etc/ports/*.git; do done echo "Creating ${DEST_ARC}/${BUILD_NAME}-${BUILD_VERSION}.tar.gz ..." -tar rvf ${DEST_ARC}/${BUILD_NAME}-${BUILD_VERSION}.tar.gz \ - --directory=${DEST_SYS} . - -cd ${DEST_ARC} && tar -zcpf ${BUILD_NAME}-${BUILD_VERSION}.tar.gz ${DEST_SYS}/ +tar --xattrs -zcpf ${DEST_ARC}/${BUILD_NAME}-${BUILD_VERSION}.tar.gz \ + --directory=${DEST_SYS} \ + . echo "Creating links to /usr/ports/installed" rm -r /usr/ports/installed -- cgit 1.4.1-2-gfad0 From b1a383c919d31f00f591a0b712891c74a7513783 Mon Sep 17 00:00:00 2001 From: Silvino Silva Date: Sun, 3 Mar 2019 22:50:48 +0000 Subject: ports back and restore revision --- core/scripts/backup-ports.sh | 152 +++++++++++++++++++++++------------------- core/scripts/restore-ports.sh | 53 +++++++++++++++ 2 files changed, 136 insertions(+), 69 deletions(-) create mode 100644 core/scripts/restore-ports.sh (limited to 'core') diff --git a/core/scripts/backup-ports.sh b/core/scripts/backup-ports.sh index 46fd4c6..b5667e4 100644 --- a/core/scripts/backup-ports.sh +++ b/core/scripts/backup-ports.sh @@ -19,72 +19,86 @@ read BUILD_VERSION mkdir -p ${DEST_SYS} mkdir -p ${DEST_ARC} -echo "${BUILD_NAME}-${BUILD_VERSION}" >> ${DEST_SYS}/build_version - -# archive pkgutils data -tar --xattrs -zcpf ${DEST_SYS}/pkg-db.tar.gz \ - /var/lib/pkg/db . - -# archive ports data -tar --xattrs -zcpf ${DEST_SYS}/etc_ports.tar.gz \ - --directory=/etc/ports \ - . - . -# 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 - -echo "Creating ${DEST_ARC}/${BUILD_NAME}-${BUILD_VERSION}.tar.gz ..." -tar --xattrs -zcpf ${DEST_ARC}/${BUILD_NAME}-${BUILD_VERSION}.tar.gz \ - --directory=${DEST_SYS} \ - . - -echo "Creating links to /usr/ports/installed" -rm -r /usr/ports/installed -pkg_installed - -echo "Creating ports page" -portspage --title=${BUILD_NAME}-${BUILD_VERSION} /usr/ports/installed > /usr/ports/installed/index.html - +backup_collections() { + + # backup collection packages + while read COLL_VERSION; do + COLL_NAME=$(echo $COLL_VERSION | cut -d "-" -f 1) + COLL_RELEASE=$(echo $COLL_VERSION | cut -d "-" -f 2) + + while read PORT_NAME; do + # get installed version not version on ports + PACKAGE=$(grep "^${PORT_NAME}#" ${DEST_SYS}/all-installed.pkg) + echo "Backing up 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} + fi + + if [ -f /usr/ports/packages/${PACKAGE} ]; then + echo ${PACKAGE} >> ${DEST_SYS}/${COLL_NAME}-backup.pkg + tar rvf ${DEST_SYS}/${COLL_NAME}-${COLL_RELEASE}.tar --directory=/usr/ports/packages ${PACKAGE} + else + echo "Package ${PACKAGE} from ${PORT_NAME} port not found." + echo ${PACKAGE} >> ${DEST_SYS}/${COLL_NAME}-${COLL_RELEASE}-notfound.pkg + fi + done < ${DEST_SYS}/${COLL_NAME}-installed.pkg + done < ${DEST_SYS}/ports_versions.pkg +} + +create_metadata() { + echo "${BUILD_NAME}-${BUILD_VERSION}" >> ${DEST_SYS}/build_version + + # archive pkgutils data + tar --xattrs -zcpf ${DEST_SYS}/pkg-db.tar.gz /var/lib/pkg/db . + + # archive ports data + tar --xattrs -zcpf ${DEST_SYS}/etc_ports.tar.gz --directory=/etc/ports . + + # 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 + + if [ -f ${DEST_SYS}/ports_versions ]; then + rm ${DEST_SYS}/ports_versions.pkg + fi + + for filename in /etc/ports/*.git; do + source $filename + + echo "${NAME} port collection release (exp; ${BUILD_VERSION}):" + + read RELEASE + echo ${NAME}-${RELEASE} >> ${DEST_SYS}/ports_versions.pkg + + # 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 + done +} + +create_archive() { + echo "Creating ${DEST_ARC}/${BUILD_NAME}-${BUILD_VERSION}.tar.gz ..." + tar --xattrs -zcpf ${DEST_ARC}/${BUILD_NAME}-${BUILD_VERSION}.tar.gz --directory=${DEST_SYS} . +} + +update_host() { + echo "Creating links to /usr/ports/installed" + rm -r /usr/ports/installed + pkg_installed + + echo "Creating ports page" + portspage --title=${BUILD_NAME}-${BUILD_VERSION} /usr/ports/installed > /usr/ports/installed/index.html +} + +create_metadata +backup_collections +create_archive +update_host diff --git a/core/scripts/restore-ports.sh b/core/scripts/restore-ports.sh new file mode 100644 index 0000000..39f5178 --- /dev/null +++ b/core/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://hive.gnu.systems/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}/ports_versions.pkg +} + +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}/ports_versions.pkg + + # 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 -- cgit 1.4.1-2-gfad0 From d8ca8eb382059b22ae8a8cf17578713241a9a085 Mon Sep 17 00:00:00 2001 From: Silvino Silva Date: Mon, 4 Mar 2019 14:54:54 +0000 Subject: core iptables scripts revision --- core/conf/iptables/ipt-bridge.sh | 14 ++++++++++++-- core/conf/iptables/ipt-conf.sh | 1 + core/conf/iptables/ipt-firewall.sh | 2 +- core/conf/rc.d/iptables | 4 ++-- 4 files changed, 16 insertions(+), 5 deletions(-) (limited to 'core') diff --git a/core/conf/iptables/ipt-bridge.sh b/core/conf/iptables/ipt-bridge.sh index 6ad26fa..fa987a5 100644 --- a/core/conf/iptables/ipt-bridge.sh +++ b/core/conf/iptables/ipt-bridge.sh @@ -109,9 +109,11 @@ $IPT -A INPUT -i ${WIFI_IF} -p udp --sport 137 --dport 137 -j DROP $IPT -A INPUT -i ${WIFI_IF} -p udp --sport 138 --dport 138 -j DROP $IPT -A INPUT -i ${BR_IF} -d ${PUB_IP} -s ${BR_NET} -j srv_icmp +$IPT -A INPUT -i ${BR_IF} -d ${WIFI_NET} -s ${BR_NET} -j srv_icmp $IPT -A INPUT -i ${BR_IF} -d ${PUB_IP} -s ${BR_NET} -j srv_dns_in $IPT -A INPUT -i ${WIFI_IF} -d ${PUB_IP} -s ${WIFI_NET} -j srv_dns_in +$IPT -A INPUT -i ${WIFI_IF} -s ${WIFI_NET} -d ${WIFI_NET} -j srv_dns_in $IPT -A INPUT -i ${BR_IF} -j srv_dhcp $IPT -A INPUT -i ${BR_IF} -s ${GW} -d ${PUB_IP} -j srv_dhcp @@ -129,6 +131,11 @@ $IPT -A INPUT -i ${WIFI_IF} -j cli_http_in $IPT -A INPUT -i ${WIFI_IF} -j cli_git_in $IPT -A INPUT -i ${WIFI_IF} -j cli_ssh_in +# c2.ank /iso -> c9.ank /srv/qemu/iso +$IPT -A INPUT -i ${BR_IF} -m physdev --physdev-in tap2 -d ${PUB_IP} -j srv_http_in +# hyperbola servers +$IPT -A INPUT -p tcp --dport 1024:65535 --sport 50100 -m state --state RELATED,ESTABLISHED -j ACCEPT + ####### Output Chain ###### $IPT -A OUTPUT -j blocker @@ -139,6 +146,7 @@ $IPT -A OUTPUT -o ${BR_IF} -s ${PUB_IP} -d ${DNS} -j cli_dns_out $IPT -A OUTPUT -o ${BR_IF} -s ${PUB_IP} -d ${BR_NET} -j srv_dns_out $IPT -A OUTPUT -o ${BR_IF} -s ${PUB_IP} -d ${BR_NET} -j srv_ssh_out $IPT -A OUTPUT -o ${BR_IF} -s ${PUB_IP} -d ${BR_NET} -j srv_icmp +$IPT -A OUTPUT -o ${BR_IF} -s ${WIFI_NET} -d ${BR_NET} -j srv_icmp $IPT -A OUTPUT -o ${BR_IF} -s ${PUB_IP} -d ${BR_NET} -j cli_ssh_out $IPT -A OUTPUT -o ${BR_IF} -s ${PUB_IP} -d ${BR_NET} -j cli_git_out @@ -149,7 +157,6 @@ $IPT -A OUTPUT -o ${BR_IF} -s ${PUB_IP} -j cli_https_out $IPT -A OUTPUT -o ${BR_IF} -s ${PUB_IP} -j cli_http_out $IPT -A OUTPUT -o ${BR_IF} -s ${PUB_IP} -j cli_git_out - $IPT -A OUTPUT -o ${WIFI_IF} -d ${DNS} -j cli_dns_out $IPT -A OUTPUT -o ${WIFI_IF} -d ${WIFI_NET} -j srv_dns_out $IPT -A OUTPUT -o ${WIFI_IF} -j srv_dns_out @@ -159,7 +166,10 @@ $IPT -A OUTPUT -o ${WIFI_IF} -j cli_git_out $IPT -A OUTPUT -o ${WIFI_IF} -j cli_https_out $IPT -A OUTPUT -o ${WIFI_IF} -j cli_http_out -#$IPT -A OUTPUT -o ${BR_IF} -s ${PUB_IP} -j cli_ssh_out +# Hyperbola servers +$IPT -A OUTPUT -p tcp --sport 1024:65535 --dport 50100 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT +# c2.ank /iso -> c9.ank /srv/qemu/iso +$IPT -A OUTPUT -o ${BR_IF} -s ${PUB_IP} -d 10.0.0.4 -j srv_http_out ####### PostRouting Chain ###### #Less noise diff --git a/core/conf/iptables/ipt-conf.sh b/core/conf/iptables/ipt-conf.sh index eef0b52..52669dc 100644 --- a/core/conf/iptables/ipt-conf.sh +++ b/core/conf/iptables/ipt-conf.sh @@ -12,6 +12,7 @@ GW="10.0.0.1" #GW="10.0.0.2" #DNS="10.0.0.254" DNS="212.55.154.174" +#DNS="8.8.8.8" PUB_IP="10.0.0.254" PUB_IF="enp8s0" diff --git a/core/conf/iptables/ipt-firewall.sh b/core/conf/iptables/ipt-firewall.sh index 4697de0..6ea613a 100644 --- a/core/conf/iptables/ipt-firewall.sh +++ b/core/conf/iptables/ipt-firewall.sh @@ -197,7 +197,7 @@ ipt_tables () { $IPT -A cli_ftp_in -j RETURN $IPT -A cli_ftp_out -p tcp --dport 21 --sport 1024:65535 -m state --state NEW,ESTABLISHED -j ACCEPT $IPT -A cli_ftp_out -p tcp --dport 20 --sport 1024:65535 -m state --state ESTABLISHED -j ACCEPT - $IPT -A cli_ftp_out -p tcp --sport 1024:65535 --dport 1024:65535 -m state --state ESTABLISHED,RELATED,NEW -j ACCEPT + $IPT -A cli_ftp_out -p tcp --sport 1024:65535 --dport 1024:65535 -m state --state ESTABLISHED,RELATED -j ACCEPT $IPT -A cli_ftp_out -j RETURN ######## GIT client diff --git a/core/conf/rc.d/iptables b/core/conf/rc.d/iptables index 26a48b4..9471f99 100644 --- a/core/conf/rc.d/iptables +++ b/core/conf/rc.d/iptables @@ -13,13 +13,13 @@ case $1 in ## log everything else and drop ipt_log - iptables-save > /etc/iptables/net.v4 + iptables-save > /etc/iptables/bridge.v4 ;; server) source /etc/iptables/iptables-conf.sh ## log everything else and drop - iptables_log + ipt_log iptables-save > /etc/iptables/net.v4 ;; -- cgit 1.4.1-2-gfad0 From ae082636f51217bd22a23b3b8f218aff450b81d8 Mon Sep 17 00:00:00 2001 From: Silvino Silva Date: Mon, 4 Mar 2019 16:29:53 +0000 Subject: tmux and vimrc configuration files fixs --- core/conf/skel/.tmux.conf | 2 +- tools/conf/etc/skel/.vimrc | 55 ++++++++++++++++++++++++++++++---------------- 2 files changed, 37 insertions(+), 20 deletions(-) (limited to 'core') diff --git a/core/conf/skel/.tmux.conf b/core/conf/skel/.tmux.conf index 4feb9a4..ee127e8 100644 --- a/core/conf/skel/.tmux.conf +++ b/core/conf/skel/.tmux.conf @@ -9,7 +9,7 @@ bind-key -T copy-mode-vi 'y' send-keys -X copy-selection-and-cancel # copy tmux's selection buffer into the primary X selection with PREFIX+CTRL+Y bind-key u run "tmux save-buffer - | xsel -ib" # copy primary X selection into tmux's selection buffer with PREFIX+CTRL+P -bind-key e run "xsel -o | tmux load-buffer -" +bind-key e run "xsel -ob | tmux load-buffer -" set-option -g set-titles on set-option -g set-titles-string '#S> #I.#P #W' diff --git a/tools/conf/etc/skel/.vimrc b/tools/conf/etc/skel/.vimrc index 9958538..2a45faf 100644 --- a/tools/conf/etc/skel/.vimrc +++ b/tools/conf/etc/skel/.vimrc @@ -37,22 +37,24 @@ set incsearch " do incremental searching if &t_Co > 2 || has("gui_running") syntax on set hlsearch + set background=dark colorscheme wombat256mod + " colorscheme desert endif -" + "" Only do this part when compiled with support for autocommands. -"if has("autocmd") +if has("autocmd") " " " Enable file type detection. " " Use the default filetype settings, so that mail gets 'tw' set to 72, " " 'cindent' is on in C files, etc. " " Also load indent files, to automatically do language-dependent indenting. -" filetype plugin indent on + filetype plugin indent on " " " Put these in an autocmd group, so that we can delete them easily. -" augroup vimrcEx -" au! + augroup vimrcEx + au! " " " For all text files set 'textwidth' to 78 characters. " autocmd FileType text setlocal textwidth=78 @@ -60,19 +62,18 @@ endif " " When editing a file, always jump to the last known cursor position. " " Don't do it when the position is invalid or when inside an event handler " " (happens when dropping a file on gvim). -" autocmd BufReadPost * -" \ if line("'\"") >= 1 && line("'\"") <= line("$") | -" \ exe "normal! g`\"" | -" \ endif -" -" augroup END -" -"else -" -" set autoindent " always set autoindenting on -" -"endif " has("autocmd") -" + autocmd BufReadPost * + \ if line("'\"") >= 1 && line("'\"") <= line("$") | + \ exe "normal! g`\"" | + \ endif + + augroup END + +else + set autoindent " always set autoindenting on + +endif " has("autocmd") + "" Convenient command to see the difference between the current buffer and the "" file it was loaded from, thus the changes you made. "" Only define it when not defined already. @@ -87,7 +88,23 @@ endif " " compatible). " set langnoremap "endif -" + +" Search down into subfolders +" Provides tab-completion for all file-related tasks +set path+=** + +" Display all matching files when we tab complete +set wildmenu + +" Better file browsing +let g:netrw_banner=0 " disable annoying banner +let g:netrw_browse_split=4 " open in prior window +let g:netrw_altv=1 " open splits to the right +let g:netrw_liststyle=3 " tree view +let g:netrw_list_hide=netrw_gitignore#Hide() +let g:netrw_list_hide.=',\(^\|\s\s\)\zs\.\S\+' + + map :tabnew map :tabprevious map :tabnext -- cgit 1.4.1-2-gfad0