kino/install.sh

47 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Simple installation script for GTK2 MPV Player
if [ "$EUID" -ne 0 ]; then
echo "Please run as root (use sudo)"
exit 1
fi
INSTALL_DIR="/usr/local/lib/gtk2-mpv-player"
BIN_LINK="/usr/local/bin/gtk2-mpv-player"
DESKTOP_FILE="/usr/share/applications/gtk2-mpv-player.desktop"
echo "Installing to $INSTALL_DIR..."
# Create directory
mkdir -p "$INSTALL_DIR"
# Copy binary and metadata using 'install' to handle running processes correctly
install -m 755 gtk2-mpv-player "$INSTALL_DIR/"
install -m 644 assets/icon.png "$INSTALL_DIR/"
# For directory copy, we use cp but remove destination first to ensure clean update
rm -rf "$INSTALL_DIR/lib"
cp -r lib "$INSTALL_DIR/"
# Create wrapper script
cat <<EOF > "$BIN_LINK"
#!/bin/bash
cd "$INSTALL_DIR"
./gtk2-mpv-player "\$@"
EOF
chmod +x "$BIN_LINK"
# Install desktop file
cp assets/gtk2-mpv-player.desktop "$DESKTOP_FILE"
# Update path in desktop file if needed (already set to /usr/local/bin/gtk2-mpv-player)
# Update MIME database
echo "Updating MIME database..."
update-desktop-database
echo "Installation complete!"
echo "Installed version timestamp: $(date -r "$INSTALL_DIR/gtk2-mpv-player")"
echo "You can now run 'gtk2-mpv-player' or find it in your application menu."