Skip to content

Commit ba532e6

Browse files
committed
Yiimpool v1.0 Release
Hello world v1.0 Release. . .
1 parent 2919d33 commit ba532e6

16 files changed

+1038
-1
lines changed

.idea/.gitignore

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/multipool_setup.iml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
# yiimpool_setup
2-
Installation files for: Yiimpool installer
2+
3+
Installation files for yiimpool-installer
4+
5+
#### These files do nothing on their own please go to https://github.com/Afiniel-tech/Yiimpool-Installer

bootstrap_coin.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
#########################################################
3+
# Source https://mailinabox.email/ https://github.com/mail-in-a-box/mailinabox
4+
# Updated by afiniel-tech for yiimpool use...
5+
# This script is intended to be ran from the yiimpool installer
6+
#########################################################
7+
8+
if [ -z "${TAG}" ]; then
9+
TAG=v1.0
10+
fi
11+
12+
# Clone the yiimpool repository if it doesn't exist.
13+
if [ ! -d $HOME/yiimpool/daemon_builder ]; then
14+
echo Downloading yiimpool Daemon Builder Installer ${TAG}. . .
15+
git clone \
16+
-b ${TAG} --depth 1 \
17+
https://github.com/Afiniel-tech/yiimpool_coin_builder \
18+
$HOME/yiimpool/daemon_builder \
19+
< /dev/null 2> /dev/null
20+
21+
echo
22+
fi
23+
24+
# Change directory to it.
25+
cd $HOME/yiimpool/daemon_builder
26+
27+
# Update it.
28+
sudo chown -R $USER $HOME/yiimpool/install/.git/
29+
if [ "${TAG}" != `git describe --tags` ]; then
30+
echo Updating Daemon Builder Installer to ${TAG} . . .
31+
git fetch --depth 1 --force --prune origin tag ${TAG}
32+
if ! git checkout -q ${TAG}; then
33+
echo "Update failed. Did you modify something in `pwd`?"
34+
exit
35+
fi
36+
echo
37+
fi
38+
39+
# Start setup script.
40+
cd $HOME/yiimpool/daemon_builder
41+
source install.sh

bootstrap_single.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env bash
2+
3+
4+
#########################################################
5+
# Source https://mailinabox.email/ https://github.com/mail-in-a-box/mailinabox
6+
# Updated by afiniel-tech for yiimpool use...
7+
# This script is intended to be ran from the yiimpool installer
8+
#########################################################
9+
10+
if [ -z "${TAG}" ]; then
11+
TAG=v1.0
12+
fi
13+
14+
# Clone the yiimpool repository if it doesn't exist.
15+
if [ ! -d $HOME/yiimpool/yiimp_single ]; then
16+
echo Downloading yiimpool YiiMP Server Installer ${TAG}. . .
17+
git clone \
18+
-b ${TAG} --depth 1 \
19+
https://github.com/Afiniel-tech/yiimpool_yiimp_single \
20+
$HOME/yiimpool/yiimp_single \
21+
< /dev/null 2> /dev/null
22+
23+
echo
24+
fi
25+
26+
# Change directory to it.
27+
cd $HOME/yiimpool/yiimp_single
28+
29+
# Update it.
30+
sudo chown -R $USER $HOME/yiimpool/install/.git/
31+
if [ "${TAG}" != `git describe --tags` ]; then
32+
echo Updating yiimpool YiiMP Single Server Installer to ${TAG} . . .
33+
git fetch --depth 1 --force --prune origin tag ${TAG}
34+
if ! git checkout -q ${TAG}; then
35+
echo "Update failed. Did you modify something in `pwd`?"
36+
exit
37+
fi
38+
echo
39+
fi
40+
41+
# Start setup script.
42+
cd $HOME/yiimpool/yiimp_single
43+
source start.sh

