diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/cleanup | 46 | ||||
-rwxr-xr-x | scripts/uploadbuckets.sh | 58 |
2 files changed, 0 insertions, 104 deletions
diff --git a/scripts/cleanup b/scripts/cleanup deleted file mode 100755 index 0ccbe7d..0000000 --- a/scripts/cleanup +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/php -<?php -# Run this script by providing it with the top path of AUR. -# In that path you should see a file lib/aur.inc -# -# This will remove files which belong to deleted packages -# in unsupported. -# -# ex: php cleanup dev/aur/web -# -$dir = $argv[1]; - -if (empty($dir)) { - echo "Please specify AUR directory.\n"; - exit; -} - -set_include_path(get_include_path() . PATH_SEPARATOR . "$dir/lib"); -include("confparser.inc.php"); -include("aur.inc.php"); -include("pkgfuncs.inc.php"); - -$count = 0; - -$incoming_dir = config_get('paths', 'storage'); -$buckets = scandir($incoming_dir); -foreach ($buckets as $bucket) { - $bucketpath = $incoming_dir . $bucket; - if ($bucket == '.' || $bucket == '..' || !is_dir($bucketpath)) { - continue; - } - $files = scandir($incoming_dir . $bucket); - foreach ($files as $pkgname) { - if ($pkgname == '.' || $pkgname == '..') { - continue; - } - $fullpath = $incoming_dir . $bucket . "/" . $pkgname; - if (!pkg_from_name($pkgname) && is_dir($fullpath)) { - echo 'Removing ' . $fullpath . "\n"; - rm_tree($fullpath); - $count++; - } - } -} - -echo "\nRemoved $count directories.\n"; diff --git a/scripts/uploadbuckets.sh b/scripts/uploadbuckets.sh deleted file mode 100755 index 3252692..0000000 --- a/scripts/uploadbuckets.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash - -DRYRUN=${DRYRUN:-1} - -source="$1" -dest="$2" - -if [[ -z $source || -z $dest ]]; then - echo 'usage: uploadbuckets.sh <source> <dest>' - echo 'Script runs in DRYRUN mode by default.' - echo 'To run for real, set DRYRUN=0 in your environment.' - exit 1 -fi - -if [[ ! -d $source ]]; then - echo 'error: source is not a directory' - exit 1 -fi - -if [[ -e $dest && ! -d $dest ]]; then - echo 'error: dest is not a directory' - exit 1 -fi - -if [[ $(readlink -e $dest) = $(readlink -e $source) ]]; then - echo 'error: source and dest cannot be the same. Rotate the result' - echo 'into place once the migration is complete.' - exit 1 -fi - -if [[ ! -d $dest ]]; then - mkdir $dest -fi - -shopt -s nullglob - -for package in "$source"/*; do - pkgname="${package##*/}" - newfolder="$dest/${pkgname:0:2}" - if [[ ! -d "$newfolder" ]]; then - if [[ $DRYRUN -gt 0 ]]; then - echo mkdir -p "$newfolder" - else - mkdir -p "$newfolder" - fi - fi - if [[ $DRYRUN -gt 0 ]]; then - echo mv "$source/$pkgname" "$newfolder/$pkgname" - else - mv "$source/$pkgname" "$newfolder/$pkgname" - fi -done - -if [[ $DRYRUN -gt 0 ]]; then - echo - echo 'DRYRUN mode was enabled.' - echo 'To run for real, set DRYRUN=0 in your environment.' -fi |