-
Notifications
You must be signed in to change notification settings - Fork 0
/
rustdesk_nightly_reversion.sh
35 lines (30 loc) · 1.07 KB
/
rustdesk_nightly_reversion.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
#!/bin/bash
set -oue pipefail
SOURCE_DIR="$1" # Directory containing the original .rpm files
TARGET_DIR=$(dirname "$SOURCE_DIR") # Target directory is the parent directory of SOURCE_DIR
DATE=$(date +%Y%m%d) # Current date in YYYYMMDD format
# Ensure the target directory exists
mkdir -p "$TARGET_DIR"
# Iterate over all .rpm files in the source directory
for rpm_file in "$SOURCE_DIR"/*.rpm; do
if [ -f "$rpm_file" ]; then
(
echo "Processing: $rpm_file"
# Extract the original version
ORIGINAL_VERSION=$(rpm -qp --qf '%{VERSION}' "$rpm_file")
NEW_VERSION="${ORIGINAL_VERSION}+$DATE"
# Rebuild the RPM using fpm
fpm -t rpm -s rpm \
--version "$NEW_VERSION" \
-p "$TARGET_DIR/$(basename "$rpm_file")" \
"$rpm_file"
echo "Processed and moved to: $TARGET_DIR/$(basename "$rpm_file")"
) &
else
echo "Skipping: $rpm_file"
fi
done
wait
echo "Done, all modified files moved to: $TARGET_DIR"
echo "Cleanup....."
rm -rf "$SOURCE_DIR"