85 lines
2.4 KiB
Bash
85 lines
2.4 KiB
Bash
|
|
#!/bin/bash
|
||
|
|
|
||
|
|
set -e
|
||
|
|
|
||
|
|
APP_NAME="Passport-C-Media-Player"
|
||
|
|
APP_VERSION="0.1"
|
||
|
|
OUTPUT_NAME="${APP_NAME}-${APP_VERSION}-x86_64.AppImage"
|
||
|
|
|
||
|
|
# Colors for output
|
||
|
|
RED='\033[0;31m'
|
||
|
|
GREEN='\033[0;32m'
|
||
|
|
YELLOW='\033[1;33m'
|
||
|
|
NC='\033[0m' # No Color
|
||
|
|
|
||
|
|
echo -e "${GREEN}Building ${APP_NAME} AppImage...${NC}"
|
||
|
|
|
||
|
|
# Check if binary exists
|
||
|
|
if [ ! -f "passport-c-media-player" ]; then
|
||
|
|
echo -e "${YELLOW}Binary not found. Building first...${NC}"
|
||
|
|
make clean
|
||
|
|
make
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Create AppDir structure
|
||
|
|
echo -e "${GREEN}Setting up AppDir...${NC}"
|
||
|
|
mkdir -p AppDir/usr/bin
|
||
|
|
mkdir -p AppDir/usr/share/applications
|
||
|
|
mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps
|
||
|
|
|
||
|
|
# Copy binary
|
||
|
|
cp passport-c-media-player AppDir/usr/bin/
|
||
|
|
chmod +x AppDir/usr/bin/passport-c-media-player
|
||
|
|
|
||
|
|
# Copy desktop file
|
||
|
|
cp AppDir/usr/share/applications/passport-c-media-player.desktop AppDir/
|
||
|
|
|
||
|
|
# Copy and convert icon
|
||
|
|
echo -e "${GREEN}Setting up icon...${NC}"
|
||
|
|
if [ -f "logo.png" ]; then
|
||
|
|
cp logo.png AppDir/usr/share/icons/hicolor/256x256/apps/passport-c-media-player.png
|
||
|
|
cp logo.png AppDir/passport-c-media-player.png
|
||
|
|
else
|
||
|
|
echo -e "${RED}Warning: logo.png not found!${NC}"
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Create AppRun symlink
|
||
|
|
cd AppDir
|
||
|
|
ln -sf usr/bin/passport-c-media-player AppRun
|
||
|
|
cd ..
|
||
|
|
|
||
|
|
# Download linuxdeploy if not present
|
||
|
|
if [ ! -f "linuxdeploy-x86_64.AppImage" ]; then
|
||
|
|
echo -e "${GREEN}Downloading linuxdeploy...${NC}"
|
||
|
|
wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
|
||
|
|
chmod +x linuxdeploy-x86_64.AppImage
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Download ffmpeg plugin if not present
|
||
|
|
if [ ! -f "linuxdeploy-plugin-ffmpeg.sh" ]; then
|
||
|
|
echo -e "${GREEN}Downloading ffmpeg plugin...${NC}"
|
||
|
|
wget -q https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-ffmpeg/master/linuxdeploy-plugin-ffmpeg.sh
|
||
|
|
chmod +x linuxdeploy-plugin-ffmpeg.sh
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Build AppImage
|
||
|
|
echo -e "${GREEN}Creating AppImage...${NC}"
|
||
|
|
./linuxdeploy-x86_64.AppImage \
|
||
|
|
--appdir AppDir \
|
||
|
|
--plugin ffmpeg \
|
||
|
|
--output appimage \
|
||
|
|
-d AppDir/usr/share/applications/passport-c-media-player.desktop \
|
||
|
|
-i AppDir/usr/share/icons/hicolor/256x256/apps/passport-c-media-player.png
|
||
|
|
|
||
|
|
# Rename output file
|
||
|
|
if [ -f "Passport_C_Media_Player-x86_64.AppImage" ]; then
|
||
|
|
mv "Passport_C_Media_Player-x86_64.AppImage" "${OUTPUT_NAME}"
|
||
|
|
fi
|
||
|
|
|
||
|
|
if [ -f "${OUTPUT_NAME}" ]; then
|
||
|
|
echo -e "${GREEN}Success! Created ${OUTPUT_NAME}${NC}"
|
||
|
|
ls -lh "${OUTPUT_NAME}"
|
||
|
|
else
|
||
|
|
echo -e "${RED}Error: AppImage creation failed!${NC}"
|
||
|
|
exit 1
|
||
|
|
fi
|