Skip to content

Commit

Permalink
ALL rpm compressed by xz, reduce 54MB total size
Browse files Browse the repository at this point in the history
  • Loading branch information
xlionjuan committed Jan 8, 2025
1 parent 930e6f7 commit ac0a394
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/create-repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ jobs:

- name: Reversion nightly version number with date
run: |
bash rustdesk_nightly_reversion.sh wwwroot/nightly/ori &\
bash rustdesk_nightly_reversion.sh wwwroot/nightly-suse/ori
bash rustdesk_nightly_reversion.sh wwwroot/nightly/ori IS_NIGHTLY &\
bash rustdesk_nightly_reversion.sh wwwroot/nightly-suse/ori IS_NIGHTLY &\
bash rustdesk_nightly_reversion.sh wwwroot/latest/ori "" &\
bash rustdesk_nightly_reversion.sh wwwroot/latest-suse/ori ""
echo "Run tree"
tree
Expand Down
2 changes: 1 addition & 1 deletion rustdesk_latest.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ echo "RUSTDESK_URL_AMD64_SUSE=\"$RUSTDESK_URL_AMD64_SUSE\""
echo "RUSTDESK_URL_ARM64_SUSE=\"$RUSTDESK_URL_ARM64_SUSE\""
echo ""
echo "------------------DOWNLOADING-----------------"
wget -P "wwwroot/latest" "$RUSTDESK_URL_AMD64" "$RUSTDESK_URL_ARM64" & wget -P "wwwroot/latest-suse" "$RUSTDESK_URL_AMD64_SUSE" "$RUSTDESK_URL_ARM64_SUSE"
wget -P "wwwroot/latest/ori" "$RUSTDESK_URL_AMD64" "$RUSTDESK_URL_ARM64" & wget -P "wwwroot/latest-suse/ori" "$RUSTDESK_URL_AMD64_SUSE" "$RUSTDESK_URL_ARM64_SUSE"

Empty file modified rustdesk_nightly.sh
100644 → 100755
Empty file.
21 changes: 20 additions & 1 deletion rustdesk_nightly_reversion.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,25 @@
set -oue pipefail

SOURCE_DIR="$1" # Directory containing the original .rpm files
IS_NIGHTLY_ARG="$2" # Input arg that determine whether needs reversion or not
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"

# Use $IS_NIGHTLY_ARG to determine it needs reversion or not
if [[ "$IS_NIGHTLY_ARG" == "IS_NIGHTLY" ]]; then
echo "IS_NIGHTLY passed in, will reversion."
IS_REVERSION=true
elif [[ -z "$IS_NIGHTLY_ARG" ]]; then
echo "IS_NIGHTLY IS NOT passed in, will repackage (recompression) only."
IS_REVERSION=false
else
echo "Unexpected input, exit."
exit 1
fi

# Iterate over all .rpm files in the source directory
for rpm_file in "$SOURCE_DIR"/*.rpm; do
if [ -f "$rpm_file" ]; then
Expand All @@ -17,9 +30,15 @@ for rpm_file in "$SOURCE_DIR"/*.rpm; do
# Extract the original version
ORIGINAL_VERSION=$(rpm -qp --qf '%{VERSION}' "$rpm_file")
NEW_VERSION="${ORIGINAL_VERSION}+$DATE"
# Arg determine by $IS_REVERSION
if [[ "$IS_REVERSION" == true ]]; then
FPM_RPM_VERSION_ARG="--version $NEW_VERSION"
else
FPM_RPM_VERSION_ARG=""
fi
# Rebuild the RPM using fpm
fpm -t rpm -s rpm \
--version "$NEW_VERSION" --rpm-compression xz\
$FPM_RPM_VERSION_ARG --rpm-compression xz\
-p "$TARGET_DIR/$(basename "$rpm_file")" \
"$rpm_file"
echo "Processed and moved to: $TARGET_DIR/$(basename "$rpm_file")"
Expand Down

0 comments on commit ac0a394

Please sign in to comment.