Fix install script: CFLAGS -fcommon for gcc10+, robust paths, deps
This commit is contained in:
46
install.sh
46
install.sh
@@ -3,6 +3,9 @@
|
||||
# NecroHash Installer
|
||||
# Installiert NecroHash und richtet den Autostart ein.
|
||||
|
||||
# Exit on error
|
||||
set -e
|
||||
|
||||
TARGET_DIR="/opt/necrohash"
|
||||
USER="pi"
|
||||
|
||||
@@ -11,25 +14,38 @@ if [ "$EUID" -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Determine script directory to find local files (requirements.txt etc)
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
|
||||
echo "Installing NecroHash to $TARGET_DIR..."
|
||||
|
||||
# 1. Systemabhängigkeiten
|
||||
echo "Installing system dependencies..."
|
||||
apt-get update
|
||||
apt-get install -y python3 python3-venv git libncurses5-dev libudev-dev build-essential autoconf automake libtool pkg-config libcurl4-openssl-dev
|
||||
# Add automake, autoconf, libtool explicitly, and ensure pthread support
|
||||
apt-get install -y python3 python3-venv git libncurses5-dev libudev-dev build-essential autoconf automake libtool pkg-config libcurl4-openssl-dev libusb-1.0-0-dev
|
||||
|
||||
# 2. Cgminer Installation (dtbartle fork for Gridseed GC3355)
|
||||
if [ ! -f "/usr/local/bin/cgminer" ]; then
|
||||
echo "Compiling and installing cgminer for Gridseed..."
|
||||
cd /tmp
|
||||
# Remove any existing failed clone
|
||||
rm -rf cgminer-gc3355
|
||||
|
||||
git clone https://github.com/dtbartle/cgminer-gc3355.git
|
||||
cd cgminer-gc3355
|
||||
|
||||
# Fix for modern GCC (10+) defaulting to -fno-common which breaks old codebases
|
||||
export CFLAGS="-fcommon -O2"
|
||||
|
||||
if [ -f "./autogen.sh" ]; then
|
||||
./autogen.sh
|
||||
# Standard flags for this fork usually include gridseed support by default or via flag
|
||||
./configure --enable-gridseed --enable-scrypt
|
||||
else
|
||||
autoreconf -ivf
|
||||
fi
|
||||
|
||||
# Explicitly link pthread if needed, though usually handled by configure
|
||||
./configure --enable-gridseed --enable-scrypt --without-curses
|
||||
|
||||
make
|
||||
make install
|
||||
cd ..
|
||||
@@ -44,15 +60,21 @@ if [ -d "$TARGET_DIR" ]; then
|
||||
mv "$TARGET_DIR" "${TARGET_DIR}_backup_$(date +%s)"
|
||||
fi
|
||||
|
||||
echo "Cloning/Copying NecroHash..."
|
||||
# Wir gehen davon aus, dass wir im Repo-Ordner sind. Kopieren wir einfach alles rüber.
|
||||
echo "Copying NecroHash files from $SCRIPT_DIR..."
|
||||
mkdir -p "$TARGET_DIR"
|
||||
cp -r . "$TARGET_DIR"
|
||||
# Copy content from the repo directory where script is located
|
||||
cp -r "$SCRIPT_DIR/"* "$TARGET_DIR/"
|
||||
chown -R $USER:$USER "$TARGET_DIR"
|
||||
|
||||
# 4. Python Environment einrichten
|
||||
echo "Setting up Python environment..."
|
||||
# Use absolute path to requirements.txt
|
||||
if [ -f "$TARGET_DIR/requirements.txt" ]; then
|
||||
su - $USER -c "cd $TARGET_DIR && python3 -m venv venv && source venv/bin/activate && pip install -r requirements.txt"
|
||||
else
|
||||
echo "ERROR: requirements.txt not found in $TARGET_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 5. Systemd Services einrichten
|
||||
|
||||
@@ -81,10 +103,12 @@ After=network.target necrohash-gui.service
|
||||
[Service]
|
||||
User=$USER
|
||||
WorkingDirectory=$TARGET_DIR
|
||||
# Screen session for optional attaching: screen -r necrohash
|
||||
# ExecStart=screen -DmS necrohash /usr/local/bin/cgminer -c $TARGET_DIR/cgminer.conf
|
||||
# Direct execution (better for logs/systemd):
|
||||
ExecStart=/usr/local/bin/cgminer -c $TARGET_DIR/cgminer.conf
|
||||
# ExecStart=/usr/local/bin/cgminer -c $TARGET_DIR/cgminer.conf
|
||||
# Using nohup or similar might be needed if it tries to grab stdin/tty,
|
||||
# but usually systemd handles it.
|
||||
# Explicitly disabling ncurses/text interaction via --text-only or --real-quiet if available is good.
|
||||
# For now, standard call:
|
||||
ExecStart=/usr/local/bin/cgminer --gridseed-options freq=850 -c $TARGET_DIR/cgminer.conf
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
|
||||
Reference in New Issue
Block a user