Fix install script: CFLAGS -fcommon for gcc10+, robust paths, deps
This commit is contained in:
48
install.sh
48
install.sh
@@ -3,6 +3,9 @@
|
|||||||
# NecroHash Installer
|
# NecroHash Installer
|
||||||
# Installiert NecroHash und richtet den Autostart ein.
|
# Installiert NecroHash und richtet den Autostart ein.
|
||||||
|
|
||||||
|
# Exit on error
|
||||||
|
set -e
|
||||||
|
|
||||||
TARGET_DIR="/opt/necrohash"
|
TARGET_DIR="/opt/necrohash"
|
||||||
USER="pi"
|
USER="pi"
|
||||||
|
|
||||||
@@ -11,25 +14,38 @@ if [ "$EUID" -ne 0 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
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..."
|
echo "Installing NecroHash to $TARGET_DIR..."
|
||||||
|
|
||||||
# 1. Systemabhängigkeiten
|
# 1. Systemabhängigkeiten
|
||||||
echo "Installing system dependencies..."
|
echo "Installing system dependencies..."
|
||||||
apt-get update
|
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)
|
# 2. Cgminer Installation (dtbartle fork for Gridseed GC3355)
|
||||||
if [ ! -f "/usr/local/bin/cgminer" ]; then
|
if [ ! -f "/usr/local/bin/cgminer" ]; then
|
||||||
echo "Compiling and installing cgminer for Gridseed..."
|
echo "Compiling and installing cgminer for Gridseed..."
|
||||||
cd /tmp
|
cd /tmp
|
||||||
# Remove any existing failed clone
|
|
||||||
rm -rf cgminer-gc3355
|
rm -rf cgminer-gc3355
|
||||||
|
|
||||||
git clone https://github.com/dtbartle/cgminer-gc3355.git
|
git clone https://github.com/dtbartle/cgminer-gc3355.git
|
||||||
cd cgminer-gc3355
|
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
|
./autogen.sh
|
||||||
# Standard flags for this fork usually include gridseed support by default or via flag
|
else
|
||||||
./configure --enable-gridseed --enable-scrypt
|
autoreconf -ivf
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Explicitly link pthread if needed, though usually handled by configure
|
||||||
|
./configure --enable-gridseed --enable-scrypt --without-curses
|
||||||
|
|
||||||
make
|
make
|
||||||
make install
|
make install
|
||||||
cd ..
|
cd ..
|
||||||
@@ -44,15 +60,21 @@ if [ -d "$TARGET_DIR" ]; then
|
|||||||
mv "$TARGET_DIR" "${TARGET_DIR}_backup_$(date +%s)"
|
mv "$TARGET_DIR" "${TARGET_DIR}_backup_$(date +%s)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Cloning/Copying NecroHash..."
|
echo "Copying NecroHash files from $SCRIPT_DIR..."
|
||||||
# Wir gehen davon aus, dass wir im Repo-Ordner sind. Kopieren wir einfach alles rüber.
|
|
||||||
mkdir -p "$TARGET_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"
|
chown -R $USER:$USER "$TARGET_DIR"
|
||||||
|
|
||||||
# 4. Python Environment einrichten
|
# 4. Python Environment einrichten
|
||||||
echo "Setting up Python environment..."
|
echo "Setting up Python environment..."
|
||||||
su - $USER -c "cd $TARGET_DIR && python3 -m venv venv && source venv/bin/activate && pip install -r requirements.txt"
|
# 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
|
# 5. Systemd Services einrichten
|
||||||
|
|
||||||
@@ -81,10 +103,12 @@ After=network.target necrohash-gui.service
|
|||||||
[Service]
|
[Service]
|
||||||
User=$USER
|
User=$USER
|
||||||
WorkingDirectory=$TARGET_DIR
|
WorkingDirectory=$TARGET_DIR
|
||||||
# Screen session for optional attaching: screen -r necrohash
|
# ExecStart=/usr/local/bin/cgminer -c $TARGET_DIR/cgminer.conf
|
||||||
# ExecStart=screen -DmS necrohash /usr/local/bin/cgminer -c $TARGET_DIR/cgminer.conf
|
# Using nohup or similar might be needed if it tries to grab stdin/tty,
|
||||||
# Direct execution (better for logs/systemd):
|
# but usually systemd handles it.
|
||||||
ExecStart=/usr/local/bin/cgminer -c $TARGET_DIR/cgminer.conf
|
# 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
|
Restart=always
|
||||||
RestartSec=10
|
RestartSec=10
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user