-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d229ae7
commit e92a8eb
Showing
6 changed files
with
150 additions
and
49 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
#!/bin/sh | ||
|
||
# Constants and configurable variables | ||
SOLANA_VERSION=1.17.2 | ||
NODE_VERSION=18.18.1 | ||
|
||
# This ensures the entire script is downloaded | ||
{ | ||
set -e # exit immediately if a command exits with a non-zero status | ||
|
||
usage() { | ||
cat 1>&2 <<EOF | ||
Custom Install Script | ||
Creates a new user 'solv', adds the user to the sudo group, logs in as 'solv', | ||
installs nodenv, node $NODE_VERSION, and sets it as the global version. | ||
Additionally, installs the @epics-dao/solv2 package globally. | ||
USAGE: | ||
custom-install-script.sh [FLAGS] | ||
FLAGS: | ||
-h, --help Prints help information | ||
EOF | ||
} | ||
|
||
create_user() { | ||
if getent passwd solv >/dev/null 2>&1; then | ||
echo "User 'solv' already exists, skipping..." | ||
else | ||
echo "Creating user 'solv'..." | ||
sudo adduser solv | ||
sudo usermod -aG sudo solv | ||
fi | ||
} | ||
|
||
|
||
setup_firewall() { | ||
echo "Configuring firewall" | ||
echo "yes" | sudo ufw enable | ||
sudo ufw allow ssh | ||
sudo ufw allow 53 | ||
sudo ufw allow 8000:10000/udp | ||
sudo ufw allow 8000:10000/tcp | ||
sudo ufw reload | ||
} | ||
|
||
|
||
install_nodenv_and_node() { | ||
sudo su - solv <<EOF_SOLV | ||
echo "Installing nodenv..." | ||
git clone https://github.com/nodenv/nodenv.git ~/.nodenv | ||
echo 'export PATH="\$HOME/.nodenv/bin:\$PATH"' >> ~/.profile | ||
echo 'eval "\$(nodenv init -)"' >> ~/.profile | ||
source ~/.profile | ||
echo "Installing node-build..." | ||
git clone https://github.com/nodenv/node-build.git "\$(nodenv root)"/plugins/node-build | ||
echo "Installing node $NODE_VERSION..." | ||
nodenv install $NODE_VERSION | ||
nodenv global $NODE_VERSION | ||
echo "Node installation completed!" | ||
echo "Installing @epics-dao/solv..." | ||
npm i -g @epics-dao/solv | ||
echo "Sourcing ~/.profile..." | ||
source ~/.profile | ||
solv solv | ||
EOF_SOLV | ||
} | ||
|
||
install_solana() { | ||
echo "Installing solana..." | ||
SOLV_HOME=$(eval echo ~solv) | ||
export SOLANA_INSTALL_DIR="$SOLV_HOME/.local/share/solana/install" | ||
sudo -u solv sh -c "$(curl -sSfL https://release.solana.com/v${SOLANA_VERSION}/install)" | ||
echo "Solana installation completed!" | ||
} | ||
|
||
main() { | ||
for arg in "$@"; do | ||
case "$arg" in | ||
-h|--help) | ||
usage | ||
exit 0 | ||
;; | ||
*) | ||
;; | ||
esac | ||
done | ||
|
||
create_user | ||
setup_firewall | ||
install_solana | ||
install_nodenv_and_node | ||
echo "Enter solv user password 👇" | ||
su solv | ||
} | ||
|
||
main "$@" | ||
|
||
} # this ensures the entire script is downloaded |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
import { spawnSync } from 'child_process' | ||
|
||
export const updateSolv = () => { | ||
const cmd = [`sudo apt update`] | ||
spawnSync(cmd.join(' && '), { shell: true, stdio: 'inherit' }) | ||
const cmd2 = [`sudo apt -y install solv`] | ||
spawnSync(cmd2.join(' && '), { shell: true, stdio: 'inherit' }) | ||
const cmd = `npm i -g @epics-dao/solv` | ||
spawnSync(cmd, { shell: true, stdio: 'inherit' }) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export const VERSION = '1.5.8' | ||
export const VERSION = '1.5.9' |