-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·103 lines (81 loc) · 2.39 KB
/
install
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
if [ -z "$(which zsh)" ]; then
echo "not found zsh"
exit 1
fi
function input_password()
{
password=''
while IFS= read -n 1 -s -p "" passchar < /dev/tty ; do
[[ -z $passchar ]] && { printf '\n' >/dev/tty; break; } # ENTER pressed; output \n and break.
if [[ $passchar = $'\x7f' ]]; then # backspace was pressed
# Remove last char from output variable.
[[ -n $password ]] && password=${password%?}
# Erase '*' to the left.
if [ $count -gt 0 ]; then
printf '\b \b' >/dev/tty
count=$(expr $count - 1)
fi
else
count=$(expr $count + 1)
# Add typed char to output variable.
password+=$passchar
# Print '*' in its stead.
printf '*' >/dev/tty
fi
done
echo "${password}"
unset password
}
cd $HOME
if [ -f "$HOME/.ssh/id_rsa" ]; then
read -n 1 -p "git clone ssh? (y/n): " input_char < /dev/tty
echo
if [[ "$input_char" = "y" ]]; then
source $HOME/.dotfiles/script/ssh-agent-init.sh
source $HOME/.dotfiles/script/passkey_filepath
if [ -f "$PASSPATH_SSH_AGENT" ]; then
( { sleep .1; echo "$(cat ""$PASSPATH_SSH_AGENT"" | tr -d '\r' | tr -d '\n')"; } | script -q /dev/null -c "ssh-add $HOME/.ssh/id_rsa" ) > /dev/null
else
# read -p "input pass? (y/n): " input_pass < /dev/tty
echo -n "input password (hidden) : "
input_pass=$( input_password )
echo
( { sleep .1; echo "$input_pass"; } | script -q /dev/null -c "ssh-add $HOME/.ssh/id_rsa" ) > /dev/null
echo "passphrase done"
fi
git clone "[email protected]:/iblea/.dotfiles.git"
else
git clone "https://github.com/iblea/.dotfiles.git"
fi
else
git clone "https://github.com/iblea/.dotfiles.git"
fi
if [ ! -d "$HOME/.dotfiles/" ]; then
echo "git clone failed."
exit 1
fi
echo ""
echo "clone done"
echo ""
cd "$HOME/.dotfiles/"
script/install_zsh.sh
if [ ! -d "$HOME/.zsh/" ]; then
echo "install oh-my-zsh / p10k failed."
exit 1
fi
if [ -f "$HOME/.zshrc" ]; then
rm -f "$HOME/.zshrc"
fi
echo ""
echo "install oh-my-zsh / p10k"
echo ""
script/ssh_set_init.sh
if [ ! -f "$HOME/.ssh/config" ]; then
echo "ssh init failed."
exit 1
fi
echo ""
echo "ssh init done"
echo ""
./settings.sh