74 lines
1.9 KiB
Bash
74 lines
1.9 KiB
Bash
|
|
#!/bin/bash
|
||
|
|
# Installation script for NotePad
|
||
|
|
# This script installs NotePad to /opt/notepad and creates a symlink in /usr/local/bin
|
||
|
|
|
||
|
|
set -e
|
||
|
|
|
||
|
|
APP_NAME="NotePad"
|
||
|
|
INSTALL_DIR="/opt/notepad"
|
||
|
|
BIN_LINK="/usr/local/bin/notepad"
|
||
|
|
DESKTOP_FILE="/usr/share/applications/notepad.desktop"
|
||
|
|
|
||
|
|
echo "============================================================"
|
||
|
|
echo "$APP_NAME Installer"
|
||
|
|
echo "============================================================"
|
||
|
|
echo ""
|
||
|
|
|
||
|
|
# Check if running as root
|
||
|
|
if [ "$EUID" -ne 0 ]; then
|
||
|
|
echo "❌ This script must be run as root (use sudo)"
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Get the directory where this script is located
|
||
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||
|
|
|
||
|
|
echo "Installing $APP_NAME..."
|
||
|
|
echo ""
|
||
|
|
|
||
|
|
# Create installation directory
|
||
|
|
echo "→ Creating installation directory: $INSTALL_DIR"
|
||
|
|
mkdir -p "$INSTALL_DIR"
|
||
|
|
|
||
|
|
# Copy files
|
||
|
|
echo "→ Copying application files..."
|
||
|
|
cp -r "$SCRIPT_DIR"/* "$INSTALL_DIR/"
|
||
|
|
|
||
|
|
# Make executable
|
||
|
|
chmod +x "$INSTALL_DIR/NotePad"
|
||
|
|
|
||
|
|
# Create symlink
|
||
|
|
echo "→ Creating symlink: $BIN_LINK"
|
||
|
|
ln -sf "$INSTALL_DIR/NotePad" "$BIN_LINK"
|
||
|
|
|
||
|
|
# Create desktop entry
|
||
|
|
echo "→ Creating desktop entry..."
|
||
|
|
cat > "$DESKTOP_FILE" << EOF
|
||
|
|
[Desktop Entry]
|
||
|
|
Name=NotePad
|
||
|
|
Comment=Simple text editor
|
||
|
|
Exec=notepad %F
|
||
|
|
Icon=text-editor
|
||
|
|
Type=Application
|
||
|
|
Categories=Utility;TextEditor;
|
||
|
|
Terminal=false
|
||
|
|
MimeType=text/plain;
|
||
|
|
EOF
|
||
|
|
|
||
|
|
# Update desktop database if available
|
||
|
|
if command -v update-desktop-database &> /dev/null; then
|
||
|
|
echo "→ Updating desktop database..."
|
||
|
|
update-desktop-database /usr/share/applications
|
||
|
|
fi
|
||
|
|
|
||
|
|
echo ""
|
||
|
|
echo "============================================================"
|
||
|
|
echo "✅ Installation complete!"
|
||
|
|
echo "============================================================"
|
||
|
|
echo ""
|
||
|
|
echo "You can now run $APP_NAME by typing: notepad"
|
||
|
|
echo "Or find it in your applications menu."
|
||
|
|
echo ""
|
||
|
|
echo "To uninstall, run: sudo $INSTALL_DIR/uninstall.sh"
|
||
|
|
echo ""
|