From da0a58702b3a56435d11c3d85e1940338a220206 Mon Sep 17 00:00:00 2001 From: afiniel Date: Thu, 30 Jan 2025 08:28:49 +0100 Subject: [PATCH] Update Wallet upgrade --- daemon_builder/utils/addport.sh | 5 +- daemon_builder/utils/menu2.sh | 23 +- .../utils/screen-scrypt-daemonbuilder.sh | 2 + daemon_builder/utils/source.sh | 124 ++++---- daemon_builder/utils/upgrade.sh | 269 +++++++++++++++--- 5 files changed, 303 insertions(+), 120 deletions(-) diff --git a/daemon_builder/utils/addport.sh b/daemon_builder/utils/addport.sh index 9269ccf..861bc50 100644 --- a/daemon_builder/utils/addport.sh +++ b/daemon_builder/utils/addport.sh @@ -234,16 +234,17 @@ echo echo -e "$YELLOW Starting your new stratum...${NC}" bash stratum.${coinsymbollower} start ${coinsymbollower} -if [[ ("$CREATECOIN" == 'true') ]]; then +if [[ ("$CREATECOIN" == "true") ]]; then echo ' COINPORT='""''"${coinport}"''""' COINALGO='""''"${coinalgo}"''""' - ' | sudo -E tee $STORAGE_ROOT/daemon_builder/.addport.cnf >/dev/null 2>&1; + ' | sudo -E tee $STORAGE_ROOT/daemon_builder/.addport.cnf >/dev/null 2>&1 echo -e "$CYAN --------------------------------------------------------------------------- ${NC}" echo -e "$GREEN The assigned dedicated port for this coins stratum is :$YELLOW $coinport ${NC}" echo -e "$GREEN Addport finish return to config... ${NC}" echo -e "$CYAN --------------------------------------------------------------------------- ${NC}" sleep 4 + exit 0 else echo -e "$YELLOW Your new stratum is$GREEN started...$YELLOW Do NOT run the start command manually...${NC}" echo diff --git a/daemon_builder/utils/menu2.sh b/daemon_builder/utils/menu2.sh index bf97c26..2d48883 100644 --- a/daemon_builder/utils/menu2.sh +++ b/daemon_builder/utils/menu2.sh @@ -28,27 +28,34 @@ case "$RESULT" in 1) clear; echo ' + autogen=true berkeley="4.8" ' | sudo -E tee $STORAGE_ROOT/daemon_builder/.daemon_builder.my.cnf >/dev/null 2>&1; source upgrade.sh; ;; + 2) clear; echo ' + autogen=true berkeley="5.1" ' | sudo -E tee $STORAGE_ROOT/daemon_builder/.daemon_builder.my.cnf >/dev/null 2>&1; source upgrade.sh; ;; + 3) clear; echo ' + autogen=true berkeley="5.3" ' | sudo -E tee $STORAGE_ROOT/daemon_builder/.daemon_builder.my.cnf >/dev/null 2>&1; source upgrade.sh; ;; + 4) clear; echo ' + autogen=true berkeley="6.2" ' | sudo -E tee $STORAGE_ROOT/daemon_builder/.daemon_builder.my.cnf >/dev/null 2>&1; source upgrade.sh; @@ -56,33 +63,41 @@ case "$RESULT" in 5) clear; echo ' - berkeley="Makefile.unix" + autogen=false + unix=true ' | sudo -E tee $STORAGE_ROOT/daemon_builder/.daemon_builder.my.cnf >/dev/null 2>&1; source upgrade.sh; ;; + 6) clear; echo ' - berkeley="CMake file & DEPENDS folder" + autogen=false + cmake=true ' | sudo -E tee $STORAGE_ROOT/daemon_builder/.daemon_builder.my.cnf >/dev/null 2>&1; source upgrade.sh; ;; + 7) clear; echo ' - berkeley="UTIL folder contains BULD.sh" + buildutil=true + autogen=true ' | sudo -E tee $STORAGE_ROOT/daemon_builder/.daemon_builder.my.cnf >/dev/null 2>&1; source upgrade.sh; ;; + 8) clear; echo ' - berkeley="Precompiled coin. NEED TO BE LINUX Version!" + precompiled=true ' | sudo -E tee $STORAGE_ROOT/daemon_builder/.daemon_builder.my.cnf >/dev/null 2>&1; source upgrade.sh; ;; + 9) clear; + echo "You have chosen to exit the Daemon Builder. Type: daemonbuilder anytime to start the menu again."; exit; ;; esac diff --git a/daemon_builder/utils/screen-scrypt-daemonbuilder.sh b/daemon_builder/utils/screen-scrypt-daemonbuilder.sh index 5307513..106a26a 100644 --- a/daemon_builder/utils/screen-scrypt-daemonbuilder.sh +++ b/daemon_builder/utils/screen-scrypt-daemonbuilder.sh @@ -3,5 +3,7 @@ source /etc/daemonbuilder.sh source $STORAGE_ROOT/daemon_builder/conf/info.sh +LOG_DIR=/var/log/daemon-coin STRATUM_DIR=${PATH_STRATUM} +USR_BIN=/usr/bin diff --git a/daemon_builder/utils/source.sh b/daemon_builder/utils/source.sh index f0f9ed4..dc7735f 100644 --- a/daemon_builder/utils/source.sh +++ b/daemon_builder/utils/source.sh @@ -22,6 +22,11 @@ source $STORAGE_ROOT/daemon_builder/.daemon_builder.my.cnf source $STORAGE_ROOT/daemon_builder/conf/info.sh YIIMPOLL=/etc/yiimpool.conf +if [[ -f "$YIIMPOLL" ]]; then + source /etc/yiimpool.conf + YIIMPCONF=true +fi + CREATECOIN=true # Set what we need @@ -931,7 +936,7 @@ clear if [[ "$precompiled" == "true" ]]; then cd $WALLET_DIR - + echo echo -e "$CYAN === List of files in $WALLET_DIR: $NC" @@ -1075,7 +1080,6 @@ if [[ ("$precompiled" == "true") ]]; then sudo cp $COINDFIND /usr/bin sudo chmod +x /usr/bin/${coind} - sudo strip /usr/bin/${coind} coindmv=true echo @@ -1092,7 +1096,6 @@ if [[ ("$precompiled" == "true") ]]; then sudo cp $COINCLIFIND /usr/bin sudo chmod +x /usr/bin/${coincli} - sudo strip /usr/bin/${coincli} coinclimv=true echo -e "$GREEN Coin-cli moving to => /usr/bin/$NC$YELLOW${coincli} $NC" @@ -1105,7 +1108,6 @@ if [[ ("$precompiled" == "true") ]]; then sudo cp $COINTXFIND /usr/bin sudo chmod +x /usr/bin/${cointx} - sudo strip /usr/bin/${cointx} cointxmv=true echo -e "$GREEN Coin-tx moving to => /usr/bin/$NC$YELLOW${cointx} $NC" @@ -1118,7 +1120,6 @@ if [[ ("$precompiled" == "true") ]]; then sudo cp $COINUTILFIND /usr/bin sudo chmod +x /usr/bin/${coinutil} - sudo strip /usr/bin/${coinutil} coinutilmv=true echo -e "$GREEN Coin-tx moving to => /usr/bin/$NC$YELLOW${coinutil} $NC" @@ -1131,7 +1132,6 @@ if [[ ("$precompiled" == "true") ]]; then sudo cp $COINHASHFIND /usr/bin sudo chmod +x /usr/bin/${coinhash} - sudo strip /usr/bin/${coinhash} coinhashmv=true echo -e "$GREEN Coin-hash moving to => /usr/bin/$NC$YELLOW${coinwallet} $NC" @@ -1156,85 +1156,67 @@ else echo echo -e "$CYAN --------------------------------------------------------------------------------------- $NC" echo + echo -e "$GREEN Daemon moving to => /usr/bin/$NC$YELLOW${coind} $NC" - # Copy and strip daemon first - if [[ -f "$STORAGE_ROOT/daemon_builder/temp_coin_builds/${coindir}/src/${coind}" && ! -z "${coind}" ]]; then - echo -e "$GREEN Daemon moving to => /usr/bin/${coind} $NC" - sudo cp "$STORAGE_ROOT/daemon_builder/temp_coin_builds/${coindir}/src/${coind}" "/usr/bin/${coind}" - sudo strip "/usr/bin/${coind}" - coindmv=true - fi + sudo cp -r $STORAGE_ROOT/daemon_builder/temp_coin_builds/${coindir}/src/${coind} /usr/bin + sudo strip /usr/bin/${coind} + coindmv=true - # Copy and strip CLI if enabled - if [[ ("$ifcoincli" == "y" || "$ifcoincli" == "Y") && ! -z "${coincli}" ]]; then - if [[ -f "$STORAGE_ROOT/daemon_builder/temp_coin_builds/${coindir}/src/${coincli}" ]]; then - echo -e "$GREEN CLI moving to => /usr/bin/${coincli} $NC" - sudo cp "$STORAGE_ROOT/daemon_builder/temp_coin_builds/${coindir}/src/${coincli}" "/usr/bin/${coincli}" - sudo strip "/usr/bin/${coincli}" - coinclimv=true - fi + if [[ ("$ifcoincli" == "y" || "$ifcoincli" == "Y") ]]; then + echo -e "$GREEN CLI moving to => /usr/bin/$NC$YELLOW${coincli} $NC" + + sudo cp -r $STORAGE_ROOT/daemon_builder/temp_coin_builds/${coindir}/src/${coincli} /usr/bin + sudo strip /usr/bin/${coincli} + coinclimv=true fi - # Copy and strip TX if enabled - if [[ ("$ifcointx" == "y" || "$ifcointx" == "Y") && ! -z "${cointx}" ]]; then - if [[ -f "$STORAGE_ROOT/daemon_builder/temp_coin_builds/${coindir}/src/${cointx}" ]]; then - echo -e "$GREEN TX moving to => /usr/bin/${cointx} $NC" - sudo cp "$STORAGE_ROOT/daemon_builder/temp_coin_builds/${coindir}/src/${cointx}" "/usr/bin/${cointx}" - sudo strip "/usr/bin/${cointx}" - cointxmv=true - fi + if [[ ("$ifcointx" == "y" || "$ifcointx" == "Y") ]]; then + echo -e "$GREEN TX moving to => /usr/bin/$NC$YELLOW${cointx} $NC" + + sudo cp -r $STORAGE_ROOT/daemon_builder/temp_coin_builds/${coindir}/src/${cointx} /usr/bin + sudo strip /usr/bin/${cointx} + cointxmv=true fi - # Copy and strip UTIL if enabled - if [[ ("$ifcoinutil" == "y" || "$ifcoinutil" == "Y") && ! -z "${coinutil}" ]]; then - if [[ -f "$STORAGE_ROOT/daemon_builder/temp_coin_builds/${coindir}/src/${coinutil}" ]]; then - echo -e "$GREEN UTIL moving to => /usr/bin/${coinutil} $NC" - sudo cp "$STORAGE_ROOT/daemon_builder/temp_coin_builds/${coindir}/src/${coinutil}" "/usr/bin/${coinutil}" - sudo strip "/usr/bin/${coinutil}" - coinutilmv=true - fi + if [[ ("$ifcoinutil" == "y" || "$ifcoinutil" == "Y") ]]; then + echo -e "$GREEN UTIL moving to => /usr/bin/$NC$YELLOW${coinutil} $NC" + + sudo cp -r $STORAGE_ROOT/daemon_builder/temp_coin_builds/${coindir}/src/${coinutil} /usr/bin + sudo strip /usr/bin/${coinutil} + coinutilmv=true fi - # Copy and strip GTEST if enabled - if [[ ("$ifcoingtest" == "y" || "$ifcoingtest" == "Y") && ! -z "${coingtest}" ]]; then - if [[ -f "$STORAGE_ROOT/daemon_builder/temp_coin_builds/${coindir}/src/${coingtest}" ]]; then - echo -e "$GREEN GTEST moving to => /usr/bin/${coingtest} $NC" - sudo cp "$STORAGE_ROOT/daemon_builder/temp_coin_builds/${coindir}/src/${coingtest}" "/usr/bin/${coingtest}" - sudo strip "/usr/bin/${coingtest}" - coingtestmv=true - fi + if [[ ("$ifcoingtest" == "y" || "$ifcoingtest" == "Y") ]]; then + echo -e "$GREEN GTEST moving to => /usr/bin/$NC$YELLOW${coingtest} $NC" + + sudo cp -r $STORAGE_ROOT/daemon_builder/temp_coin_builds/${coindir}/src/${coingtest} /usr/bin + sudo strip /usr/bin/${coingtest} + coingtestmv=true fi - # Copy and strip TOOLS if enabled - if [[ ("$ifcointools" == "y" || "$ifcointools" == "Y") && ! -z "${cointools}" ]]; then - if [[ -f "$STORAGE_ROOT/daemon_builder/temp_coin_builds/${coindir}/src/${cointools}" ]]; then - echo -e "$GREEN TOOLS moving to => /usr/bin/${cointools} $NC" - sudo cp "$STORAGE_ROOT/daemon_builder/temp_coin_builds/${coindir}/src/${cointools}" "/usr/bin/${cointools}" - sudo strip "/usr/bin/${cointools}" - cointoolsmv=true - fi + if [[ ("$ifcointools" == "y" || "$ifcointools" == "Y") ]]; then + echo -e "$GREEN TOOLS moving to => /usr/bin/$NC$YELLOW${cointools} $NC" + + sudo cp -r $STORAGE_ROOT/daemon_builder/temp_coin_builds/${coindir}/src/${cointools} /usr/bin + sudo strip /usr/bin/${cointools} + cointoolsmv=true fi - # Copy and strip HASH if enabled - if [[ ("$ifcoinhash" == "y" || "$ifcoinhash" == "Y") && ! -z "${coinhash}" ]]; then - if [[ -f "$STORAGE_ROOT/daemon_builder/temp_coin_builds/${coindir}/src/${coinhash}" ]]; then - echo -e "$GREEN HASH moving to => /usr/bin/${coinhash} $NC" - sudo cp "$STORAGE_ROOT/daemon_builder/temp_coin_builds/${coindir}/src/${coinhash}" "/usr/bin/${coinhash}" - sudo strip "/usr/bin/${coinhash}" - coinhashmv=true - fi + if [[ ("$ifcoinhash" == "y" || "$ifcoinhash" == "Y") ]]; then + echo -e "$GREEN HASH moving to => /usr/bin/$NC$YELLOW${coinhash} $NC" + + sudo cp -r $STORAGE_ROOT/daemon_builder/temp_coin_builds/${coindir}/src/${coinhash} /usr/bin + sudo strip /usr/bin/${coinhash} + coinhashmv=true fi - # Copy and strip WALLET if enabled - if [[ ("$ifcoinwallet" == "y" || "$ifcoinwallet" == "Y") && ! -z "${coinwallet}" ]]; then - if [[ -f "$STORAGE_ROOT/daemon_builder/temp_coin_builds/${coindir}/src/${coinwallet}" ]]; then - echo -e "$GREEN WALLET moving to => /usr/bin/${coinwallet} $NC" - sudo cp "$STORAGE_ROOT/daemon_builder/temp_coin_builds/${coindir}/src/${coinwallet}" "/usr/bin/${coinwallet}" - sudo strip "/usr/bin/${coinwallet}" - coinwalletmv=true - fi + if [[ ("$ifcoinwallet" == "y" || "$ifcoinwallet" == "Y") ]]; then + echo -e "$GREEN WALLET moving to => /usr/bin/$NC$YELLOW${coinwallet} $NC" + + sudo cp -r $STORAGE_ROOT/daemon_builder/temp_coin_builds/${coindir}/src/${coinwallet} /usr/bin + sudo strip /usr/bin/${coinwallet} + coinwalletmv=true fi - echo echo -e "$CYAN --------------------------------------------------------------------------------------- $NC" echo @@ -1288,7 +1270,7 @@ if [[ ("$DAEMOND" != "true") ]]; then # Your coin algo is = '""''"${COINALGO}"''""' # Your dedicated port is = '""''"${COINPORT}"''""' # Please adding dedicated port in line blocknotify= replace :XXXX to '""''"${COINPORT}"''""' - ' | sudo -E tee $STORAGE_ROOT/wallets/."${coind::-1}"/${coind::-1}.conf >/dev/null 2>&1; + ' | sudo -E tee ${absolutepath}/wallets/."${coind::-1}"/${coind::-1}.conf >/dev/null 2>&1; fi fi diff --git a/daemon_builder/utils/upgrade.sh b/daemon_builder/utils/upgrade.sh index 51a3d08..23d01cd 100644 --- a/daemon_builder/utils/upgrade.sh +++ b/daemon_builder/utils/upgrade.sh @@ -13,6 +13,16 @@ source /etc/functions.sh source $STORAGE_ROOT/daemon_builder/.daemon_builder.my.cnf source $STORAGE_ROOT/daemon_builder/conf/info.sh +YIIMPOLL=/etc/yiimpool.conf +if [[ -f "$YIIMPOLL" ]]; then + source /etc/yiimpool.conf + YIIMPCONF=true +fi +CREATECOIN=false + +# Set what we need +now=$(date +"%m_%d_%Y") + # Sets the number of CPU cores to use for compiling. MIN_CPUS_FOR_COMPILATION=3 @@ -27,16 +37,30 @@ else NPROC=$((NPROC - 2)) fi +# Create the temporary installation directory if it doesn't already exist. +echo +echo -e "$CYAN ------------------------------------------------------------------------------- $NC" +echo -e "$CYAN Creating temporary installation directory if it doesn't already exist. $NC" +echo -e "$CYAN ------------------------------------------------------------------------------- $NC" + +source $STORAGE_ROOT/daemon_builder/.daemon_builder.my.cnf + +if [[ ! -e "$STORAGE_ROOT/daemon_builder/temp_coin_builds" ]]; then + sudo mkdir -p $STORAGE_ROOT/daemon_builder/temp_coin_builds +else + sudo rm -rf $STORAGE_ROOT/daemon_builder/temp_coin_builds/* + echo + echo -e "$CYAN ------------------------------------------------------------------------------- $NC" + echo -e "$GREEN temp_coin_builds already exists.... Skipping $NC" + echo -e "$CYAN ------------------------------------------------------------------------------- $NC" +fi + +# Just double checking folder permissions sudo setfacl -m u:${USERSERVER}:rwx $STORAGE_ROOT/daemon_builder/temp_coin_builds cd $STORAGE_ROOT/daemon_builder/temp_coin_builds -input_box "Coin Information" \ -"Please enter the coind name of the coin you want to upgrade. -\n\n*Paste press CTRL+RIGHT mouse button. -\n\nCoind Name:" \ -"" \ -pkillcoin +# Gitcoin coin information. input_box "Coin Information" \ "Please enter the Coin Symbol. Example: BTC \n\n*Paste press CTRL+RIGHT mouse button. @@ -97,7 +121,7 @@ else fi fi - +clear coindir=$coin$now # save last coin information in case coin build fails @@ -747,6 +771,192 @@ else fi fi +if [[ "$precompiled" == "true" ]]; then + + COINTARGZ=$(find . -type f -name "*.tar.gz") + COINZIP=$(find . -type f -name "*.zip") + COIN7Z=$(find . -type f -name "*.7z") + + if [[ -f "$COINZIP" ]]; then + hide_output sudo unzip -q "$COINZIP" + elif [[ -f "$COINTARGZ" ]]; then + hide_output sudo tar xzvf "$COINTARGZ" + elif [[ -f "$COIN7Z" ]]; then + hide_output sudo 7z x "$COIN7Z" + else + echo -e "$RED => No valid compressed files found (.zip, .tar.gz, or .7z).$NC" + exit 1 + fi + + echo + echo -e "$CYAN === Searching for wallet files ===$NC" + echo + + # Find the directory containing wallet files + WALLET_DIR=$(find . -type d -exec sh -c ' + cd "{}" 2>/dev/null && + if find . -maxdepth 1 -type f -executable \( -name "*d" -o -name "*daemon" -o -name "*-cli" \) 2>/dev/null | grep -q .; then + pwd + exit 0 + fi' \; | head -n 1) + + if [[ -z "$WALLET_DIR" ]]; then + echo -e "$RED => Could not find directory containing wallet files.$NC" + exit 1 + fi + + echo -e "$CYAN === Found wallet directory: $YELLOW$WALLET_DIR $NC" + cd $WALLET_DIR + + # Now search for executables in the correct directory + COINDFIND=$(find . -type f -executable \( -name "*d" -o -name "*daemon" \) ! -name "*.sh" 2>/dev/null) + COINCLIFIND=$(find . -type f -executable -name "*-cli" 2>/dev/null) + COINTXFIND=$(find . -type f -executable -name "*-tx" 2>/dev/null) + COINUTILFIND=$(find . -type f -executable -name "*-util" 2>/dev/null) + COINHASHFIND=$(find . -type f -executable -name "*-hash" 2>/dev/null) + COINWALLETFIND=$(find . -type f -executable -name "*-wallet" 2>/dev/null) + COINUTILFIND=$(find . -type f -executable -name "*-util" 2>/dev/null) + COINQTFIND=$(find . -type f -executable -name "*-qt" 2>/dev/null) + + declare -A wallet_files_found + declare -A wallet_files_not_found + + if [[ -n "$COINDFIND" ]]; then + wallet_files_found["Daemon"]=$(basename "$COINDFIND") + else + wallet_files_not_found["Daemon"]="true" + fi + + [[ -n "$COINCLIFIND" ]] && wallet_files_found["CLI"]=$(basename "$COINCLIFIND") || wallet_files_not_found["CLI"]="true" + [[ -n "$COINTXFIND" ]] && wallet_files_found["TX"]=$(basename "$COINTXFIND") || wallet_files_not_found["TX"]="true" + [[ -n "$COINUTILFIND" ]] && wallet_files_found["Util"]=$(basename "$COINUTILFIND") || wallet_files_not_found["Util"]="true" + [[ -n "$COINHASHFIND" ]] && wallet_files_found["Hash"]=$(basename "$COINHASHFIND") || wallet_files_not_found["Hash"]="true" + [[ -n "$COINWALLETFIND" ]] && wallet_files_found["Wallet"]=$(basename "$COINWALLETFIND") || wallet_files_not_found["Wallet"]="true" + [[ -n "$COINQTFIND" ]] && wallet_files_found["QT"]=$(basename "$COINQTFIND") || wallet_files_not_found["QT"]="true" + [[ -n "$COINUTILSFIND" ]] && wallet_files_found["Utils"]=$(basename "$COINUTILSFIND") || wallet_files_not_found["Utils"]="true" + + echo -e "$GREEN === Found Wallet Files ===$NC" + echo + for type in "${!wallet_files_found[@]}"; do + echo -e "$type: $YELLOW${wallet_files_found[$type]}$NC" + sleep 0.5 + done + + echo + echo -e "$RED => === Missing Wallet Files in zip/tar/7z file ===$NC" + echo + for type in "${!wallet_files_not_found[@]}"; do + echo -e "$type: Not found" + sleep 0.5 + done + + if [[ -n "$COINDFIND" ]]; then + echo + echo -e "$GREEN => Found Daemon: $YELLOW${wallet_files_found["Daemon"]}$NC" + else + echo + echo -e "$RED=> Could not find daemon executable. Installation failed.$NC" + echo + exit 1 + fi + + echo -e "$CYAN === Install Directory ===$NC" + echo -e "Executables will be installed to: $YELLOW$HOME/daemon_builder/src$NC" + + echo + coind=$(basename "$COINDFIND") + [[ -n "$COINCLIFIND" ]] && coincli=$(basename "$COINCLIFIND") + [[ -n "$COINTXFIND" ]] && cointx=$(basename "$COINTXFIND") + [[ -n "$COINUTILFIND" ]] && coinutil=$(basename "$COINUTILFIND") + [[ -n "$COINHASHFIND" ]] && coinhash=$(basename "$COINHASHFIND") + [[ -n "$COINWALLETFIND" ]] && coinwallet=$(basename "$COINWALLETFIND") + +fi + +clear + +if [[ "$precompiled" == "true" ]]; then + + cd $WALLET_DIR + + echo + + echo -e "$CYAN === List of files in $WALLET_DIR: $NC" + echo + for type in "${!wallet_files_found[@]}"; do + echo -e "$type: $YELLOW${wallet_files_found[$type]}$NC" + done + echo + echo -e "$CYAN --------------------------------------------------------------------------------------- $NC" + echo + + read -r -e -p "please enter the coind name from the directory above, example $coind :" coind + echo + read -r -e -p "Is there a $coincli, example $coincli [y/N] :" ifcoincli + if [[ ("$ifcoincli" == "y" || "$ifcoincli" == "Y") ]]; then + read -r -e -p "Please enter the coin-cli name :" ifcoincli + fi + + echo + read -r -e -p "Is there a coin-tx [y/N] :" ifcointx + if [[ ("$ifcointx" == "y" || "$ifcointx" == "Y") ]]; then + read -r -e -p "Please enter the coin-tx name :" ifcointx + fi + + echo + read -r -e -p "Is there a coin-util [y/N] :" ifcoinutil + if [[ ("$ifcoinutil" == "y" || "$ifcoinutil" == "Y") ]]; then + read -r -e -p "Please enter the coin-util name :" ifcoinutil + fi + + echo + read -r -e -p "Is there a coin-qt [y/N] :" ifcoinqt + if [[ ("$ifcoinqt" == "y" || "$ifcoinqt" == "Y") ]]; then + read -r -e -p "Please enter the coin-qt name :" ifcoinqt + fi + + + + echo + echo -e "$CYAN --------------------------------------------------------------------------------------- $NC" + echo + + FILECOIN=/usr/bin/${coind} + if [[ -f "$FILECOIN" ]]; then + DAEMOND="true" + SERVICE="${coind}" + if pgrep -x "$SERVICE" >/dev/null; then + if [[ ("${YIIMPCONF}" == "true") ]]; then + if [[ ("$ifcoincli" == "y" || "$ifcoincli" == "Y") ]]; then + "${coincli}" -datadir=$STORAGE_ROOT/wallets/."${coind::-1}" -conf="${coind::-1}".conf stop + else + "${coind}" -datadir=$STORAGE_ROOT/wallets/."${coind::-1}" -conf="${coind::-1}".conf stop + fi + else + if [[ ("$ifcoincli" == "y" || "$ifcoincli" == "Y") ]]; then + "${coincli}" -datadir=${absolutepath}/wallets/."${coind::-1}" -conf="${coind::-1}".conf stop + else + "${coind}" -datadir=${absolutepath}/wallets/."${coind::-1}" -conf="${coind::-1}".conf stop + fi + fi + + echo -e "$CYAN --------------------------------------------------------------------------- $NC" + secstosleep=$((1 * 20)) + while [ $secstosleep -gt 0 ]; do + echo -ne "$GREEN STOP THE DAEMON => $YELLOW${coind}$GREEN Sleep $CYAN$secstosleep$GREEN ...$NC\033[0K\r" + + : $((secstosleep--)) + done + echo -e "$CYAN --------------------------------------------------------------------------- $NC $GREEN" + echo -e "$GREEN Done... $NC$" + echo -e "$NC$CYAN --------------------------------------------------------------------------- $NC" + echo + fi + fi +fi + +clear + # Strip and copy to /usr/bin if [[ ("$precompiled" == "true") ]]; then cd $STORAGE_ROOT/daemon_builder/temp_coin_builds/${coindir}/${repzipcoin}/ @@ -761,7 +971,6 @@ if [[ ("$precompiled" == "true") ]]; then sleep 0.5 COINHASHFIND=$(find ~+ -type f -name "*-hash") sleep 0.5 - COINWALLETFIND=$(find ~+ -type f -name "*-wallet") if [[ -f "$COINDFIND" ]]; then @@ -807,7 +1016,7 @@ if [[ ("$precompiled" == "true") ]]; then sudo cp $COINDFIND /usr/bin sudo chmod +x /usr/bin/${coind} - sudo strip "/usr/bin/${coind}" + sudo strip /usr/bin/${coind} coindmv=true echo @@ -824,7 +1033,7 @@ if [[ ("$precompiled" == "true") ]]; then sudo cp $COINCLIFIND /usr/bin sudo chmod +x /usr/bin/${coincli} - sudo strip "/usr/bin/${coincli}" + sudo strip /usr/bin/${coincli} coinclimv=true echo -e "$GREEN Coin-cli moving to => /usr/bin/$NC$YELLOW${coincli} $NC" @@ -837,7 +1046,7 @@ if [[ ("$precompiled" == "true") ]]; then sudo cp $COINTXFIND /usr/bin sudo chmod +x /usr/bin/${cointx} - sudo strip "/usr/bin/${cointx}" + sudo strip /usr/bin/${cointx} cointxmv=true echo -e "$GREEN Coin-tx moving to => /usr/bin/$NC$YELLOW${cointx} $NC" @@ -850,7 +1059,7 @@ if [[ ("$precompiled" == "true") ]]; then sudo cp $COINUTILFIND /usr/bin sudo chmod +x /usr/bin/${coinutil} - sudo strip "/usr/bin/${coinutil}" + sudo strip /usr/bin/${coinutil} coinutilmv=true echo -e "$GREEN Coin-tx moving to => /usr/bin/$NC$YELLOW${coinutil} $NC" @@ -863,26 +1072,13 @@ if [[ ("$precompiled" == "true") ]]; then sudo cp $COINHASHFIND /usr/bin sudo chmod +x /usr/bin/${coinhash} - sudo strip "/usr/bin/${coinhash}" + sudo strip /usr/bin/${coinhash} coinhashmv=true echo -e "$GREEN Coin-hash moving to => /usr/bin/$NC$YELLOW${coinwallet} $NC" fi - if [[ -f "$COINWALLETFIND" ]]; then - coinwallet=$(basename $COINWALLETFIND) - sudo strip $COINWALLETFIND - - sudo cp $COINWALLETFIND /usr/bin - sudo chmod +x /usr/bin/${coinwallet} - sudo strip "/usr/bin/${coinwallet}" - sudo strip /usr/bin/${coinwallet} - coinwalletmv=true - - echo -e "$GREEN Moving ${coinwallet} to => /usr/bin/$NC$YELLOW${coinwallet} $NC" - - fi echo echo -e "$CYAN --------------------------------------------------------------------------------------- $NC" echo @@ -959,21 +1155,12 @@ else fi fi - # Copy and strip WALLET if enabled - if [[ ("$ifcoinwallet" == "y" || "$ifcoinwallet" == "Y") && ! -z "${coinwallet}" ]]; then - if [[ -f "$STORAGE_ROOT/daemon_builder/temp_coin_builds/${coindir}/src/${coinwallet}" ]]; then - echo -e "$GREEN WALLET moving to => /usr/bin/${coinwallet} $NC" - sudo cp "$STORAGE_ROOT/daemon_builder/temp_coin_builds/${coindir}/src/${coinwallet}" "/usr/bin/${coinwallet}" - sudo strip "/usr/bin/${coinwallet}" - coinwalletmv=true - fi - fi - echo echo -e "$CYAN --------------------------------------------------------------------------------------- $NC" echo fi + echo echo -e "$CYAN ------------------------------------------------ $NC" echo -e "$YELLOW Please verify the config file is correct. $NC" @@ -981,12 +1168,10 @@ echo -e "$CYAN ------------------------------------------------ $NC" echo read -n 1 -s -r -p "Press any key to continue" echo +sudo nano $STORAGE_ROOT/wallets/."${coind::-1}"/${coind::-1}.conf -if [[ "$YIIMPCONF" == "true" ]]; then - sudo nano $STORAGE_ROOT/wallets/."${coind::-1}"/${coind::-1}.conf -else - sudo nano ${absolutepath}/wallets/."${coind::-1}"/${coind::-1}.conf -fi +clear +cd $STORAGE_ROOT/daemon_builder # If we made it this far everything built fine removing last coin.conf and build directory sudo rm -r $STORAGE_ROOT/daemon_builder/temp_coin_builds/.lastcoin.conf @@ -997,7 +1182,6 @@ if [[ -f "$ADDPORTCONF" ]]; then sudo rm -r $STORAGE_ROOT/daemon_builder/.addport.cnf fi -clear figlet -f slant -w 100 " DaemonBuilder" | lolcat echo -e "$CYAN --------------------------------------------------------------------------- $NC" @@ -1016,5 +1200,4 @@ else "${coind}" -datadir=${absolutepath}/wallets/."${coind::-1}" -conf="${coind::-1}".conf -daemon -shrinkdebugfile fi echo -e "$NC" - exit \ No newline at end of file