-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathinstall.sh
executable file
·126 lines (106 loc) · 4.95 KB
/
install.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
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
#!/usr/bin/env bash
#//////////////////////////////////////////////////////////////
#// ____ //
#// | __ ) ___ _ __ ___ _ _ _ __ ___ _ __ _ __ ___ //
#// | _ \ / _ \ '_ \/ __| | | | '_ \ / _ \ '__| '_ \ / __| //
#// | |_) | __/ | | \__ \ |_| | |_) | __/ | | |_) | (__ //
#// |____/ \___|_| |_|___/\__,_| .__/ \___|_| | .__/ \___| //
#// |_| |_| //
#//////////////////////////////////////////////////////////////
#// //
#// Script, 2021 //
#// Created: 27, May, 2021 //
#// Modified: 29, July, 2021 //
#// file: - //
#// - //
#// Source: https://unix.stackexchange.com/a/39341/359833 //
#// https://stackoverflow.com/a/42876846/10152334 //
#// https://stackoverflow.com/a/3837487/10152334
#// OS: ALL //
#// CPU: ALL //
#// //
#//////////////////////////////////////////////////////////////
if [ $# -eq 0 ]; then
read -r -p "Install Software ? [Y/n]: " answ
if [ "$answ" == 'n' ]; then
exit 1
fi
fi
if [[ "$EUID" = 0 ]]; then
echo "(1) already root"
else
sudo -k # make sure to ask for password on next sudo
if sudo true; then
echo "(2) correct password"
else
echo "(3) wrong password"
exit 1
fi
fi
echo "Install ben's scripts"
echo "Clean..."
sudo find /usr/bin -lname '/usr/bin/ben_script/*' -delete
sudo rm -rf /usr/bin/ben_script
echo "Clean done"
echo "copy..."
sudo mkdir -p /usr/bin/ben_script && sudo cp -a . /usr/bin/ben_script
echo "copy done"
echo "Install ben's scripts (docker-scripts and gpg-encrypt)..."
echo "create symlink..."
find /usr/bin/ben_script -type f \( -name "*.sh" -o -name "*.py" \) ! -path "*./git/*" \
! -path "*/install.sh" ! -path "*/uninstall.sh" ! -path "*/Bash-Snippet/*" \
! -path "*/git-scripts/*" ! -path "*/git-extras/*" ! -path "*/git-extra-commands/*" \
! -path "*/cryptr/*" ! -path "*/bash-scripts/*" ! -path "*/fff/*" ! -path "*/adb-sync/*" \
! -path "*/shell-scripts/*" -print0 | xargs -0 -P"$(nproc)" -I{} sudo ln -s "{}" /usr/bin || true
echo "create symlink done"
echo "Install ben's scripts done"
echo "Install Bash-Snippet..."
cd /usr/bin/ben_script/Bash-Snippet || { echo "Failure"; exit 1; }
sudo ./install.sh all
echo "Install Bash-Snippet done"
echo "Install git-extras..."
cd /usr/bin/ben_script/git/git-extras || { echo "Failure"; exit 1; }
sudo make install
echo "Install git-extras done"
echo "Install git-quick-stats..."
cd /usr/bin/ben_script/git/git-quick-stats || { echo "Failure"; exit 1; }
sudo make install
echo "Install git-quick-stats done"
echo "Install fff..."
cd /usr/bin/ben_script/fff || { echo "Failure"; exit 1; }
sudo make install
echo "Install fff done"
echo "Install git-scripts..."
find /usr/bin/ben_script/git/git-scripts -type f -name "git-*" \
! -path "*./git/*" -print0 | xargs -0 -P"$(nproc)" -I{} sudo ln -s "{}" /usr/bin || true
echo "Install git-scripts done"
echo "Install git-extra-commands..."
find /usr/bin/ben_script/git/git-extra-commands/bin -type f -name "*" \
! -path "*./git/*" -print0 | xargs -0 -P"$(nproc)" -I{} sudo ln -s "{}" /usr/bin || true
echo "Install git-extra-commands done"
echo "Install cryptr..."
ln -s /usr/bin/ben_script/cryptography/cryptr/cryptr.bash /usr/bin/cryptr
echo "Install cryptr done"
echo "Install spoofpoint..."
ln -s /usr/bin/ben_script/internet/spoofpoint/spoofpoint /usr/bin/spoofpoint
echo "Install spoofpoint done"
echo "Install shell-scripts..."
find /usr/bin/ben_script/shell-scripts -type f -name "*.sh" \
! -path "*./git/*" -print0 | xargs -0 -P"$(nproc)" -I{} sudo ln -s "{}" /usr/bin || true
echo "Install shell-scripts done"
echo "Install bash-scripts..."
find /usr/bin/ben_script/bash-scripts -type f -name "*.sh" \
! -path "*./git/*" -print0 | xargs -P"$(nproc)" -0 -I{} sudo ln -s "{}" /usr/bin || true
echo "Install bash-scripts done"
echo "Install adb-sync.."
ln -s /usr/bin/ben_script/file/adb-sync /usr/bin/adb-sync
echo "Install adb-sync done"
echo "Remove *.sh ..."
# Move it by remove file extension (if does not exit)
find /usr/bin -lname '/usr/bin/ben_script/*.sh' | while read -r NAME ; do sudo mv -nv "${NAME}" "${NAME%.sh}" || echo "Fail: ${NAME}" ; done
echo "Remove *.sh done"
echo "Remove *.py ..."
# Move it by remove file extension (if does not exit)
find /usr/bin -lname '/usr/bin/ben_script/*.py' | while read -r NAME ; do sudo mv -nv "${NAME}" "${NAME%.py}" || echo "Fail: ${NAME}" ; done
echo "Remove *.py done"
echo "Install done"