diff options
author | Silvino Silva <silvino@bk.ru> | 2018-07-16 15:32:41 +0100 |
---|---|---|
committer | Silvino Silva <silvino@bk.ru> | 2018-07-16 15:32:41 +0100 |
commit | 214aa23801332d2120df208f9d9042fd51c5f2d3 (patch) | |
tree | afb5b18f789c68bbf577389ed5268cd2f896e66d /core/conf/ports/drivers | |
parent | bdea1c23d13c417a00b71654670aed309cfa302a (diff) | |
download | doc-214aa23801332d2120df208f9d9042fd51c5f2d3.tar.gz |
dumped new version 0.3.5
Diffstat (limited to 'core/conf/ports/drivers')
-rwxr-xr-x | core/conf/ports/drivers/git | 47 | ||||
-rwxr-xr-x | core/conf/ports/drivers/httpup | 27 | ||||
-rwxr-xr-x | core/conf/ports/drivers/rsync | 143 |
3 files changed, 0 insertions, 217 deletions
diff --git a/core/conf/ports/drivers/git b/core/conf/ports/drivers/git deleted file mode 100755 index 654a8c7..0000000 --- a/core/conf/ports/drivers/git +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh -# -# /etc/ports/drivers/git: git driver script for ports(8) -# - -if [ $# -ne 1 ]; then - echo "usage: $0 <file>" >&2 - exit 1 -fi - -. $1 - -if [ -z "$URL" ]; then - echo "URL not set in '$1'" >&2 - exit 2 -fi -if [ -z "$NAME" ]; then - echo "NAME not set in '$1'" >&2 - exit 2 -fi -if [ -z "$BRANCH" ]; then - echo "BRANCH not set in '$1'" >&2 - exit 2 -fi - -REPOSITORY="$PORTS_DIR/$NAME" -if [ -n "$LOCAL_REPOSITORY" ]; then - REPOSITORY="$LOCAL_REPOSITORY" -fi - -echo "Fetching updates from $URL" -echo "Updating collection $NAME" - -cd "$REPOSITORY" 2> "/dev/null" - -if [ $? -lt 1 ]; then - git checkout -q "$BRANCH" - git fetch -q - git diff --pretty=format: --name-status "$BRANCH" origin/"$BRANCH" | sed "s/M\t/ Edit /g; s/A\t/ Checkout /g; s/D\t/ Delete /g" | sort - git clean -q -f - git reset -q --hard origin/"$BRANCH" -else - git clone -q -b "$BRANCH" "$URL" "$REPOSITORY" - ls -1 $REPOSITORY | sed "s/^/ Checkout /" -fi - -echo "Finished successfully" diff --git a/core/conf/ports/drivers/httpup b/core/conf/ports/drivers/httpup deleted file mode 100755 index 5c8db84..0000000 --- a/core/conf/ports/drivers/httpup +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# -# /etc/ports/drivers/httpup: httpup driver script for ports(8) -# - -if [ $# -ne 1 ]; then - echo "usage: $0 <file>" >&2 - exit 1 -fi - -. $1 - -if [ -z "$ROOT_DIR" ]; then - echo "ROOT_DIR not set in '$1'" >&2 - exit 2 -fi -if [ -z "$URL" ]; then - echo "URL not set in '$1'" >&2 - exit 2 -fi - -for REPO in $URL; do - PORT=`echo $REPO | sed -n '/#.*$/s|^.*#||p'` - httpup sync $REPO $ROOT_DIR/$PORT -done - -# End of file. diff --git a/core/conf/ports/drivers/rsync b/core/conf/ports/drivers/rsync deleted file mode 100755 index 14dd3e5..0000000 --- a/core/conf/ports/drivers/rsync +++ /dev/null @@ -1,143 +0,0 @@ -#!/usr/bin/perl -# -# /etc/ports/drivers/rsync: rsync(1) driver script for ports(8) -# - -use warnings; -use strict; -use File::Basename; - -my $host = ''; -my $collection = ''; -my $destination = ''; -my %new_checkouts; -my %old_checkouts; - -sub error -{ - my $message = shift; - print "Error: $message ($!)\nUpdating failed\n"; - exit 1; -} - -sub warning -{ - my $message = shift; - print "Warning: $message ($!)\n"; -} - -if ($#ARGV < 0) -{ - print "Usage: $0 <file>\n"; - exit 1; -} - -open(FILE, $ARGV[0]) or error("Couldn't open $ARGV[0]"); -while (<FILE>) -{ - chomp; - if (/^host=(.*)/) { $host = $1; } - elsif (/^collection=(.*)/) { $collection = $1; } - elsif (/^destination=(.*)/) { $destination = $1; } -} -close(FILE); - -if ($host eq '') { error("Host field not set in $ARGV[0]"); } -if ($collection eq '') { error("Collection field not set in $ARGV[0]"); } -if ($destination eq '') { error("Destination field not set in $ARGV[0]"); } - -if (-e "$destination/.checkouts") -{ - # read the old .checkouts file into memory - open(FILE, "$destination/.checkouts") or error("Couldn't read checkouts from $destination/.checkouts"); - while (<FILE>) - { - chomp; - $old_checkouts{$_} = 1; - } - close(FILE); -} - -print "Updating file list from " . $host . "::$collection\n"; - -# get the remote file list (new .checkouts) -open(PIPE, 'rsync -crz --no-human-readable ' . $host . '::' . $collection . '|') or error("Couldn't open pipe to rsync"); -while (<PIPE>) -{ - chomp; - - next if /^MOTD:/; # ignore MOTD lines - s/^(.{43})//; # ignore the first 43 characters (mode, date etc...) - next if /^.$/; # ignore the . directory - - $new_checkouts{$_} = 1; -} -close(PIPE); -error("Running rsync failed") unless $? == 0; - -print "Updating collection " . basename($destination) . "\n"; - -# now really run rsync -open(PIPE, 'rsync -crz --no-human-readable --log-format "%o %n" ' . $host . "::$collection $destination|") or error("Couldn't open pipe to rsync"); -while (<PIPE>) -{ - chomp; - - if (/^recv (.*)/) - { - if ($old_checkouts{$1}) - { - s/^recv/ Edit/; - } - else - { - s/^recv/ Checkout/; - } - } - - print $_ . "\n"; -} -close(PIPE); -error("Running rsync failed") unless $? == 0; - -# save new checkouts into .checkouts -open(FILE, ">$destination/.checkouts") or error("Couldn't save checkouts to $destination/.checkouts"); -foreach my $checkout (sort keys %new_checkouts) -{ - print FILE "$checkout\n"; -} -close(FILE); - -# use chroot as an additional safety measure when removing files -chroot($destination) or error("Couldn't chroot into $destination"); -chdir('/'); - -# iterate through old checkouts, remove obsolete files -foreach my $checkout (sort keys %old_checkouts) -{ - if (!$new_checkouts{$checkout}) - { - if (-f $checkout) - { - print " Delete $checkout\n"; - unlink($checkout) or warning("Couldn't delete $checkout"); - } - } -} - -# iterate through old checkouts, remove obsolete directories -foreach my $checkout (sort keys %old_checkouts) -{ - if (!$new_checkouts{$checkout}) - { - if (-d $checkout) - { - print " Delete $checkout\n"; - rmdir($checkout) or warning("Couldn't delete $checkout"); - } - } -} - -print "Finished successfully\n"; - -# End of file |