create_user.sh

Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
#!/usr/bin/env bash
2+
#####################################################
3+
# Source https://mailinabox.email/ https://github.com/mail-in-a-box/mailinabox
4+
# Updated by afiniel-tech for yiimpool use...
5+
#####################################################
6+
7+
source /etc/functions.sh
8+
cd ~/yiimpool/install
9+
clear
10+
11+
# Welcome
12+
message_box "Yiimpool Installer v1.0" \
13+
"Hello and thanks for using the Yiimpool Installer v1.0!
14+
\n\nInstallation for the most part is fully automated. In most cases any user responses that are needed are asked prior to the installation.
15+
\n\nNOTE: You should only install this on a brand new Ubuntu 16.04 or Ubuntu 18.04 installation."
16+
# Root warning message box
17+
message_box "Yiimpool Installer v1.0" \
18+
"WARNING: You are trying to install as the root user!
19+
\n\nRunning any program as root is not recommended and can pose serious security risks that you want to avoid.
20+
\n\nThe next step you will be asked to create a new user account, you can name it whatever you want."
21+
22+
# Ask if SSH key or password user
23+
dialog --title "Create New User With SSH Key" \
24+
--yesno "Do you want to create your new user with SSH key login?
25+
Selecting no will create user with password login only." 7 60
26+
response=$?
27+
case $response in
28+
0) UsingSSH=yes;;
29+
1) UsingSSH=no;;
30+
255) echo "[ESC] key pressed.";;
31+
esac
32+
33+
# If Using SSH Key Login
34+
if [[ ("$UsingSSH" == "yes") ]]; then
35+
clear
36+
if [ -z "${yiimpadmin:-}" ]; then
37+
DEFAULT_yiimpadmin=yiimpadmin
38+
input_box "New username" \
39+
"Please enter your new username.
40+
\n\nUser Name:" \
41+
${DEFAULT_yiimpadmin} \
42+
yiimpadmin
43+
44+
if [ -z "${yiimpadmin}" ]; then
45+
# user hit ESC/cancel
46+
exit
47+
fi
48+
fi
49+
50+
if [ -z "${ssh_key:-}" ]; then
51+
DEFAULT_ssh_key=PublicKey
52+
input_box "Please open PuTTY Key Generator on your local machine and generate a new public key." \
53+
"To paste your Public key use ctrl shift right click.
54+
\n\nPublic Key:" \
55+
${DEFAULT_ssh_key} \
56+
ssh_key
57+
58+
if [ -z "${ssh_key}" ]; then
59+
# user hit ESC/cancel
60+
exit
61+
fi
62+
fi
63+
64+
# create random user password
65+
RootPassword=$(openssl rand -base64 8 | tr -d "=+/")
66+
clear
67+
68+
# Add user
69+
echo -e "Adding new user and setting SSH key...$COL_RESET"
70+
sudo adduser ${yiimpadmin} --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password
71+
echo -e "${RootPassword}\n${RootPassword}" | passwd ${yiimpadmin}
72+
sudo usermod -aG sudo ${yiimpadmin}
73+
# Create SSH Key structure
74+
mkdir -p /home/${yiimpadmin}/.ssh
75+
touch /home/${yiimpadmin}/.ssh/authorized_keys
76+
chown -R ${yiimpadmin}:${yiimpadmin} /home/${yiimpadmin}/.ssh
77+
chmod 700 /home/${yiimpadmin}/.ssh
78+
chmod 644 /home/${yiimpadmin}/.ssh/authorized_keys
79+
authkeys=/home/${yiimpadmin}/.ssh/authorized_keys
80+
echo "$ssh_key" > "$authkeys"
81+
82+
# enabling yiimpool command
83+
echo '# yiimp
84+
# It needs passwordless sudo functionality.
85+
'""''"${yiimpadmin}"''""' ALL=(ALL) NOPASSWD:ALL
86+
' | sudo -E tee /etc/sudoers.d/${yiimpadmin} >/dev/null 2>&1
87+
88+
echo '
89+
cd ~/yiimpool/install
90+
bash start.sh
91+
' | sudo -E tee /usr/bin/yiimpool >/dev/null 2>&1
92+
sudo chmod +x /usr/bin/yiimpool
93+
94+
# Check required files and set global variables
95+
cd $HOME/yiimpool/install
96+
source pre_setup.sh
97+
98+
# Create the STORAGE_USER and STORAGE_ROOT directory if they don't already exist.
99+
if ! id -u $STORAGE_USER >/dev/null 2>&1; then
100+
sudo useradd -m $STORAGE_USER
101+
fi
102+
if [ ! -d $STORAGE_ROOT ]; then
103+
sudo mkdir -p $STORAGE_ROOT
104+
fi
105+
106+
# Save the global options in /etc/yiimpool.conf so that standalone
107+
# tools know where to look for data.
108+
echo 'STORAGE_USER='"${STORAGE_USER}"'
109+
STORAGE_ROOT='"${STORAGE_ROOT}"'
110+
PUBLIC_IP='"${PUBLIC_IP}"'
111+
PUBLIC_IPV6='"${PUBLIC_IPV6}"'
112+
DISTRO='"${DISTRO}"'
113+
PRIVATE_IP='"${PRIVATE_IP}"'' | sudo -E tee /etc/yiimpool.conf >/dev/null 2>&1
114+
115+
sudo cp -r ~/yiimpool /home/${yiimpadmin}/
116+
cd ~
117+
sudo setfacl -m u:${yiimpadmin}:rwx /home/${yiimpadmin}/yiimpool
118+
sudo rm -r $HOME/yiimpool
119+
clear
120+
echo "New User is created and make sure you saved your private key..."
121+
echo -e "$RED Please reboot system and log in as $GREEN ${yiimpadmin} $COL_RESET $RED and type $COL_RESET $GREEN yiimpool $COL_RESET $RED to continue setup...$COL_RESET"
122+
exit 0
123+
fi
124+
125+
# New User Password Login Creation
126+
if [ -z "${yiimpadmin:-}" ]; then
127+
DEFAULT_yiimpadmin=yiimpadmin
128+
input_box "Creaete new username" \
129+
"Please enter your new username.
130+
\n\nUser Name:" \
131+
${DEFAULT_yiimpadmin} \
132+
yiimpadmin
133+
134+
if [ -z "${yiimpadmin}" ]; then
135+
# user hit ESC/cancel
136+
exit
137+
fi
138+
fi
139+
140+
if [ -z "${RootPassword:-}" ]; then
141+
DEFAULT_RootPassword=$(openssl rand -base64 8 | tr -d "=+/")
142+
input_box "User Password" \
143+
"Enter your new user password or use this randomly system generated one.
144+
\n\nUnfortunatley dialog doesnt let you copy. So you have to write it down.
145+
\n\nUser password:" \
146+
${DEFAULT_RootPassword} \
147+
RootPassword
148+
149+
if [ -z "${RootPassword}" ]; then
150+
# user hit ESC/cancel
151+
exit
152+
fi
153+
fi
154+
155+
clear
156+
157+
dialog --title "Verify Your input" \
158+
--yesno "Please verify your answers before you continue:
159+
160+
New User Name : ${yiimpadmin}
161+
New User Pass : ${RootPassword}" 8 60
162+
163+
# Get exit status
164+
# 0 means user hit [yes] button.
165+
# 1 means user hit [no] button.
166+
# 255 means user hit [Esc] key.
167+
response=$?
168+
case $response in
169+
170+
0)
171+
clear
172+
echo -e " Adding new user and password...$COL_RESET"
173+
174+
sudo adduser ${yiimpadmin} --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password
175+
echo -e ""${RootPassword}"\n"${RootPassword}"" | passwd ${yiimpadmin}
176+
sudo usermod -aG sudo ${yiimpadmin}
177+
178+
# enabling yiimpool command
179+
echo '# yiimp
180+
# It needs passwordless sudo functionality.
181+
'""''"${yiimpadmin}"''""' ALL=(ALL) NOPASSWD:ALL
182+
' | sudo -E tee /etc/sudoers.d/${yiimpadmin} >/dev/null 2>&1
183+
184+
echo '
185+
cd ~/yiimpool/install
186+
bash start.sh
187+
' | sudo -E tee /usr/bin/yiimpool >/dev/null 2>&1
188+
sudo chmod +x /usr/bin/yiimpool
189+
190+
# Check required files and set global variables
191+
cd $HOME/yiimpool/install
192+
source pre_setup.sh
193+
194+
# Create the STORAGE_USER and STORAGE_ROOT directory if they don't already exist.
195+
if ! id -u $STORAGE_USER >/dev/null 2>&1; then
196+
sudo useradd -m $STORAGE_USER
197+
fi
198+
if [ ! -d $STORAGE_ROOT ]; then
199+
sudo mkdir -p $STORAGE_ROOT
200+
fi
201+
202+
# Save the global options in /etc/yiimpool.conf so that standalone
203+
# tools know where to look for data.
204+
echo 'STORAGE_USER='"${STORAGE_USER}"'
205+
STORAGE_ROOT='"${STORAGE_ROOT}"'
206+
PUBLIC_IP='"${PUBLIC_IP}"'
207+
PUBLIC_IPV6='"${PUBLIC_IPV6}"'
208+
DISTRO='"${DISTRO}"'
209+
PRIVATE_IP='"${PRIVATE_IP}"'' | sudo -E tee /etc/yiimpool.conf >/dev/null 2>&1
210+
211+
sudo cp -r ~/yiimpool /home/${yiimpadmin}/
212+
cd ~
213+
sudo setfacl -m u:${yiimpadmin}:rwx /home/${yiimpadmin}/yiimpool
214+
sudo rm -r $HOME/yiimpool
215+
clear
216+
echo -e "$RED New User is $COL_RESET $GREEN Created $COL_RESET $RED...$COL_RESET"
217+
echo -e "$RED Please reboot system and log in as the new user $GREEN ${yiimpadmin} $COL_RESET and type$COL_RESET $GREEN yiimpool$COL_RESET $RED to continue setup...$COL_RESET"
218+
exit 0;;
219+
220+
1)
221+
222+
clear
223+
bash $(basename $0) && exit;;
224+
225+
255)
226+
227+
;;
228+
esac

0 commit comments

Comments
 (0)