This repository was archived by the owner on Jan 22, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinitsmhp.sh
More file actions
58 lines (48 loc) · 2.01 KB
/
initsmhp.sh
File metadata and controls
58 lines (48 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
[[ "$1" == "" ]] && NODE_TYPE=other || NODE_TYPE="$1"
set -exuo pipefail
# Remember to ensure this script runs after hotfix, to prevent updates on specific packages.
# Once cluster is ready, check whether needs to reboot: src/sample-slurm-jobs/check-need-reboot.sh.
apt -o DPkg::Lock::Timeout=120 -y upgrade -V
BIN_DIR=$(dirname $(realpath ${BASH_SOURCE[@]}))
chmod ugo+x $BIN_DIR/initsmhp/*.sh
bash -x $BIN_DIR/initsmhp/disable-gui.sh
declare -a PKGS_SCRIPTS=(
install-pkgs.sh
install-delta.sh
install-duf.sh
install-s5cmd.sh
install-tmux.sh
install-mount-s3.sh
install-git-remote-codecommit.sh
)
mkdir /var/log/initsmhp
for i in "${PKGS_SCRIPTS[@]}"; do
bash -x $BIN_DIR/initsmhp/$i &> /var/log/initsmhp/$i.txt \
&& echo "SUCCESS: $i" >> /var/log/initsmhp/initsmhp.txt \
|| echo "FAIL: $i" >> /var/log/initsmhp/initsmhp.txt
done
bash -x $BIN_DIR/initsmhp/fix-profile.sh
bash -x $BIN_DIR/initsmhp/ssh-to-compute.sh
bash -x $BIN_DIR/initsmhp/adjust-git.sh
bash -x $BIN_DIR/initsmhp/fix-bash.sh /etc/skel/.bashrc
cp $BIN_DIR/initsmhp/vimrc /etc/skel/.vimrc
# /opt/ml/config/resource_config.json is not world-readable, so take only the part that later-on
# used for ssh-keygen comment.
cat /opt/ml/config/resource_config.json | jq '.ClusterConfig' > /opt/initsmhp-cluster_config.json
if [[ "${NODE_TYPE}" == "controller" ]]; then
echo "[INFO] This is a Controller node."
runuser -l ubuntu $BIN_DIR/initsmhp/gen-keypair-ubuntu.sh
bash -x $BIN_DIR/initsmhp/fix-bash.sh ~ubuntu/.bashrc
cp $BIN_DIR/initsmhp/vimrc ~ubuntu/.vimrc && chown ubuntu:ubuntu ~ubuntu/.vimrc
bash -x $BIN_DIR/initsmhp/howto-miniconda.sh
fi
# Placeholder for xterm-kitty terminfo. No actual terminfo is setup. Instead,
# ubuntu user must follow https://sw.kovidgoyal.net/kitty/kittens/ssh/ (only
# when ssh-ing from this particular terminal emulator).
/bin/bash -c '
if [[ ! -f ~/.terminfo/x/xterm-kitty ]]; then
mkdir -p ~/.terminfo/x/
ln -s ~ubuntu/.terminfo/x/xterm-kitty ~/.terminfo/x/
fi
'