about summary refs log tree commit diff stats
path: root/core
diff options
context:
space:
mode:
authorSilvino Silva <silvino@bk.ru>2019-03-02 16:06:25 +0000
committerSilvino Silva <silvino@bk.ru>2019-03-02 16:06:25 +0000
commite1c4cbc1da6cdfceb1b0046c7f47d345aecd9539 (patch)
tree55c74b57c0ab3c1b5bca9f5930cfdc33ea2c55fe /core
parent4d95146424bae0ddec124f5dd5d70aa7e97548ee (diff)
downloaddoc-e1c4cbc1da6cdfceb1b0046c7f47d345aecd9539.tar.gz
core scripts backup revision and added portspage patch
Diffstat (limited to 'core')
-rw-r--r--core/scripts/backup-ports.sh89
-rw-r--r--core/scripts/backup-system.sh74
-rw-r--r--core/scripts/portspage.patch27
3 files changed, 116 insertions, 74 deletions
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 "  <h2>$options{title}</h2>\n";
+---
+> 	print "  <h2><a href=\"https://hive.gnu.systems/wiki/mirror\">Mirror</a> | <a href=\"https://hive.gnu.systems/wiki/crux\">Crux</a> | <a href=\"https://hive.gnu.systems/git/\">Git</a> | <a href=\"https://hive.gnu.systems/mirror/bugs/\">Build errors</a> | <a href=\"https://hive.gnu.systems/mirror/distfiles/\">Distfiles</a> | <a href=\"https://hive.gnu.systems/mirror/releases/archives/$options{title}.tar.gz\">$options{title}.tar.gz</a> | <a href=\"https://hive.gnu.systems/mirror/archive/\">Archive</a></h2>\n";
+233c233,238
+< 	print "   <tr class=\"header\"><td><b>Port</b></td><td><b>Version</b></td><td><b>Description</b></td>";
+---
+> 	print "   <tr class=\"header\">
+> 	<td><b>Project page</b></td>
+> 	<td><b>Port</b></td>
+> 	<td><b>Package</b></td>
+> 	<td><b>Description</b></td>";
+> 
+244,248c249,255
+< 		print "   <tr class=\"$odd\"><td>";
+< 		$db{$port}{URL} ? print "<a href=\"$db{$port}{URL}\">$port</a>" : print "$port";
+< 		print "</td><td><a href=\"$options{directory}/$port/\">$db{$port}{version}-$db{$port}{release}</a></td><td>";
+< 		print $db{$port}{Description} if $db{$port}{Description};
+< 		print "</td>";
+---
+> 		my $port_collection=`prt-get info $port | grep "Path:" | cut -d ":" -f 2 | xargs basename`;
+> 		print "   <tr class=\"$odd\">";
+> 		$db{$port}{URL} ? print "<td><a href=\"$db{$port}{URL}\">$port</a></td>" : print "<td>$port</td>";
+> 		#print "</td><td><a href=\"$options{directory}/$port/\">$db{$port}{version}-$db{$port}{release}</a></td><td>";
+> 		print "<td><a href=\"https://hive.gnu.systems/git/$port_collection.git/tree/refs/heads/master\:/$port\">$db{$port}{version}-$db{$port}{release}</a></td>";
+> 		print "<td><a href=\"https://hive.gnu.systems/mirror/packages/$port%23$db{$port}{version}-$db{$port}{release}.pkg.tar.gz\">$port#$db{$port}{version}-$db{$port}{release}.pkg.tar.gz</a></td>";
+> 		print "<td>$db{$port}{Description}</td>" if $db{$port}{Description};