Repository navigation
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·116 lines (94 loc) · 3.24 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·116 lines (94 loc) · 3.24 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/bash
# RadioPlayer Installation Script
# ================================
set -e
echo "🎵 RadioPlayer Installation Script"
echo "==================================="
echo ""
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Check if running as root for system install
INSTALL_DIR="/usr/local"
if [ "$EUID" -ne 0 ]; then
echo -e "${YELLOW}Note: Running without sudo. Will install to ~/.local${NC}"
INSTALL_DIR="$HOME/.local"
mkdir -p "$INSTALL_DIR/bin"
mkdir -p "$INSTALL_DIR/share/radioplayer"
mkdir -p "$INSTALL_DIR/share/applications"
mkdir -p "$INSTALL_DIR/share/icons/hicolor/256x256/apps"
fi
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
# Step 1: Check dependencies
echo "📦 Checking dependencies..."
if ! command -v cmake &> /dev/null; then
echo -e "${RED}Error: cmake not found. Please install it first:${NC}"
echo " sudo apt install cmake"
exit 1
fi
if ! pkg-config --exists Qt6Widgets Qt6Multimedia Qt6Network 2>/dev/null; then
echo -e "${YELLOW}Warning: Qt6 development packages may not be installed.${NC}"
echo "Install them with: sudo apt install qt6-base-dev qt6-multimedia-dev"
read -p "Continue anyway? (y/n) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 1
fi
fi
# Step 2: Build the application
echo ""
echo "🔨 Building RadioPlayer..."
if [ -d "build" ]; then
rm -rf build
fi
mkdir build && cd build
cmake .. > /dev/null
make -j$(nproc)
if [ ! -f "RadioPlayer" ]; then
echo -e "${RED}Error: Build failed!${NC}"
exit 1
fi
echo -e "${GREEN}✓ Build successful!${NC}"
# Step 3: Install
echo ""
echo "📥 Installing RadioPlayer..."
if [ "$EUID" -eq 0 ]; then
# System-wide install (with sudo)
cp RadioPlayer "$INSTALL_DIR/bin/"
chmod +x "$INSTALL_DIR/bin/RadioPlayer"
mkdir -p "$INSTALL_DIR/share/radioplayer"
cp ../assets/stations.json "$INSTALL_DIR/share/radioplayer/"
cp ../assets/icon.png "$INSTALL_DIR/share/radioplayer/"
# Install desktop file
cp ../radioplayer.desktop /usr/share/applications/
# Install icon
mkdir -p /usr/share/icons/hicolor/256x256/apps
cp ../assets/icon.png /usr/share/icons/hicolor/256x256/apps/radioplayer.png
# Update icon cache
gtk-update-icon-cache /usr/share/icons/hicolor 2>/dev/null || true
else
# User install (without sudo)
cp RadioPlayer "$INSTALL_DIR/bin/"
chmod +x "$INSTALL_DIR/bin/RadioPlayer"
cp ../assets/stations.json "$INSTALL_DIR/share/radioplayer/"
cp ../assets/icon.png "$INSTALL_DIR/share/radioplayer/"
# Install desktop file
cp ../radioplayer.desktop "$INSTALL_DIR/share/applications/"
# Install icon
cp ../assets/icon.png "$INSTALL_DIR/share/icons/hicolor/256x256/apps/radioplayer.png"
# Update icon cache
gtk-update-icon-cache "$INSTALL_DIR/share/icons/hicolor" 2>/dev/null || true
fi
echo -e "${GREEN}✓ Installation complete!${NC}"
echo ""
echo "==================================="
echo -e "${GREEN}🎵 RadioPlayer installed successfully!${NC}"
echo ""
echo "Run with:"
echo " RadioPlayer"
echo ""
echo "Or find it in your application menu under 'Sound & Video'"
echo "==================================="