forked from RisingOSS-devices/RisingOS-Builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupload.sh
87 lines (78 loc) · 2.17 KB
/
upload.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/env bash
set -e
upload_to_drive() {
local file="$1"
rclone copy "$file" rising:Release/$CODENAME -P
if [ $? -eq 0 ]; then
echo "Uploaded $file to drive successfully."
else
echo "Error: Upload of $file to drive failed."
return 1
fi
}
upload_to_sourceforge() {
local file="$1"
echo "Attempting to upload $file to SourceForge..."
sshpass -p "$SF_PASSWORD" rsync -avP -e "ssh -o StrictHostKeyChecking=no" "$file" $SF_USERNAME@$SF_HOST:/home/frs/project/risingos-test/$CODENAME/
if [ $? -eq 0 ]; then
echo "Uploaded $file to SourceForge successfully."
else
echo "Error: Upload of $file to SourceForge failed."
return 1
fi
}
if [ "$#" -gt 1 ]; then
usage
fi
if [ "$1" == "-sf" ]; then
DESTINATION="sourceforge"
else
DESTINATION="drive"
fi
TARGET_DIR="/home/sketu/rising/out/target/product/${CODENAME}"
if [ ! -d "$TARGET_DIR" ]; then
echo "Error: Target directory '$TARGET_DIR' does not exist."
exit 1
fi
cd "$TARGET_DIR"
case "$RELEASE" in
stable)
echo "RELEASE is set to 'stable'. Uploading stable build..."
DESTINATION="drive"
;;
test)
echo "RELEASE is set to 'test'. Uploading test build..."
DESTINATION="sourceforge"
;;
*)
echo "Error: Invalid RELEASE value. Must be 'stable' or 'test'."
exit 1
;;
esac
FILES=(Rising*.zip)
for FILE in "${FILES[@]}"; do
if [ ! -e "$FILE" ]; then
echo "Error: File '$FILE' not found in $TARGET_DIR."
exit 1
fi
done
case $DESTINATION in
drive)
for FILE in "${FILES[@]}"; do
upload_to_drive "$FILE" || exit 1
done
echo "All uploads to drive completed."
echo "Uploaded to here: https://download-risingos.pages.dev/$CODENAME"
;;
sourceforge)
for FILE in "${FILES[@]}"; do
upload_to_sourceforge "$FILE" || exit 1
done
echo "All uploads to SourceForge completed."
echo "Uploaded to here: https://sourceforge.net/projects/risingos-test/files/$CODENAME"
;;
*)
echo "Error: Invalid destination '$DESTINATION'."
exit 1
;;
esac