Bash · 1647 bytes Raw Blame History
1 #!/usr/bin/env bash
2 # Deploy fortress RPM to repos.musicsian.com
3 set -euo pipefail
4
5 SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6 REPO_DIR="$HOME/src/repos-musicsian-com"
7
8 # Get version from spec file
9 VERSION=$(grep "^Version:" "$SCRIPT_DIR/fortress.spec" | awk '{print $2}')
10 RELEASE=$(grep "^Release:" "$SCRIPT_DIR/fortress.spec" | awk '{print $2}' | cut -d'%' -f1)
11 NAME="fortress"
12
13 echo "======================================================================"
14 echo " Deploying $NAME-$VERSION-$RELEASE to repos.musicsian.com"
15 echo "======================================================================"
16 echo ""
17
18 # Check if RPM exists
19 RPM_FILE=$(find ~/rpmbuild/RPMS -name "$NAME-$VERSION-$RELEASE*.rpm" | head -1)
20 if [ -z "$RPM_FILE" ]; then
21 echo "❌ Error: RPM not found. Did you run ./build-rpm.sh first?"
22 exit 1
23 fi
24
25 echo "▶ Found RPM: $RPM_FILE"
26
27 # Copy RPM to repo
28 echo "▶ Copying RPM to repo directory..."
29 cp -v "$RPM_FILE" "$REPO_DIR/RPMS/"
30
31 # Copy fortress.repo file if not already present
32 if [ ! -f "$REPO_DIR/fortress.repo" ]; then
33 echo "▶ Creating fortress.repo file..."
34 cp -v "$REPO_DIR/fuss.repo" "$REPO_DIR/fortress.repo"
35 sed -i 's/fuss/fortress/g' "$REPO_DIR/fortress.repo"
36 sed -i 's/Tree utility for dirty git files/Terminal file explorer in Fortran/' "$REPO_DIR/fortress.repo"
37 fi
38
39 echo ""
40 echo "✓ RPM deployed to: $REPO_DIR/RPMS/"
41 echo ""
42 echo "Next steps:"
43 echo " 1. cd $REPO_DIR"
44 echo " 2. git add RPMS/$NAME-*.rpm fortress.repo"
45 echo " 3. git commit -m 'Add fortress $VERSION-$RELEASE'"
46 echo " 4. ./deploy.sh # This will sign, create metadata, and deploy to server"
47 echo ""