-
Notifications
You must be signed in to change notification settings - Fork 1
/
initlinux.sh
executable file
·148 lines (123 loc) · 3.96 KB
/
initlinux.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/usr/bin/env bash
#!/bin/bash
# Function to display usage information
usage() {
echo "Usage: $0 <parameter>"
echo "Example: $0 'Hello World'"
exit 1
}
# Check if a parameter is provided
# if [ $# -eq 0 ]; then
# echo "Error: No parameter provided."
# usage
# fi
# Store the parameter in a variable
autoopflag="$1"
# Function to process the parameter
process_parameter() {
local input="$1"
# echo "The parameter you provided is: $input"
# echo "Processing the parameter..."
# Add your processing logic here
# echo "Parameter processed successfully!"
if [ "$input" == "-y" ]; then
echo "The parameter you provided is: $input"
elif [ "$input" == "" ]; then
echo "The parameter you provided is: $input"
else
echo "Error: Invalid parameter provided."
usage
fi
}
# Call the function with the provided parameter
process_parameter "$autoopflag"
if [ "$autoopflag" != "-y" ]; then
echo now we will install basic apps , N to skip
read -rp "ok? (y/N): " yn
else
echo "auto piloting... "
yn="y"
fi
case "$yn" in [yY]*) #this is the condition yes
sudo apt-get update
sudo apt-get upgrade -y
#install basic system components
sudo apt-get install -y zsh
sudo apt-get install -y curl
#installing oh my zsh and powerlevel10k
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# clean powerlevel10k folder if exists
rm -rf "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}"/themes/powerlevel10k
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
#clean zsh plugins if folder exists
rm -rf ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
rm -rf ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
rm -rf ${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions
#installing zsh plugins
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions
# linking diff_highlight to system . git should be from brew . this needs to be confirmed
sudo ln -s /usr/local/share/git-core/contrib/diff-highlight/diff-highlight /usr/local/bin/diff-highlight
if [ "$autoopflag" != "-y" ]; then
#ask user if they want to instal the additional apps
read -rp "install additional apps? (y/N): " yn
else
yn="y"
fi
case "$yn" in [yY]*) #this is the condition yes
#installing additional apps
./misc/aptinit.sh
./misc/fontinit.sh
./misc/rdp/remotedesktopsetup.sh
if [ "$autoopflag" != "-y" ]; then
#ask user if they want to install snap apps
read -rp "install snap apps? (y/N): " yn
else
yn="y"
fi
case "$yn" in [yY]*) #this is the condition yes
#installing snap apps
./misc/snapinit.sh
./misc/installgooglechrome.sh
;;
*) #this is the condition no
echo "skip the snap packages" ;;
esac
;;
*) #this is the condition no
echo "skip the packages" ;;
esac
;;
*) #this is the condition no
echo "skip the basic apps" ;;
esac
# exit
cd ..
if [ "$autoopflag" != "-y" ]; then
echo this will overwrite the setting on this user ....
read -rp "ok? (y/N): " yn
else
yn="y"
fi
case "$yn" in [yY]*) #this is condition for yes
# taking gitconfig to seperate machines.
rm -r .gitconfig
rm -r .config
rm -r .tmux.conf
rm -r .tmux.conf.local
rm -r .zshrc
rm -r .p10k.zsh
#ln -s akazsh/.gitconfig .gitconfig
cp akazsh/.gitconfig .gitconfig
ln -s akazsh/.config .config
ln -s akazsh/mytmux/.tmux.conf.local .tmux.conf.local
ln -s akazsh/mytmux/.tmux.conf .tmux.conf
ln -s akazsh/.zshrc .zshrc
ln -s akazsh/.p10k.zsh .p10k.zsh
;;
*) #this is condition for no
echo "abort."
exit
;;
esac