Trust uboot's device list only if it does not look suspicious.
[AROS.git] / scripts / nightly-clean
blob5ee175459e601d74d0e15632056a49e18053262a
1 #!/bin/bash
3 ##############################################################################
4 # Removes incomplete or broken nightly build files from the upload directory.
6 #-- Setup & Configuration ----------------------------------------------------
7 ROOT=/home/groups/a/ar/aros
8 SRC="$ROOT/uploads/nightly"
9 LOCK="$SRC.lock"
11 #-- Acquire Lock -------------------------------------------------------------
12 lockfile -r 0 "$LOCK"
13 if [[ $? != 0 ]]; then
14 echo Could not acquire lock. Aborting...
15 exit 1
18 #-- Remove Stale Files -------------------------------------------------------
19 cd "$SRC"
21 count=$(($(ls -1 | wc -l) - 1))
22 for directory in *; do
23 if [[ $count -gt 0 ]]; then
24 rm -rf "$directory"
25 count=$((count - 1))
27 done
29 #-- Release Lock -------------------------------------------------------------
30 rm -f "$LOCK"