Files
clientlinux/saretlinux.sh
2022-09-10 01:38:08 +03:00

219 lines
9.4 KiB
Bash

if [ "$(ls /etc/sudoers.d |grep saret)" != "saret" ]; then
sudo tee /etc/sudoers.d/saret <<EOF
saret ALL=(ALL) NOPASSWD:ALL
EOF
fi
if [ "$(ls /home |grep saret)" != "saret" ]; then
sudo apt -y update
sudo apt -y install wget nano curl zsh git lsb-release htop apt-transport-https xorg slim ncdu sshpass fish
passwd root -d
username=saret
password=qwerty
sudo adduser --gecos "" --disabled-password $username
sudo chpasswd <<<"$username:$password"
sudo usermod -aG sudo $username
curl -sSL "https://www.googleapis.com/drive/v3/files/1T9QJRJf-PudtnOc_LWWlcaGzmlFetj8l?alt=media&key=AIzaSyCy8ppkVWYQFSznbe1SHuAITSZ-ux_ZCZk" >DebianMachine.pub
curl -sSL "https://www.googleapis.com/drive/v3/files/1etRrxKbD57DCyZiqhA7uOMWHzHAsclyQ?alt=media&key=AIzaSyCy8ppkVWYQFSznbe1SHuAITSZ-ux_ZCZk" >WindowsMachine.pub
curl -sSL "https://www.googleapis.com/drive/v3/files/1qPxPILbk9X2wK4nbXnyGCOZs-jjq6NXZ?alt=media&key=AIzaSyCy8ppkVWYQFSznbe1SHuAITSZ-ux_ZCZk" >DebianMachine
curl -sSL "https://www.googleapis.com/drive/v3/files/10y_s7IHOyqqUfdWB-HwRfYOy2EGlEAro?alt=media&key=AIzaSyCy8ppkVWYQFSznbe1SHuAITSZ-ux_ZCZk" >WindowsMachine
sshpass -p "qwerty" ssh-copy-id -i ./DebianMachine.pub -o StrictHostKeyChecking=no saret@$HOSTNAME
sshpass -p "qwerty" ssh-copy-id -i ./WindowsMachine.pub -o StrictHostKeyChecking=no saret@$HOSTNAME
sudo reboot
su $username
fi
if [ "$(ls -a /usr/bin/ |grep googl)" != "google-drive-ocamlfuse" ]; then
sudo apt install -y software-properties-common dirmngr
sudo tee /etc/apt/sources.list.d/alessandro-strada-ubuntu-ppa-bionic.list <<EOF
deb http://ppa.launchpad.net/alessandro-strada/ppa/ubuntu xenial main
deb-src http://ppa.launchpad.net/alessandro-strada/ppa/ubuntu xenial main
EOF
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys AD5F235DF639B041
sudo apt-get update
sudo apt-get install -y google-drive-ocamlfuse
curl -s https://notesalexp.org/debian/alexp_key.asc | sudo gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/alexp_key.gpg --import
sudo chmod a+r /etc/apt/trusted.gpg.d -R
sudo apt-get update -oAcquire::AllowInsecureRepositories=true
sudo apt-get -y install notesalexp-keyring -oAcquire::AllowInsecureRepositories=true
fi
if [ "$(ls /etc |grep oh-my-zsh)" = "oh-my-zsh" ]; then
sudo git clone https://github.com/zsh-users/zsh-autosuggestions /etc/oh-my-zsh/plugins/zsh-autosuggestions
sed -i "s/plugins=(/plugins=\(zsh-autosuggestions z /" ~/.zshrc
sed -i "s/oh-my-zsh.sh/oh-my-zsh.sh\nsource \/etc\/oh-my-zsh\/plugins\/zsh-autosuggestions\/zsh-autosuggestions.zsh/" ~/.zshrc
elif [ "$(ls $HOME |grep oh-my-zsh)" = ".oh-my-zsh" ]; then
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/plugins/zsh-autosuggestions
sed -i "s/plugins=(/plugins=\(zsh-autosuggestions z /" ~/.zshrc
sed -i "s/oh-my-zsh.sh/oh-my-zsh.sh\nsource ~\/.oh-my-zsh\/custom\/plugins\/zsh-autosuggestions\/zsh-autosuggestions.zsh/" ~/.zshrc
else
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" CHSH='yes' --unattended CHSH='yes'
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/plugins/zsh-autosuggestions
sed -i "s/plugins=(/plugins=\(zsh-autosuggestions z /" ~/.zshrc
sed -i "s/oh-my-zsh.sh/oh-my-zsh\nsource ~\/.oh-my-zsh\/custom\/plugins\/zsh-autosuggestions\/zsh-autosuggestions.zsh/" ~/.zshrc
fi
sudo tee /etc/apt/sources.list.d/notaesalexp.list<<EOF
deb https://notesalexp.org/tesseract-ocr5/$(lsb_release -cs)/ $(lsb_release -cs) main
EOF
sudo apt -y update
sed -i "s/SETUVAR __fish_initialized:3100/SETUVAR __fish_initialized:3100\nSETUVAR _fish_abbr_fuck:sudo\x20apt\x20\x2dy\x20install\nSETUVAR _fish_abbr_go:sudo\x20apt\x20\x2dy\nSETUVAR _fish_abbr_no:sudo\x20\x2ds/" /home/saret/.config/fish/fish_variables
sudo apt install -y $(apt-cache search tesseract-ocr | awk '{print $1}')
sudo apt -y install ocrmypdf
sudo apt -y install python3-pip
sudo apt -y install jbig2enc
sudo apt -y install jbig2dec
sudo apt -y install imagemagick
sudo mkdir /usr/share/tesseract-ocr/5/tessdata
wget https://raw.githubusercontent.com/tesseract-ocr/tessdata/main/deu_frak.traineddata -O /usr/share/tesseract-ocr/5/tessdata/deu_frak.traineddata
sed -i 's/ZSH_THEME="mrtazz"/ZSH_THEME="agnoster"/' ~/.zshrc
wget https://dot.net/v1/dotnet-install.sh
chmod a+x dotnet-install.sh
./dotnet-install.sh
sudo chsh $USER -s $(which zsh)
sudo rm $(ls)
sudo tee /etc/timezone <<<Asia/Jerusalem
mkdir /home/saret/.ssh
git commit --global user.email "saretbenny@gmail.com"
git commit --global user.name "1kamma"
if [ "$HOST" = "libre-computer" ];
then
su -c 'wget -O - "https://connect.jfrog.io/install_connect" | sh -s VBr9r2byCYKNaE3rgZwYZANg8BueGk3HAQ Server'
curl -sSL "https://www.googleapis.com/drive/v3/files/12E1DAwQaQUT7lWOs1EhTD5Xk_sAnGqjo?alt=media&key=AIzaSyCy8ppkVWYQFSznbe1SHuAITSZ-ux_ZCZk" >/home/saret/.ssh/LibreGithub
tee /home/saret/.ssh/config <<EOF
Host GitHub
Hostname ssh.github.com
Port 443
User git
IdentityFile ~/.ssh/LibreGithub
Host gist
Hostname gist.github.com
User git
IdentityFile ~/.ssh/LibreGithub
EOF
sudo tee /etc/systemd/system/RunSSH.service <<EOF
[Unit]
Description=Run This SSH in ssh-j server
After=network.target
[Service]
Type=simple
Restart=always
RestartSec=3600
ExecStart=/Scripts/ssh.sh
User=saret
[Install]
WantedBy=multi-user.target
EOF
sudo chmod a+x /etc/systemd/system/RunSSH.service
sudo mkdir /Scripts
sudo tee /Scripts/ssh.sh <<EOF
if [[ "\$(ps -x |grep saret@ssh |awk '{print \$9}')" != *"libre-computer:22:localhost:22"* ]]; then
ssh saret@ssh-j.com -N -R libre-computer:22:localhost:22
fi
EOF
sudo chmod a+x /Scripts/ssh.sh
sudo tee /etc/systemd/system/GoogleDrive.service <<EOF
[Unit]
Description=Run Google drive folder, and mount it.
After=network.target
[Service]
Type=simple
ExecStart=google-drive-ocamlfuse ~/GoogleDrive/
User=saret
[Install]
WantedBy=multi-user.target
EOF
sudo chmod a+x /etc/systemd/system/GoogleDrive.service
sudo systemctl enable GoogleDrive
sudo systemctl enable RunSSH
cat <<EOF >> .zshrc
#My alias
alias fuck="sudo apt install -y"
alias go="sudo apt -y"
alias no="sudo -s"
alias dl="youtube-dl -f '(mp4,mkv)bestvideo[height>=720]+bestaudio/bestvideo[height>=720]' -o '%(title)s'"
alias DL="youtube-dl -f '(mp4,mkv)bestvideo[height>720]+bestaudio/bestvideo[height>720]' -o '%(title)s'"
export DOTNET_ROOT=\$HOME/.dotnet
export PATH=\$PATH:\$HOME/.dotnet
EOF
elif [ "$HOST" = "tritium-h5" ];
curl -sSL "https://www.googleapis.com/drive/v3/files/12E1DAwQaQUT7lWOs1EhTD5Xk_sAnGqjo?alt=media&key=AIzaSyCy8ppkVWYQFSznbe1SHuAITSZ-ux_ZCZk" >/home/saret/.ssh/LibreGithub
su -c 'wget -O - "https://connect.jfrog.io/install_connect" | sh -s VBr9r2byCYKNaE3rgZwYZANg8BueGk3HAQ Server'
tee /home/saret/.ssh/config <<EOF
Host GitHub
Hostname ssh.github.com
Port 443
User git
IdentityFile ~/.ssh/LibreGithub
Host gist
Hostname gist.github.com
User git
IdentityFile ~/.ssh/LibreGithub
EOF
sudo tee /etc/systemd/system/RunSSH.service <<EOF
[Unit]
Description=Run This SSH in ssh-j server
After=network.target
[Service]
Type=simple
Restart=always
RestartSec=3600
ExecStart=/Scripts/ssh.sh
User=saret
[Install]
WantedBy=multi-user.target
EOF
sudo chmod a+x /etc/systemd/system/RunSSH.service
sudo mkdir /Scripts
sudo tee /Scripts/ssh.sh <<EOF
if [[ "\$(ps -x |grep saret@ssh |awk '{print \$9}')" != *"libre-computer:22:localhost:22"* ]]; then
ssh saret@ssh-j.com -N -R libre-computer:22:localhost:22
fi
EOF
cat <<EOF >> .zshrc
#My alias
alias fuck="sudo apt install -y"
alias go="sudo apt -y"
alias no="sudo -s"
alias dl="youtube-dl -f '(mp4,mkv)bestvideo[height>=720]+bestaudio/bestvideo[height>=720]' -o '%(title)s'"
alias DL="youtube-dl -f '(mp4,mkv)bestvideo[height>720]+bestaudio/bestvideo[height>720]' -o '%(title)s'"
export DOTNET_ROOT=\$HOME/.dotnet
export PATH=\$PATH:\$HOME/.dotnet
EOF
sudo chmod a+x /Scripts/ssh.sh
sudo tee /etc/systemd/system/GoogleDrive.service <<EOF
[Unit]
Description=Run Google drive folder, and mount it.
After=network.target
[Service]
Type=simple
ExecStart=google-drive-ocamlfuse ~/GoogleDrive/
User=saret
[Install]
WantedBy=multi-user.target
EOF
sudo chmod a+x /etc/systemd/system/GoogleDrive.service
sudo systemctl enable GoogleDrive
sudo systemctl enable RunSSH
else
cat <<EOF >> .zshrc
#My alias
alias fuck="sudo apt install -y"
alias go="sudo apt -y"
alias no="sudo -s"
alias dl="youtube-dl -f '(mp4,mkv)bestvideo[height>=720]+bestaudio/bestvideo[height>=720]' -o '%(title)s'"
alias DL="youtube-dl -f '(mp4,mkv)bestvideo[height>720]+bestaudio/bestvideo[height>720]' -o '%(title)s'"
alias s!="ssh Libre -X"
export DOTNET_ROOT=\$HOME/.dotnet
export PATH=\$PATH:\$HOME/.dotnet
EOF
sudo sed -i '$a\'"\n\x64\x65\x62\x20\x68\x74\x74\x70\x73\x3a\x2f\x2f\x6e\x6f\x74\x65\x73\x61\x6c\x65\x78\x70\x2e\x6f\x72\x67\x2f\x64\x65\x62\x69\x61\x6e\x2f\x62\x75\x6c\x6c\x73\x65\x79\x65\x2f\x20\x62\x75\x6c\x6c\x73\x65\x79\x65\x20\x6d\x61\x69\x6e\x20\x63\x6f\x6e\x74\x72\x69\x62\x20\x6e\x6f\x6e\x2d\x66\x72\x65\x65\\n\x64\x65\x62\x2d\x73\x72\x63\x20\x68\x74\x74\x70\x73\x3a\x2f\x2f\x6e\x6f\x74\x65\x73\x61\x6c\x65\x78\x70\x2e\x6f\x72\x67\x2f\x64\x65\x62\x69\x61\x6e\x2f\x62\x75\x6c\x6c\x73\x65\x79\x65\x2f\x20\x62\x75\x6c\x6c\x73\x65\x79\x65\x20\x6d\x61\x69\x6e\x20\x63\x6f\x6e\x74\x72\x69\x62\x20\x6e\x6f\x6e\x2d\x66\x72\x65\x65" /etc/apt/sources.list
fi