-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit_cli.sh
executable file
Β·68 lines (57 loc) Β· 1.67 KB
/
init_cli.sh
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
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
# ============================================
# Step CLI Setup Script (Efficient Version)
# --------------------------------------------
# Installs:
# - step-cli (Smallstep CLI)
# - zip (for packaging certs)
# - qrencode (optional, for QR sharing)
# Only runs 'apt update' if something needs to be installed.
# ============================================
set -e
echo "π Checking required tools..."
NEED_APT_UPDATE=false
# === Check Step CLI ===
if ! command -v step >/dev/null 2>&1; then
echo "π¦ step-cli not found. Installing..."
wget https://dl.smallstep.com/cli/docs-cli-install/latest/step-cli_amd64.deb
sudo dpkg -i step-cli_amd64.deb
rm step-cli_amd64.deb
else
echo "β
step-cli already installed."
fi
# === Check zip ===
if ! command -v zip >/dev/null 2>&1; then
echo "π¦ zip not found. Will install it."
NEED_APT_UPDATE=true
INSTALL_ZIP=true
else
echo "β
zip already installed."
fi
# === Check qrencode (optional) ===
if ! command -v qrencode >/dev/null 2>&1; then
echo "π‘ qrencode (for QR sharing) not found."
read -rp " β Do you want to install qrencode? (Y/n): " RESP
if [[ "$RESP" =~ ^[Yy]$ || -z "$RESP" ]]; then
NEED_APT_UPDATE=true
INSTALL_QRENCODE=true
else
echo "β οΈ Skipping qrencode install."
fi
else
echo "β
qrencode already installed."
fi
# === Do apt update if needed ===
if [ "$NEED_APT_UPDATE" = true ]; then
echo "π Updating package list..."
sudo apt update
fi
# === Install missing packages ===
if [ "$INSTALL_ZIP" = true ]; then
sudo apt install -y zip
fi
if [ "$INSTALL_QRENCODE" = true ]; then
sudo apt install -y qrencode
fi
echo ""
echo "π All done! CLI tools are ready to use."