-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
201 lines (174 loc) · 7.03 KB
/
install.sh
File metadata and controls
201 lines (174 loc) · 7.03 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
#!/usr/bin/env bash
set -e
# Windows to Linux! (Install)
# This script is used to convert Windows commands to Linux commands
# It is used to help users to find the equivalent command in Linux
# ================================================================
# Author: @Nythique: https://github.com/Nythique
# ================================================================
# Project Name: SmoothTerminal
# Version: 1.0.0
# Operating System: Linux
# ================================================================
# Colors
GREEN='\033[0;32m'
RESET='\033[0m'
CYAN='\033[0;36m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
# Variables
ALIAS_FILE="WinToLinux.sh"
TARGET="$HOME/WinToLinux.sh"
# Enable colors if terminal
if [ -t 1 ]; then
COLOR_ON=true
else
COLOR_ON=false
fi
# Functions
transition_effect() {
echo
echo -e "${BLUE}Windows ${YELLOW}>>> ${GREEN}Linux${RESET}"
echo
# Exemple de conversions
local windows=(".... " ".... " ".... " ".... " ".... ")
local linux=("025%" "050%" "075%" "099%" "100%")
for ((i=0; i<${#windows[@]}; i++)); do
echo -ne "${BLUE}${windows[$i]}${RESET}"
for ((j=0; j<3; j++)); do
echo -ne "${YELLOW} >${RESET}"
sleep 0.1
done
echo -e " ${GREEN}${linux[$i]}${RESET}"
sleep 0.3
done
echo
echo -e "${GREEN}Conversion de commandes prête...${RESET}"
sleep 1
echo
}
cecho() {
local text="$1"
if $COLOR_ON; then
local padding=$(printf '%*s' $(((${#text} + 20))))
echo -e "${GREEN}"
echo -e "╔${padding// /═}╗"
echo -e "║ $text ║"
echo -e "╚${padding// /═}╝${RESET}"
else
echo "$text"
fi
}
# Clear screen and show logo
# Fonction pour l'animation de démarrage
startup_animation() {
clear
# Effet de "chargement" du logo
for ((i=1; i<=4; i++)); do
clear
case $i in
1) echo -e "${BLUE}";;
2) echo -e "${CYAN}";;
3) echo -e "${YELLOW}";;
4) echo -e "${GREEN}";;
esac
cat << EOF
_____ _ _ _____
| __|_ _ ___ ___ ___| |_| |___|_ _|___ ___ _____ ___
|__ | | | _| . | . | _| |___| | | | -_| _| |_ -|
|_____|___|_| |___|___|_| |_| |_| |___|_| |_|_|_|___|
EOF
sleep 0.2
done
echo
echo -e "${YELLOW}╔════════════════════════════════════════╗${RESET}"
echo -e "${YELLOW}║${RESET} ${BLUE}Windows${RESET} ${GREEN}Command Converter${RESET} ${YELLOW}║${RESET}"
echo -e "${YELLOW}╚════════════════════════════════════════╝${RESET}"
echo
# Exemples de conversion avec animation
echo -e "${CYAN}Initializing command translations...${RESET}"
sleep 0.2
echo
# Exemple de conversions
local windows=(".... " ".... " ".... " ".... " ".... ")
local linux=("025%" "050%" "075%" "099%" "100%")
for ((i=0; i<${#windows[@]}; i++)); do
echo -ne " ${BLUE}${windows[$i]}${RESET} "
for ((j=0; j<3; j++)); do
echo -ne "${YELLOW}▶${RESET}"
sleep 0.05
done
echo -e " ${GREEN}${linux[$i]}${RESET}"
sleep 0.1
done
echo
echo -e "${YELLOW}╔════════════════════════════════════════╗${RESET}"
echo -e "${YELLOW}║${RESET} ${GREEN}Command Conversion Ready !${RESET} ${YELLOW}║${RESET}"
echo -e "${YELLOW}╚════════════════════════════════════════╝${RESET}"
echo
sleep 0.3
}
# Lancer l'animation de démarrage
startup_animation
clear
# Installation process
echo -e "\n${YELLOW}╔════════════════════════════════════════╗${RESET}"
echo -e "${YELLOW}║${RESET} ${CYAN}Shell Detection${RESET} ${YELLOW}║${RESET}"
echo -e "${YELLOW}╚════════════════════════════════════════╝${RESET}"
echo
sleep 0.1
if [ -n "${ZSH_VERSION:-}" ]; then
RC_FILE="$HOME/.zshrc"
echo -e " ${GREEN}✓${RESET} Zsh shell detected"
sleep 0.1
elif [ -n "${BASH_VERSION:-}" ]; then
RC_FILE="$HOME/.bashrc"
echo -e " ${GREEN}✓${RESET} Bash shell detected"
sleep 0.1
else
RC_FILE="$HOME/.bashrc"
echo -e " ${YELLOW}!${RESET} Defaulting to Bash shell"
sleep 0.1
fi
sleep 0.2
clear
# Displaying the installation header
echo -e "\n${YELLOW}╔════════════════════════════════════════╗${RESET}"
echo -e "${YELLOW}║${RESET} ${CYAN}Installing Files${RESET} ${YELLOW}║${RESET}"
echo -e "${YELLOW}╚════════════════════════════════════════╝${RESET}"
echo
# Animation de copie
echo -ne " ${BLUE}⟳${RESET} Copying files"
for ((i=0; i<3; i++)); do
echo -ne "."
sleep 0.2
done
cp "$ALIAS_FILE" "$TARGET"
echo -e "\r ${GREEN}✓${RESET} Files copied successfully "
sleep 0.5
echo -e "\n${YELLOW}╔════════════════════════════════════════╗${RESET}"
echo -e "${YELLOW}║${RESET} ${CYAN}Configuration${RESET} ${YELLOW}║${RESET}"
echo -e "${YELLOW}╚════════════════════════════════════════╝${RESET}"
echo
echo -ne " ${BLUE}⟳${RESET} Setting up shell configuration"
for ((i=0; i<3; i++)); do
echo -ne "."
sleep 0.2
done
if ! grep -Fxq "source ~/WinToLinux.sh" "$RC_FILE"; then
echo "source ~/WinToLinux.sh" >> "$RC_FILE"
echo -e "\r ${GREEN}✓${RESET} Shell configuration updated "
else
echo -e "\r ${YELLOW}!${RESET} Configuration already exists "
fi
sleep 0.1
# Final message with style
clear
echo -e "\n${GREEN}╔════════════════════════════════════════╗${RESET}"
echo -e "${GREEN}║${RESET} ${CYAN}Installation Complete !${RESET} ${GREEN}║${RESET}"
echo -e "${GREEN}╚════════════════════════════════════════╝${RESET}"
# Reminder to apply changes
source /home/nythique/.bashrc
echo -e "${YELLOW}╔════════════════════════════════════════╗${RESET}"
echo -e "${YELLOW}║${RESET} ${GREEN}Happy command converting!${RESET} ${YELLOW}║${RESET}"
echo -e "${YELLOW}╚════════════════════════════════════════╝${RESET}"