initial commit
+585 · 2 files changed
-
paintstorm-icon.pngbinary -
paintstorm-install-distrobox.sh+585 −0
Binary files /dev/null and b/paintstorm-icon.png differ @@ -0,0 +1,585 @@ +#!/bin/bash +set -e + +echo "==========================================" +echo "Paintstorm Studio Distrobox Setup" +echo "v2.3 - With Pen Tablet Support (Fixed)" +echo "==========================================" +echo "" + +# Configuration +CONTAINER_NAME="paintstorm-legacy" +PAINTSTORM_DIR="/usr/share/paintstorm" +WRAPPER_SCRIPT="$HOME/paintstorm" + +# Colors +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' + +# Check prerequisites +if ! command -v distrobox &> /dev/null; then + echo -e "${RED}Error: distrobox is not installed${NC}" + echo "Install it with: sudo pacman -S distrobox" + exit 1 +fi + +if ! command -v podman &> /dev/null && ! command -v docker &> /dev/null; then + echo -e "${RED}Error: Neither podman nor docker is installed${NC}" + echo "Install podman with: sudo pacman -S podman" + exit 1 +fi + +# Check for X11 +if [ -z "$DISPLAY" ]; then + echo -e "${RED}Error: X11 DISPLAY not set${NC}" + echo "Make sure you're running in an X11 session" + exit 1 +fi + +# Detect NVIDIA GPU +NVIDIA_FLAG="" +if lspci | grep -i nvidia &> /dev/null; then + echo -e "${BLUE}NVIDIA GPU detected!${NC}" + NVIDIA_FLAG="--nvidia" + echo -e "${GREEN}Container will be created with NVIDIA support${NC}" +fi + +# Detect input devices for pen tablet support +echo "" +echo -e "${BLUE}Detecting input devices...${NC}" +INPUT_DEVICES=$(find /dev/input -name 'event*' -o -name 'js*' -o -name '*wacom*' -o -name '*tablet*' 2>/dev/null | head -10) +if [ -n "$INPUT_DEVICES" ]; then + echo -e "${GREEN}Found input devices:${NC}" + echo "$INPUT_DEVICES" + + # Build additional flags for container + ADDITIONAL_FLAGS="" + for dev in $INPUT_DEVICES; do + if [ -c "$dev" ]; then + ADDITIONAL_FLAGS="$ADDITIONAL_FLAGS --device $dev" + fi + done + + # Also add X11 socket + X11_SOCKET="/tmp/.X11-unix/X$(echo $DISPLAY | cut -d: -f2 | cut -d. -f1)" + if [ -S "$X11_SOCKET" ]; then + ADDITIONAL_FLAGS="$ADDITIONAL_FLAGS --volume $X11_SOCKET:$X11_SOCKET" + fi + + # Add Xauthority if exists + if [ -f "$XAUTHORITY" ]; then + ADDITIONAL_FLAGS="$ADDITIONAL_FLAGS --volume $XAUTHORITY:$XAUTHORITY" + elif [ -f "$HOME/.Xauthority" ]; then + ADDITIONAL_FLAGS="$ADDITIONAL_FLAGS --volume $HOME/.Xauthority:$HOME/.Xauthority" + fi + + echo -e "${GREEN}Additional flags:${NC} $ADDITIONAL_FLAGS" +else + echo -e "${YELLOW}No input devices found (check /dev/input/*)${NC}" + ADDITIONAL_FLAGS="" +fi + +echo "" +echo -e "${GREEN}Step 1: Creating Ubuntu 20.04 distrobox container...${NC}" + +if distrobox list | grep -q "$CONTAINER_NAME"; then + echo -e "${YELLOW}Container '$CONTAINER_NAME' already exists.${NC}" + read -p "Remove and recreate? [y/N]: " -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + distrobox rm -f "$CONTAINER_NAME" + echo "Creating new container with tablet support..." + distrobox create --image ubuntu:20.04 --name "$CONTAINER_NAME" $NVIDIA_FLAG --additional-flags "$ADDITIONAL_FLAGS" --yes + fi +else + echo "Creating container with tablet support..." + distrobox create --image ubuntu:20.04 --name "$CONTAINER_NAME" $NVIDIA_FLAG --additional-flags "$ADDITIONAL_FLAGS" --yes +fi + +echo "" +echo -e "${GREEN}Step 2: Setting up Paintstorm environment in container...${NC}" + +# Create setup script +cat > /tmp/paintstorm-container-setup.sh << 'INNER_SCRIPT' +#!/bin/bash +set -e + +echo "===================================" +echo "Container Setup" +echo "===================================" + +# Configure locale +echo "Configuring UTF-8 locale..." +sudo apt update +sudo apt install -y locales +sudo locale-gen en_US.UTF-8 +sudo update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 + +if ! grep -q "export LC_ALL=en_US.UTF-8" ~/.bashrc; then + echo 'export LANG=en_US.UTF-8' >> ~/.bashrc + echo 'export LC_ALL=en_US.UTF-8' >> ~/.bashrc +fi + +export LANG=en_US.UTF-8 +export LC_ALL=en_US.UTF-8 + +echo "" +echo "Installing build dependencies..." +export DEBIAN_FRONTEND=noninteractive +sudo apt install -y \ + build-essential \ + wget \ + tar \ + libgl1-mesa-dev \ + libglu1-mesa-dev \ + libx11-dev \ + libxext-dev \ + libxi-dev \ + libxmu-dev \ + patchelf + +echo "" +echo "Installing runtime dependencies..." +sudo apt install -y \ + libgl1-mesa-glx \ + libglu1-mesa \ + libx11-6 \ + libxext6 \ + libxi6 \ + libxrandr2 \ + libxrender1 \ + libgtk2.0-0 \ + libpng16-16 \ + libfreetype6 \ + libfontconfig1 \ + libxinerama1 \ + libxcursor1 \ + libxcomposite1 \ + libxdamage1 \ + libxfixes3 \ + libftgl-dev \ + libftgl2 \ + libcurl4-gnutls-dev \ + evtest + +# Install X11 input libraries for tablet support +echo "" +echo "Installing X11 input libraries for tablet support..." +sudo apt install -y \ + libxi6 \ + libxtst6 \ + libxinerama1 \ + x11-xserver-utils \ + xinput \ + x11-apps \ + x11-utils + +# NVIDIA environment +if lspci | grep -i nvidia &> /dev/null; then + echo "Configuring NVIDIA environment..." + if ! grep -q "export __GLX_VENDOR_LIBRARY_NAME=nvidia" ~/.bashrc; then + echo 'export __GLX_VENDOR_LIBRARY_NAME=nvidia' >> ~/.bashrc + fi + export __GLX_VENDOR_LIBRARY_NAME=nvidia +fi + +echo "" +echo "Installing fonts (basic set, no CJK)..." +sudo apt install -y \ + fonts-liberation \ + fonts-liberation2 \ + fonts-dejavu \ + fonts-dejavu-extra \ + fonts-freefont-ttf \ + fonts-ubuntu \ + ttf-mscorefonts-installer + +echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections + +echo "" +echo "Rebuilding font cache..." +sudo fc-cache -fv + +echo "" +echo "Building GLEW 1.13.0 from source..." +cd /tmp +if [ ! -f "glew-1.13.0.tgz" ]; then + wget -q https://downloads.sourceforge.net/glew/glew-1.13.0.tgz +fi +tar xzf glew-1.13.0.tgz +cd glew-1.13.0 +sed -i 's|lib64|lib|' config/Makefile.linux +make -j$(nproc) +echo "GLEW compiled successfully!" + +echo "" +echo "Setting up Paintstorm directory..." +sudo mkdir -p /usr/share/paintstorm +sudo chown -R $USER:$USER /usr/share/paintstorm + +echo "" +echo "Creating font directories (crash prevention)..." +sudo mkdir -p /usr/share/fonts/opentype +sudo mkdir -p /usr/share/fonts/truetype +sudo touch /usr/share/fonts/opentype/.paintstorm +sudo touch /usr/share/fonts/truetype/.paintstorm + +# Create input device symlinks if needed +echo "" +echo "Checking input devices..." +if [ -d "/dev/input" ]; then + echo "Input devices in container:" + ls -la /dev/input/by-id/ 2>/dev/null || echo "No input devices found" + + # Test xinput + echo "" + echo "Testing xinput..." + xinput list 2>/dev/null || echo "xinput not available or no devices" +fi + +echo "" +echo "Container setup complete!" +INNER_SCRIPT + +chmod +x /tmp/paintstorm-container-setup.sh +distrobox enter "$CONTAINER_NAME" -- bash /tmp/paintstorm-container-setup.sh + +echo "" +echo -e "${BLUE}====================================================================" +echo "Paintstorm Installation" +echo "====================================================================${NC}" +echo "" + +# Auto-detect installer +INSTALLER_PATH="" +SEARCH_PATHS=( + "$(pwd)/Paintstorm_linux_v2.50.run" + "$HOME/Downloads/Paintstorm_linux_v2.50.run" + "$HOME/Paintstorm_linux_v2.50.run" +) + +# Check specific paths +for path in "${SEARCH_PATHS[@]}"; do + if [ -f "$path" ]; then + INSTALLER_PATH="$path" + echo -e "${GREEN}Found installer: $INSTALLER_PATH${NC}" + break + fi +done + +# Search current directory for any Paintstorm .run file +if [ -z "$INSTALLER_PATH" ]; then + FOUND_RUN=$(find "$(pwd)" -maxdepth 1 -name "Paintstorm*.run" -type f 2>/dev/null | head -1) + if [ -n "$FOUND_RUN" ]; then + INSTALLER_PATH="$FOUND_RUN" + echo -e "${GREEN}Found installer: $INSTALLER_PATH${NC}" + fi +fi + +# Install if found +if [ -n "$INSTALLER_PATH" ]; then + echo "" + echo "Installing Paintstorm..." + + # Extract to a clean temp directory + EXTRACT_DIR="/tmp/paintstorm-extract-$$" + mkdir -p "$EXTRACT_DIR" + + echo "Extracting installer..." + # We use --target, but we will find the actual folder dynamically + sh "$INSTALLER_PATH" --noexec --target "$EXTRACT_DIR" + + # Dynamically find where the 'paintstorm' binary folder is + ACTUAL_SRC=$(find "$EXTRACT_DIR" -type d -name "paintstorm" | head -n 1) + + if [ -z "$ACTUAL_SRC" ]; then + echo -e "${RED}Error: Extraction failed to produce a 'paintstorm' directory${NC}" + ls -R "$EXTRACT_DIR" + exit 1 + fi + + echo "Copying files from $ACTUAL_SRC to container..." + distrobox enter "$CONTAINER_NAME" -- bash << INSTALL_CMD + set -e + + # Copy Paintstorm files using the dynamically found path + sudo cp -r "$ACTUAL_SRC/"* /usr/share/paintstorm/ + + # Copy GLEW libraries + if [ -f /tmp/glew-1.13.0/lib/libGLEW.so ]; then + sudo cp /tmp/glew-1.13.0/lib/libGLEW.so* /usr/share/paintstorm/ + fi + + # Fix RPATH + sudo patchelf --set-rpath '\$ORIGIN' /usr/share/paintstorm/Paintstorm + + # Set permissions + sudo chown -R \$USER:\$USER /usr/share/paintstorm + sudo chmod +x /usr/share/paintstorm/Paintstorm + + echo "Installation complete!" +INSTALL_CMD + + # Cleanup + rm -rf "$EXTRACT_DIR" + +else + echo -e "${YELLOW}Paintstorm installer not found.${NC}" + echo "" + read -p "Enter path to Paintstorm_linux_v2.50.run (or 'skip'): " user_path + + if [ "$user_path" != "skip" ] && [ -f "$user_path" ]; then + EXTRACT_DIR="/tmp/paintstorm-extract-$$" + mkdir -p "$EXTRACT_DIR" + cd "$EXTRACT_DIR" + sh "$user_path" --noexec --target "$EXTRACT_DIR/paintstorm_files" + + distrobox enter "$CONTAINER_NAME" -- bash << INSTALL_CMD + sudo cp -r "$EXTRACT_DIR/paintstorm_files/PaintstormInstall/paintstorm/"* /usr/share/paintstorm/ + sudo cp /tmp/glew-1.13.0/lib/libGLEW.so* /usr/share/paintstorm/ + sudo patchelf --set-rpath '\$ORIGIN' /usr/share/paintstorm/Paintstorm + sudo chown -R \$USER:\$USER /usr/share/paintstorm + sudo chmod +x /usr/share/paintstorm/Paintstorm +INSTALL_CMD + rm -rf "$EXTRACT_DIR" + else + echo -e "${YELLOW}Skipping installation.${NC}" + fi +fi + +echo "" +echo -e "${GREEN}Step 3: Verifying installation...${NC}" + +if distrobox enter "$CONTAINER_NAME" -- test -f "$PAINTSTORM_DIR/Paintstorm"; then + echo -e "${GREEN}✓ Paintstorm binary found!${NC}" + + # Verify GLEW + if distrobox enter "$CONTAINER_NAME" -- test -f "$PAINTSTORM_DIR/libGLEW.so.1.13"; then + echo -e "${GREEN}✓ GLEW 1.13 libraries installed!${NC}" + fi + + # Verify font directories + if distrobox enter "$CONTAINER_NAME" -- test -d "/usr/share/fonts/opentype"; then + echo -e "${GREEN}✓ Font crash prevention configured!${NC}" + fi + + echo "" + echo -e "${GREEN}Step 4: Creating wrapper script with tablet support...${NC}" + + # Get X11 socket path + X11_SOCKET="/tmp/.X11-unix/X$(echo $DISPLAY | cut -d: -f2 | cut -d. -f1)" + + cat > "$WRAPPER_SCRIPT" << 'LAUNCHER' +#!/bin/bash +# Set up environment for tablet support +export XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-/run/user/$(id -u)} +export WAYLAND_DISPLAY=${WAYLAND_DISPLAY:-} +export QT_QPA_PLATFORM=${QT_QPA_PLATFORM:-xcb} +export GDK_BACKEND=${GDK_BACKEND:-x11} +export SDL_VIDEODRIVER=${SDL_VIDEODRIVER:-x11} + +# Additional tablet environment variables +export WACOMDEBUG=1 +export XINPUT_GXI=1 + +# Debug info +echo "=== Paintstorm Launch Debug ===" +echo "DISPLAY: $DISPLAY" +echo "XAUTHORITY: ${XAUTHORITY:-$HOME/.Xauthority}" +echo "Input devices available:" +ls -la /dev/input/by-id/ 2>/dev/null || echo "No input devices found" +echo "===============================" + +# Launch Paintstorm +distrobox-enter -n paintstorm-legacy -- bash -c " + export LANG=en_US.UTF-8 + export LC_ALL=en_US.UTF-8 + export DISPLAY=$DISPLAY + export XAUTHORITY=${XAUTHORITY:-$HOME/.Xauthority} + export __GLX_VENDOR_LIBRARY_NAME=nvidia + + # Additional tablet env vars + export WACOMDEBUG=1 + export XINPUT_GXI=1 + + # Debug container devices + echo 'Container input devices:' + ls -la /dev/input/by-id/ 2>/dev/null || echo 'No input devices in container' + echo 'xinput list:' + xinput list 2>/dev/null || echo 'xinput not available' + + cd /usr/share/paintstorm + exec ./Paintstorm \"\$@\" +" +LAUNCHER + chmod +x "$WRAPPER_SCRIPT" + echo -e "${GREEN}✓ Created $WRAPPER_SCRIPT with tablet support${NC}" + + echo "" + echo -e "${GREEN}Step 5: Creating desktop launcher...${NC}" + + mkdir -p ~/.local/share/applications + cat > ~/.local/share/applications/paintstorm.desktop << EOF +[Desktop Entry] +Version=1.0 +Type=Application +Name=Paintstorm Studio +Comment=Digital Painting Software +Exec=$WRAPPER_SCRIPT +Icon=$HOME/.local/share/icons/hicolor/256x256/apps/paintstorm.png +Terminal=false +Categories=Graphics;2DGraphics;RasterGraphics; +MimeType=image/png;image/jpeg;image/jpg;image/bmp;image/tiff;image/psd; +StartupNotify=true +StartupWMClass=Paintstorm +EOF + + if command -v desktop-file-validate &> /dev/null; then + if desktop-file-validate ~/.local/share/applications/paintstorm.desktop 2>/dev/null; then + echo -e "${GREEN}✓ Desktop file is valid${NC}" + fi + fi + + echo "" + echo -e "${GREEN}Step 6: Setting up icon...${NC}" + mkdir -p ~/.local/share/icons/hicolor/256x256/apps + + # Check for paintstorm-icon.png + if [ -f "paintstorm-icon.png" ]; then + cp paintstorm-icon.png ~/.local/share/icons/hicolor/256x256/apps/paintstorm.png + echo -e "${GREEN}✓ Icon installed from paintstorm-icon.png${NC}" + elif [ -f "$HOME/paintstorm-icon.png" ]; then + cp "$HOME/paintstorm-icon.png" ~/.local/share/icons/hicolor/256x256/apps/paintstorm.png + echo -e "${GREEN}✓ Icon installed from ~/paintstorm-icon.png${NC}" + else + echo -e "${YELLOW}⚠ paintstorm-icon.png not found in current directory${NC}" + echo " Place paintstorm-icon.png here and run: cp paintstorm-icon.png ~/.local/share/icons/hicolor/256x256/apps/paintstorm.png" + fi + + # Update databases + update-desktop-database ~/.local/share/applications 2>/dev/null || true + gtk-update-icon-cache ~/.local/share/icons/hicolor/ -f 2>/dev/null || true + + # XFCE restart + if command -v xfce4-panel &> /dev/null; then + echo "" + echo -e "${BLUE}Restarting XFCE panel...${NC}" + xfce4-panel --restart 2>/dev/null || true + fi + + echo "" + echo -e "${GREEN}==========================================" + echo "✓ Installation Complete!" + echo "==========================================${NC}" + echo "" + echo -e "${GREEN}Launch:${NC}" + echo " • Application menu → Graphics → Paintstorm Studio" + echo " • Command: $WRAPPER_SCRIPT" + echo "" + echo -e "${GREEN}Components:${NC}" + echo " ✓ Paintstorm Studio v2.50" + echo " ✓ GLEW 1.13.0" + echo " ✓ Font crash prevention" + echo " ✓ Basic fonts (no CJK)" + echo " ✓ Tablet/input device support" + distrobox enter "$CONTAINER_NAME" -- bash -c "echo ' ✓ Fonts: '\$(fc-list | wc -l)" + if [ -n "$NVIDIA_FLAG" ]; then + echo " ✓ NVIDIA GPU support" + fi + echo "" + echo -e "${BLUE}Debugging Tablet Support:${NC}" + echo " 1. Check input devices: ls -la /dev/input/by-id/" + echo " 2. Test xinput: xinput list" + echo " 3. Run with debug: WACOMDEBUG=1 $WRAPPER_SCRIPT" + echo "" + +else + echo -e "${RED}✗ Paintstorm not found${NC}" + echo "" + echo "Manual installation:" + echo " distrobox enter $CONTAINER_NAME" + echo " sudo cp /tmp/glew-1.13.0/lib/libGLEW.so* /usr/share/paintstorm/" + echo " sudo patchelf --set-rpath '\$ORIGIN' /usr/share/paintstorm/Paintstorm" +fi + +# Create management script +cat > ~/paintstorm-manage.sh << 'MANAGE_SCRIPT' +#!/bin/bash +CONTAINER_NAME="paintstorm-legacy" +EXPORT_FILE="paintstorm-container-$(date +%Y%m%d).tar" + +echo "Paintstorm Container Management" +echo "================================" +echo "1) Export container" +echo "2) Import container" +echo "3) Container info" +echo "4) Test tablet input" +echo "5) Fix tablet permissions" +echo "6) Exit" +read -p "Choice: " choice + +case $choice in + 1) + if command -v podman &> /dev/null; then + podman commit $CONTAINER_NAME paintstorm-legacy-image + podman save paintstorm-legacy-image -o "$EXPORT_FILE" + else + docker commit $CONTAINER_NAME paintstorm-legacy-image + docker save paintstorm-legacy-image -o "$EXPORT_FILE" + fi + echo "✓ Exported to $EXPORT_FILE" + ;; + 2) + read -p "Enter .tar file: " tarfile + if [ -f "$tarfile" ]; then + if command -v podman &> /dev/null; then + podman load -i "$tarfile" + NVIDIA_FLAG=$(lspci | grep -qi nvidia && echo "--nvidia" || echo "") + distrobox create --image localhost/paintstorm-legacy-image:latest --name $CONTAINER_NAME $NVIDIA_FLAG + else + docker load -i "$tarfile" + distrobox create --image paintstorm-legacy-image:latest --name $CONTAINER_NAME + fi + echo "✓ Imported!" + fi + ;; + 3) + distrobox list | grep $CONTAINER_NAME + distrobox enter $CONTAINER_NAME -- bash -c "echo 'Fonts: '\$(fc-list | wc -l)" + ;; + 4) + echo "=== Testing tablet input ===" + echo "" + echo "Host system devices:" + ls -la /dev/input/by-id/ 2>/dev/null || echo "No input devices found" + echo "" + echo "Container devices:" + distrobox enter $CONTAINER_NAME -- bash -c "ls -la /dev/input/by-id/ 2>/dev/null || echo 'No input devices found'" + echo "" + echo "XInput in container:" + distrobox enter $CONTAINER_NAME -- bash -c "xinput list 2>/dev/null || echo 'XInput not available'" + ;; + 5) + echo "=== Fixing tablet permissions ===" + echo "This will add your user to the input group and fix device permissions..." + sudo usermod -a -G input $USER + echo "You may need to logout/login for group changes to take effect" + echo "" + echo "Current input device permissions:" + ls -la /dev/input/event* 2>/dev/null | head -5 + echo "" + echo "To fix permissions temporarily:" + echo " sudo chmod a+rw /dev/input/event*" + ;; +esac +MANAGE_SCRIPT + +chmod +x ~/paintstorm-manage.sh + +echo "" +echo -e "${GREEN}✓ Created ~/paintstorm-manage.sh${NC}" +echo "" +