-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
102 lines (91 loc) · 3.17 KB
/
install.sh
File metadata and controls
102 lines (91 loc) · 3.17 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/bash
# ============================================================
# HyperType - Linux/macOS Installer
# Usage:
# curl -sSL https://raw.githubusercontent.com/KrishT0/hypertype/main/install.sh | bash
# ============================================================
set -e
REPO="KrishT0/hypertype"
INSTALL_DIR="/usr/local/bin"
BINARY_NAME="hypertype"
# ============================================================
# Detect OS
# ============================================================
OS_TYPE=$(uname -s)
case "$OS_TYPE" in
Linux*)
PLATFORM="Linux"
DOWNLOAD_NAME="hypertype-linux"
;;
Darwin*)
PLATFORM="macOS"
DOWNLOAD_NAME="hypertype-mac"
;;
*)
echo "ERROR: Unsupported OS: $OS_TYPE"
exit 1
;;
esac
DOWNLOAD_URL="https://github.com/$REPO/releases/latest/download/$DOWNLOAD_NAME"
# ============================================================
# Welcome
# ============================================================
echo "============================================"
echo " Installing HyperType for $PLATFORM..."
echo "============================================"
echo
# ============================================================
# Check sudo
# ============================================================
if [ "$(id -u)" -ne 0 ]; then
echo " Sudo access is required. You may be prompted for your password."
SUDO="sudo"
else
SUDO=""
fi
# ============================================================
# Download
# ============================================================
echo " [1/3] Downloading..."
$SUDO curl -sSL -o "$INSTALL_DIR/$BINARY_NAME" "$DOWNLOAD_URL"
if [ ! -f "$INSTALL_DIR/$BINARY_NAME" ]; then
echo " ERROR: Download failed. Check your internet connection."
exit 1
fi
echo " Done!"
# ============================================================
# Make executable
# ============================================================
echo " [2/3] Setting permissions..."
$SUDO chmod +x "$INSTALL_DIR/$BINARY_NAME"
echo " Done!"
# ============================================================
# Linux: Add to input group for keyboard access
# ============================================================
if [ "$PLATFORM" = "Linux" ]; then
CURRENT_USER=$(whoami)
if ! groups "$CURRENT_USER" | grep -q "input"; then
echo " [3/3] Adding keyboard permissions..."
$SUDO usermod -aG input "$CURRENT_USER"
echo " Done! Please log out and back in for keyboard access."
else
echo " [3/3] Keyboard permissions already set."
fi
else
echo " [3/3] Finalizing..."
echo " Done!"
fi
# ============================================================
# Success
# ============================================================
echo
echo "============================================"
echo " HyperType installed successfully!"
echo "============================================"
echo
echo " Run these commands:"
echo " hypertype - Welcome screen"
echo " hypertype start 30 - Start a 30s test"
echo " hypertype stats - View your stats"
echo
echo "============================================"