Dogecoin Auto-Installer: Full Script Source
January 9, 2026
mrbeandev
16 min read
For those who want to skip the manual setup and deploy a high-performance Dogecoin node with a single command, here is the full source code for the Dogecoin Auto-Installer and Management Menu.
This script handles:
- Auto-detection of system RAM and CPU to optimize
dbcacheandrpcthreads. - Automatic downloads of the latest stable binaries from GitHub.
- Systemd integration for automatic restarts on failure.
- Interactive Management Menu to start/stop/monitor the node.
The script
Save the following code as dogecoin-setup.sh, make it executable with chmod +x dogecoin-setup.sh, and run it with sudo ./dogecoin-setup.sh.
#!/bin/bash
# Dogecoin Auto-Installer with Interactive Management Menu
# Automatically downloads latest Dogecoin node and configures based on system specs
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
MAGENTA='\033[0;35m'
NC='\033[0m'
# Global variables
DOGECOIN_HOME=""
DOGECOIN_DATA=""
DOGECOIN_BIN=""
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Logging functions
log() { echo -e "${BLUE}[$(date +'%H:%M:%S')]${NC} $1"; }
error() { echo -e "${RED}[ERROR]${NC} $1" >&2; }
success() { echo -e "${GREEN}[SUCCESS]${NC} $1"; }
warning() { echo -e "${YELLOW}[WARNING]${NC} $1"; }
info() { echo -e "${CYAN}[INFO]${NC} $1"; }
# System detection functions
detect_system_specs() {
log "Detecting system specifications..."
# CPU cores
CPU_CORES=$(nproc)
# Total RAM in MB
TOTAL_RAM_KB=$(grep MemTotal /proc/meminfo | awk '{print $2}')
TOTAL_RAM_MB=$((TOTAL_RAM_KB / 1024))
TOTAL_RAM_GB=$((TOTAL_RAM_MB / 1024))
# Available RAM (accounting for system usage)
AVAILABLE_RAM_MB=$((TOTAL_RAM_MB - 4096)) # Reserve 4GB for system
# Calculate optimal dbcache (use 40% of available RAM, max 32GB)
OPTIMAL_DBCACHE_MB=$((AVAILABLE_RAM_MB * 40 / 100))
if [ $OPTIMAL_DBCACHE_MB -gt 32768 ]; then
OPTIMAL_DBCACHE_MB=32768
fi
# Calculate optimal mempool (use 5% of available RAM, min 512MB, max 8GB)
OPTIMAL_MEMPOOL_MB=$((AVAILABLE_RAM_MB * 5 / 100))
if [ $OPTIMAL_MEMPOOL_MB -lt 512 ]; then
OPTIMAL_MEMPOOL_MB=512
elif [ $OPTIMAL_MEMPOOL_MB -gt 8192 ]; then
OPTIMAL_MEMPOOL_MB=8192
fi
# Optimal connections based on RAM
if [ $TOTAL_RAM_GB -ge 32 ]; then
OPTIMAL_CONNECTIONS=200
elif [ $TOTAL_RAM_GB -ge 16 ]; then
OPTIMAL_CONNECTIONS=150
elif [ $TOTAL_RAM_GB -ge 8 ]; then
OPTIMAL_CONNECTIONS=100
else
OPTIMAL_CONNECTIONS=50
fi
# RPC threads (2 per core, max 32)
OPTIMAL_RPC_THREADS=$((CPU_CORES * 2))
if [ $OPTIMAL_RPC_THREADS -gt 32 ]; then
OPTIMAL_RPC_THREADS=32
fi
info "Detected specs:"
echo " CPU Cores: $CPU_CORES"
echo " Total RAM: ${TOTAL_RAM_GB}GB"
echo " Optimal DB Cache: ${OPTIMAL_DBCACHE_MB}MB"
echo " Optimal Mempool: ${OPTIMAL_MEMPOOL_MB}MB"
echo " Optimal Connections: $OPTIMAL_CONNECTIONS"
echo " Optimal RPC Threads: $OPTIMAL_RPC_THREADS"
}
find_largest_disk() {
df -BG --output=avail,target | tail -n +2 | sort -rn | head -1 | while read avail target; do
avail_clean=$(echo $avail | tr -d 'G')
echo "$target $avail_clean"
done
}
get_latest_release() {
log "Fetching latest Dogecoin release..."
RELEASE_INFO=$(curl -s "https://api.github.com/repos/dogecoin/dogecoin/releases/latest")
if [ $? -ne 0 ]; then
error "Failed to fetch release information"
return 1
fi
TAG_NAME=$(echo "$RELEASE_INFO" | grep '"tag_name"' | cut -d'"' -f4)
# Try multiple patterns to find Linux x86_64 release
DOWNLOAD_URL=$(echo "$RELEASE_INFO" | grep '"browser_download_url"' | grep -E 'linux.*x86_64.*\.tar\.gz' | head -1 | cut -d'"' -f4)
if [ -z "$DOWNLOAD_URL" ]; then
# Try alternative patterns
DOWNLOAD_URL=$(echo "$RELEASE_INFO" | grep '"browser_download_url"' | grep -E 'x86_64.*linux.*\.tar\.gz' | head -1 | cut -d'"' -f4)
fi
if [ -z "$DOWNLOAD_URL" ]; then
# Try without linux keyword
DOWNLOAD_URL=$(echo "$RELEASE_INFO" | grep '"browser_download_url"' | grep -E 'x86_64.*\.tar\.gz' | head -1 | cut -d'"' -f4)
fi
if [ -z "$DOWNLOAD_URL" ]; then
# Debug: show available downloads
warning "Could not find Linux x86_64 release. Available downloads:"
echo "$RELEASE_INFO" | grep '"browser_download_url"' | cut -d'"' -f4
echo
# Try to use any tar.gz file as fallback
DOWNLOAD_URL=$(echo "$RELEASE_INFO" | grep '"browser_download_url"' | grep '\.tar\.gz' | head -1 | cut -d'"' -f4)
if [ -n "$DOWNLOAD_URL" ]; then
warning "Using fallback download: $(basename "$DOWNLOAD_URL")"
else
error "No suitable release found"
return 1
fi
fi
if [ -z "$TAG_NAME" ]; then
error "Could not determine version"
return 1
fi
success "Found version: $TAG_NAME"
info "Download URL: $(basename "$DOWNLOAD_URL")"
}
select_installation_path() {
echo -e "\n${CYAN}=== INSTALLATION PATH SELECTION ===${NC}\n"
# Show available disk space
echo -e "${YELLOW}Available storage devices:${NC}"
df -h --output=size,avail,pcent,target | grep -E "^[^T]" | nl -w2 -s'. '
echo
# Auto-detect best path
DISK_INFO=$(find_largest_disk)
AUTO_PATH=$(echo $DISK_INFO | cut -d' ' -f1)
AUTO_AVAILABLE_GB=$(echo $DISK_INFO | cut -d' ' -f2)
echo -e "${GREEN}Auto-detected best path:${NC} $AUTO_PATH (${AUTO_AVAILABLE_GB}GB available)"
echo
echo "Installation path options:"
echo "1. Use auto-detected path (recommended)"
echo "2. Enter custom path"
echo "3. Browse and select from mounted drives"
echo -n "Choose option [1-3]: "
read path_choice
case $path_choice in
1)
INSTALL_BASE_PATH="$AUTO_PATH"
AVAILABLE_GB="$AUTO_AVAILABLE_GB"
success "Using auto-detected path: $INSTALL_BASE_PATH"
;;
2)
echo -n "Enter installation base path: "
read CUSTOM_PATH
# Validate path
if [ ! -d "$CUSTOM_PATH" ]; then
echo -n "Path doesn't exist. Create it? [y/N]: "
read create_path
if [[ $create_path =~ ^[Yy]$ ]]; then
if ! mkdir -p "$CUSTOM_PATH"; then
error "Failed to create directory: $CUSTOM_PATH"
return 1
fi
success "Created directory: $CUSTOM_PATH"
else
error "Installation cancelled"
return 1
fi
fi
# Check available space
AVAILABLE_GB=$(df -BG "$CUSTOM_PATH" | tail -1 | awk '{print $4}' | tr -d 'G')
INSTALL_BASE_PATH="$CUSTOM_PATH"
success "Using custom path: $INSTALL_BASE_PATH (${AVAILABLE_GB}GB available)"
;;
3)
echo -e "\n${YELLOW}Available mount points:${NC}"
df -h | grep -E "^/dev" | nl -w2 -s'. ' | while read num line; do
echo "$line"
done
echo
echo -n "Enter the mount point or full path: "
read SELECTED_PATH
if [ ! -d "$SELECTED_PATH" ]; then
error "Invalid path: $SELECTED_PATH"
return 1
fi
AVAILABLE_GB=$(df -BG "$SELECTED_PATH" | tail -1 | awk '{print $4}' | tr -d 'G')
INSTALL_BASE_PATH="$SELECTED_PATH"
success "Using selected path: $INSTALL_BASE_PATH (${AVAILABLE_GB}GB available)"
;;
*)
error "Invalid choice"
return 1
;;
esac
# Final validation
if [ "$AVAILABLE_GB" -lt 150 ]; then
error "Insufficient space: Need at least 150GB, found ${AVAILABLE_GB}GB"
echo "Press any key to continue..."
read -n 1
return 1
fi
return 0
}
install_dogecoin() {
echo -e "\n${MAGENTA}=== DOGECOIN AUTO-INSTALLER ===${NC}\n"
detect_system_specs
if ! select_installation_path; then
return 1
fi
DOGECOIN_HOME="$INSTALL_BASE_PATH/dogecoin"
DOGECOIN_DATA="$DOGECOIN_HOME/data"
DOGECOIN_BIN="$DOGECOIN_HOME/bin"
# Check if existing installation exists
if [ -d "$DOGECOIN_HOME" ]; then
warning "Existing Dogecoin installation found at: $DOGECOIN_HOME"
echo -n "Continue with reinstallation? [y/N]: "
read reinstall_confirm
if [[ ! $reinstall_confirm =~ ^[Yy]$ ]]; then
warning "Installation cancelled"
return 1
fi
log "Backing up existing configuration..."
if [ -f "$DOGECOIN_DATA/dogecoin.conf" ]; then
cp "$DOGECOIN_DATA/dogecoin.conf" "$DOGECOIN_DATA/dogecoin.conf.backup.$(date +%Y%m%d_%H%M%S)"
success "Configuration backed up"
fi
fi
log "Creating installation directories..."
mkdir -p "$DOGECOIN_HOME" "$DOGECOIN_DATA" "$DOGECOIN_BIN"
if ! get_latest_release; then
echo
warning "Automatic detection failed. Would you like to:"
echo "1. Try manual URL input"
echo "2. Use known stable version (v1.14.6)"
echo "3. Cancel installation"
echo -n "Choose option [1-3]: "
read manual_choice
case $manual_choice in
1)
echo -n "Enter direct download URL: "
read DOWNLOAD_URL
if [ -z "$DOWNLOAD_URL" ]; then
error "No URL provided"
return 1
fi
TAG_NAME="manual"
;;
2)
TAG_NAME="v1.14.6"
DOWNLOAD_URL="https://github.com/dogecoin/dogecoin/releases/download/v1.14.6/dogecoin-1.14.6-x86_64-linux-gnu.tar.gz"
success "Using stable version: $TAG_NAME"
;;
3)
warning "Installation cancelled"
return 1
;;
*)
error "Invalid choice"
return 1
;;
esac
fi
log "Downloading Dogecoin $TAG_NAME..."
cd "$DOGECOIN_HOME"
TARBALL_NAME=$(basename "$DOWNLOAD_URL")
if ! curl -L -o "$TARBALL_NAME" "$DOWNLOAD_URL"; then
error "Download failed"
return 1
fi
log "Extracting..."
if ! tar -xzf "$TARBALL_NAME"; then
error "Extraction failed"
return 1
fi
EXTRACTED_DIR=$(tar -tzf "$TARBALL_NAME" | head -1 | cut -f1 -d"/")
if [ ! -d "$EXTRACTED_DIR" ]; then
error "Could not find extracted directory"
return 1
fi
# Check if binaries exist in the expected location
if [ ! -d "$EXTRACTED_DIR/bin" ]; then
error "Binaries not found in expected location"
echo "Directory contents:"
ls -la "$EXTRACTED_DIR/"
return 1
fi
cp "$EXTRACTED_DIR/bin/"* "$DOGECOIN_BIN/"
chmod +x "$DOGECOIN_BIN/"*
rm -rf "$EXTRACTED_DIR" "$TARBALL_NAME"
create_optimized_config
create_management_files
setup_systemd_service
success "Installation completed successfully!"
echo "Installation path: $DOGECOIN_HOME"
echo "Data directory: $DOGECOIN_DATA"
echo "Binaries: $DOGECOIN_BIN"
echo
info "You can now start the node using option [2] from the main menu"
# Save paths for menu system
echo "DOGECOIN_HOME='$DOGECOIN_HOME'" > "$SCRIPT_DIR/.dogecoin_paths"
echo "DOGECOIN_DATA='$DOGECOIN_DATA'" >> "$SCRIPT_DIR/.dogecoin_paths"
echo "DOGECOIN_BIN='$DOGECOIN_BIN'" >> "$SCRIPT_DIR/.dogecoin_paths"
}
create_optimized_config() {
log "Creating auto-optimized configuration..."
cat > "$DOGECOIN_DATA/dogecoin.conf" << EOF
server=1
daemon=1
rpcuser=dogeuser
rpcpassword=dogepass$(openssl rand -hex 8)
rpcallowip=127.0.0.1
rpcbind=127.0.0.1
rpcport=22555
dbcache=$OPTIMAL_DBCACHE_MB
par=$CPU_CORES
maxconnections=$OPTIMAL_CONNECTIONS
maxuploadtarget=0
maxmempool=$OPTIMAL_MEMPOOL_MB
mempoolexpiry=168
timeout=15000
peertimeout=30
maxtimeadjustment=4200
rpcworkqueue=64
rpcthreads=$OPTIMAL_RPC_THREADS
dns=1
dnsseed=1
upnp=1
shrinkdebugfile=1
logips=0
logtimestamps=1
assumevalid=0
blockreconstructionextratxn=100000
maxreceivebuffer=10000
maxsendbuffer=10000
checkblocks=288
checklevel=3
dblogsize=104857600
maxorphantx=7500
debug=0
logthreadnames=0
addnode=seed.multidoge.org:22556
addnode=seed.dogecoin.com:22556
addnode=seed.dogechain.info:22556
bind=0.0.0.0:22556
onlynet=ipv4
EOF
success "Configuration created with auto-detected specs"
}
create_management_files() {
# Control script
cat > "$DOGECOIN_HOME/dogecoin-control.sh" << 'EOF'
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/../.dogecoin_paths" 2>/dev/null || {
DOGECOIN_HOME="$(dirname "$0")"
DOGECOIN_DATA="$DOGECOIN_HOME/data"
DOGECOIN_BIN="$DOGECOIN_HOME/bin"
}
start_node() {
echo "Starting Dogecoin daemon..."
$DOGECOIN_BIN/dogecoind -datadir=$DOGECOIN_DATA -daemon
sleep 3
if pgrep -f dogecoind > /dev/null; then
echo "✓ Dogecoin daemon started successfully"
else
echo "✗ Failed to start daemon"
fi
}
stop_node() {
echo "Stopping Dogecoin daemon..."
$DOGECOIN_BIN/dogecoin-cli -datadir=$DOGECOIN_DATA stop 2>/dev/null || {
echo "Daemon not responding, force stopping..."
pkill -f dogecoind
}
echo "✓ Dogecoin daemon stopped"
}
restart_node() {
stop_node
sleep 5
start_node
}
show_status() {
if ! pgrep -f dogecoind > /dev/null; then
echo "❌ Dogecoin daemon is NOT running"
return 1
fi
echo "✅ Dogecoin daemon is running"
echo
INFO=$($DOGECOIN_BIN/dogecoin-cli -datadir=$DOGECOIN_DATA getblockchaininfo 2>/dev/null) || {
echo "⚠️ Daemon running but not responding"
return 1
}
BLOCKS=$(echo "$INFO" | grep '"blocks"' | cut -d':' -f2 | tr -d ' ,')
HEADERS=$(echo "$INFO" | grep '"headers"' | cut -d':' -f2 | tr -d ' ,')
PROGRESS=$(echo "$INFO" | grep '"verificationprogress"' | cut -d':' -f2 | tr -d ' ,')
CHAIN=$(echo "$INFO" | grep '"chain"' | cut -d'"' -f4)
PROGRESS_PERCENT=$(echo "$PROGRESS * 100" | bc -l 2>/dev/null | cut -d'.' -f1)
echo "Chain: $CHAIN"
echo "Blocks: $BLOCKS"
echo "Headers: $HEADERS"
echo "Sync Progress: ${PROGRESS_PERCENT:-0}%"
if [ "$BLOCKS" != "$HEADERS" ]; then
BEHIND=$((HEADERS - BLOCKS))
echo "Behind by: $BEHIND blocks"
fi
}
show_network_info() {
echo "=== Network Information ==="
$DOGECOIN_BIN/dogecoin-cli -datadir=$DOGECOIN_DATA getnetworkinfo 2>/dev/null | grep -E "(connections|version)" || echo "Network info unavailable"
}
show_mempool() {
echo "=== Memory Pool ==="
MEMPOOL=$($DOGECOIN_BIN/dogecoin-cli -datadir=$DOGECOIN_DATA getmempoolinfo 2>/dev/null) || {
echo "Mempool info unavailable"
return
}
SIZE=$(echo "$MEMPOOL" | grep '"size"' | cut -d':' -f2 | tr -d ' ,')
BYTES=$(echo "$MEMPOOL" | grep '"bytes"' | cut -d':' -f2 | tr -d ' ,')
echo "Transactions: $SIZE"
echo "Size: $BYTES bytes"
}
show_wallet_info() {
echo "=== Wallet Information ==="
$DOGECOIN_BIN/dogecoin-cli -datadir=$DOGECOIN_DATA getwalletinfo 2>/dev/null || echo "No wallet loaded or wallet unavailable"
}
backup_wallet() {
BACKUP_DIR="$DOGECOIN_DATA/backups"
mkdir -p "$BACKUP_DIR"
BACKUP_FILE="$BACKUP_DIR/wallet_backup_$(date +%Y%m%d_%H%M%S).dat"
if [ -f "$DOGECOIN_DATA/wallet.dat" ]; then
cp "$DOGECOIN_DATA/wallet.dat" "$BACKUP_FILE"
echo "✓ Wallet backed up to: $BACKUP_FILE"
else
echo "⚠️ No wallet.dat found"
fi
}
show_logs() {
if [ -f "$DOGECOIN_DATA/debug.log" ]; then
tail -50 "$DOGECOIN_DATA/debug.log"
else
echo "No debug log found"
fi
}
case "$1" in
start) start_node ;;
stop) stop_node ;;
restart) restart_node ;;
status) show_status ;;
network) show_network_info ;;
mempool) show_mempool ;;
wallet) show_wallet_info ;;
backup) backup_wallet ;;
logs) show_logs ;;
*) echo "Usage: $0 {start|stop|restart|status|network|mempool|wallet|backup|logs}" ;;
esac
EOF
chmod +x "$DOGECOIN_HOME/dogecoin-control.sh"
}
setup_systemd_service() {
sudo tee /etc/systemd/system/dogecoin.service > /dev/null << EOF
[Unit]
Description=Dogecoin daemon
After=network.target
[Service]
ExecStart=$DOGECOIN_BIN/dogecoind -datadir=$DOGECOIN_DATA -conf=$DOGECOIN_DATA/dogecoin.conf
User=$USER
Type=forking
PIDFile=$DOGECOIN_DATA/dogecoind.pid
Restart=on-failure
RestartSec=60
TimeoutStopSec=60
TimeoutStartSec=10
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=full
ProtectHome=true
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable dogecoin
success "Systemd service configured"
}
load_paths() {
if [ -f "$SCRIPT_DIR/.dogecoin_paths" ]; then
source "$SCRIPT_DIR/.dogecoin_paths"
return 0
fi
return 1
}
show_main_menu() {
clear
echo -e "${MAGENTA}╔══════════════════════════════════════╗${NC}"
echo -e "${MAGENTA}║ DOGECOIN NODE MANAGER ║${NC}"
echo -e "${MAGENTA}╚══════════════════════════════════════╝${NC}"
echo
if load_paths; then
if pgrep -f dogecoind > /dev/null; then
echo -e "${GREEN}● Status: RUNNING${NC}"
else
echo -e "${RED}● Status: STOPPED${NC}"
fi
echo -e "Installation: $DOGECOIN_HOME"
INSTALL_SIZE=$(du -sh "$DOGECOIN_HOME" 2>/dev/null | cut -f1 || echo "Unknown")
echo -e "Data Size: $INSTALL_SIZE"
echo
else
echo -e "${YELLOW}● Status: NOT INSTALLED${NC}"
echo
fi
echo -e "${CYAN}[1]${NC} Install/Reinstall Dogecoin"
echo -e "${CYAN}[2]${NC} Start Node"
echo -e "${CYAN}[3]${NC} Stop Node"
echo -e "${CYAN}[4]${NC} Restart Node"
echo -e "${CYAN}[5]${NC} Node Status"
echo -e "${CYAN}[6]${NC} Network Info"
echo -e "${CYAN}[7]${NC} Memory Pool Info"
echo -e "${CYAN}[8]${NC} Wallet Info"
echo -e "${CYAN}[9]${NC} Backup Wallet"
echo -e "${CYAN}[10]${NC} View Logs"
echo -e "${CYAN}[11]${NC} System Monitor"
echo -e "${CYAN}[12]${NC} Configuration Editor"
echo -e "${CYAN}[13]${NC} Move Installation"
echo -e "${CYAN}[14]${NC} Uninstall Dogecoin"
echo -e "${CYAN}[0]${NC} Exit"
echo
echo -n "Select option [0-14]: "
}
system_monitor() {
clear
echo -e "${MAGENTA}=== SYSTEM MONITOR ===${NC}"
echo
# CPU usage
CPU_USAGE=$(top -bn1 | grep "Cpu(s)" | awk '{print $2}' | cut -d'%' -f1)
echo -e "CPU Usage: ${CPU_USAGE}%"
# Memory usage
MEM_INFO=$(free -m)
MEM_USED=$(echo "$MEM_INFO" | awk 'NR==2{print $3}')
MEM_TOTAL=$(echo "$MEM_INFO" | awk 'NR==2{print $2}')
MEM_PERCENT=$((MEM_USED * 100 / MEM_TOTAL))
echo -e "Memory: ${MEM_USED}MB/${MEM_TOTAL}MB (${MEM_PERCENT}%)"
# Disk usage for dogecoin directory
if [ -n "$DOGECOIN_HOME" ] && [ -d "$DOGECOIN_HOME" ]; then
DISK_INFO=$(df -h "$DOGECOIN_HOME" | tail -1)
echo -e "Dogecoin Disk: $DISK_INFO"
fi
# Network connections if running
if pgrep -f dogecoind > /dev/null && [ -n "$DOGECOIN_BIN" ]; then
CONNECTIONS=$($DOGECOIN_BIN/dogecoin-cli -datadir=$DOGECOIN_DATA getnetworkinfo 2>/dev/null | grep '"connections"' | cut -d':' -f2 | tr -d ' ,')
echo -e "Network Connections: ${CONNECTIONS:-Unknown}"
fi
echo
echo "Press any key to continue..."
read -n 1
}
edit_config() {
if [ ! -f "$DOGECOIN_DATA/dogecoin.conf" ]; then
error "Configuration file not found"
return 1
fi
echo -e "${YELLOW}Opening configuration editor...${NC}"
echo -e "${YELLOW}Make sure to restart the node after making changes${NC}"
echo
${EDITOR:-nano} "$DOGECOIN_DATA/dogecoin.conf"
}
move_installation() {
if ! load_paths; then
error "No installation found to move"
return 1
fi
if pgrep -f dogecoind > /dev/null; then
error "Please stop the node before moving installation"
return 1
fi
echo -e "\n${YELLOW}=== MOVE DOGECOIN INSTALLATION ===${NC}\n"
echo "Current installation: $DOGECOIN_HOME"
CURRENT_SIZE=$(du -sh "$DOGECOIN_HOME" 2>/dev/null | cut -f1 || echo "Unknown")
echo "Current size: $CURRENT_SIZE"
echo
if ! select_installation_path; then
return 1
fi
NEW_DOGECOIN_HOME="$INSTALL_BASE_PATH/dogecoin"
if [ "$NEW_DOGECOIN_HOME" = "$DOGECOIN_HOME" ]; then
warning "New path is the same as current path"
return 1
fi
if [ -d "$NEW_DOGECOIN_HOME" ]; then
error "Destination already exists: $NEW_DOGECOIN_HOME"
return 1
fi
echo -e "\n${YELLOW}Moving installation...${NC}"
echo "From: $DOGECOIN_HOME"
echo "To: $NEW_DOGECOIN_HOME"
echo -n "Continue? [y/N]: "
read move_confirm
if [[ ! $move_confirm =~ ^[Yy]$ ]]; then
warning "Move cancelled"
return 1
fi
log "Moving installation..."
if ! mv "$DOGECOIN_HOME" "$NEW_DOGECOIN_HOME"; then
error "Failed to move installation"
return 1
fi
# Update paths
DOGECOIN_HOME="$NEW_DOGECOIN_HOME"
DOGECOIN_DATA="$DOGECOIN_HOME/data"
DOGECOIN_BIN="$DOGECOIN_HOME/bin"
# Update systemd service
setup_systemd_service
# Save new paths
echo "DOGECOIN_HOME='$DOGECOIN_HOME'" > "$SCRIPT_DIR/.dogecoin_paths"
echo "DOGECOIN_DATA='$DOGECOIN_DATA'" >> "$SCRIPT_DIR/.dogecoin_paths"
echo "DOGECOIN_BIN='$DOGECOIN_BIN'" >> "$SCRIPT_DIR/.dogecoin_paths"
success "Installation moved successfully!"
echo "New location: $DOGECOIN_HOME"
}
uninstall_dogecoin() {
if ! load_paths; then
error "No installation found to uninstall"
return 1
fi
echo -e "\n${RED}=== UNINSTALL DOGECOIN ===${NC}\n"
echo "This will completely remove:"
echo "- Installation: $DOGECOIN_HOME"
echo "- Blockchain data (cannot be recovered)"
echo "- Configuration files"
echo "- Systemd service"
echo
warning "This action cannot be undone!"
echo -n "Type 'DELETE' to confirm uninstallation: "
read confirm_delete
if [ "$confirm_delete" != "DELETE" ]; then
warning "Uninstallation cancelled"
return 1
fi
log "Stopping Dogecoin daemon..."
if pgrep -f dogecoind > /dev/null; then
"$DOGECOIN_HOME/dogecoin-control.sh" stop 2>/dev/null || pkill -f dogecoind
sleep 3
fi
log "Removing systemd service..."
sudo systemctl stop dogecoin 2>/dev/null || true
sudo systemctl disable dogecoin 2>/dev/null || true
sudo rm -f /etc/systemd/system/dogecoin.service
sudo systemctl daemon-reload
log "Removing installation directory..."
if [ -d "$DOGECOIN_HOME" ]; then
rm -rf "$DOGECOIN_HOME"
fi
log "Cleaning up configuration..."
rm -f "$SCRIPT_DIR/.dogecoin_paths"
success "Dogecoin has been completely uninstalled"
}
main_loop() {
while true; do
show_main_menu
read -r choice
case $choice in
1) install_dogecoin ;;
2)
if load_paths; then
"$DOGECOIN_HOME/dogecoin-control.sh" start
else
error "Dogecoin not installed"
fi
;;
3)
if load_paths; then
"$DOGECOIN_HOME/dogecoin-control.sh" stop
else
error "Dogecoin not installed"
fi
;;
4)
if load_paths; then
"$DOGECOIN_HOME/dogecoin-control.sh" restart
else
error "Dogecoin not installed"
fi
;;
5)
if load_paths; then
"$DOGECOIN_HOME/dogecoin-control.sh" status
else
error "Dogecoin not installed"
fi
;;
6)
if load_paths; then
"$DOGECOIN_HOME/dogecoin-control.sh" network
else
error "Dogecoin not installed"
fi
;;
7)
if load_paths; then
"$DOGECOIN_HOME/dogecoin-control.sh" mempool
else
error "Dogecoin not installed"
fi
;;
8)
if load_paths; then
"$DOGECOIN_HOME/dogecoin-control.sh" wallet
else
error "Dogecoin not installed"
fi
;;
9)
if load_paths; then
"$DOGECOIN_HOME/dogecoin-control.sh" backup
else
error "Dogecoin not installed"
fi
;;
10)
if load_paths; then
"$DOGECOIN_HOME/dogecoin-control.sh" logs
else
error "Dogecoin not installed"
fi
;;
11) system_monitor ;;
12)
if load_paths; then
edit_config
else
error "Dogecoin not installed"
fi
;;
0) echo "Goodbye!"; exit 0 ;;
*) error "Invalid option" ;;
esac
if [ "$choice" != "11" ] && [ "$choice" != "12" ]; then
echo
echo "Press any key to continue..."
read -n 1
fi
done
}
# Main execution
if [ "$1" = "--menu" ] || [ $# -eq 0 ]; then
main_loop
else
# Command line mode
case "$1" in
install) install_dogecoin ;;
*) echo "Usage: $0 [--menu|install]" ;;
esac
fi