106 lines
3.1 KiB
Bash
Executable File
106 lines
3.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# TODO fix so it loops through all pages, as it just grabs the first currently
|
|
# curl -s https://github.com/stars/CrimsonTome/lists/my-stack | docker run -i jezzay/html-xml-utils hxnormalize -x |docker run -i jezzay/html-xml-utils hxselect -c '#user-list-repositories > div > div > h3' | sed -n 's/.*href="\([^"]*\).*/\1/p' | awk '{print "https://github.com"$0}'|xargs -L1 git clone
|
|
|
|
|
|
# 'system migration' script designed to be ran once an os installed.
|
|
|
|
# set some variables
|
|
|
|
hostname=$HOSTNAME
|
|
echo $hostname
|
|
|
|
os=$(lsb_release -d| awk '{print $2}') # definitely works on Fedora
|
|
echo $os
|
|
|
|
|
|
# ensure some directories exist
|
|
mkdir -p ~/git/
|
|
mkdir -p ~/.ssh/
|
|
mkdir -p ~/.config/
|
|
mkdir -p ~/bin/
|
|
|
|
# create an ssh key, for use with git/github
|
|
ssh-keygen -t ed25519 -N ''
|
|
setup_config()
|
|
{
|
|
cd ~
|
|
git clone https://github.com/crimsontome/config;
|
|
cp -f config/bin/* ~/bin;
|
|
if [[ $os == "Ubuntu" ]]; then
|
|
cp -f config/ub-server/.bashrc ~/;
|
|
elif [[ $os == "Fedora" ]]; then
|
|
cp -f config/fedora/.bashrc ~/;
|
|
elif [[ $os == "Arch" ]]; then
|
|
cp -f config/arch/.bashrc ~/;
|
|
else
|
|
echo "OS specific bashrc not yet supported";
|
|
exit;
|
|
fi
|
|
cp -f config/.gitconfig ~/;
|
|
cp -f config/.ssh/config .ssh/config
|
|
}
|
|
# check package manager
|
|
if [[ $os == "Ubuntu" ]]; then
|
|
echo "using apt package manager";
|
|
sudo apt-get update && sudo apt-get upgrade;
|
|
sudo apt install -y `cat apt-packages`;
|
|
cat snap-packages| xargs -n 1 sudo snap install --classic;
|
|
wget https://dl.discordapp.net/apps/linux/0.0.21/discord-0.0.21.deb;
|
|
sudo apt install ./discord-0.0.21.deb;
|
|
|
|
#setup uni vpn
|
|
|
|
sudo apt install openconnect python3-pip python3-gi gir1.2-gtk-3.0 gir1.2-webkit2-4.0
|
|
pip3 install https://github.com/dlenski/gp-saml-gui/archive/master.zip
|
|
|
|
echo "$USER ALL=(root) NOPASSWD:SETENV: /usr/sbin/openconnect, /etc/vpnc/vpnc-script" | sudo tee /etc/sudoers.d/hullvpn
|
|
sudo chmod 0440 /etc/sudoers.d/hullvpn
|
|
|
|
echo "openssl_conf = openssl_init
|
|
[openssl_init]
|
|
ssl_conf = ssl_sect
|
|
[ssl_sect]
|
|
system_default = system_default_sect
|
|
[system_default_sect]
|
|
Options = UnsafeLegacyRenegotiation" > ~/.hullvpn-ssl.cnf
|
|
|
|
echo "[Desktop Entry]
|
|
Name=University of Hull VPN
|
|
Comment=Connect to the University of Hull's VPN.
|
|
Exec=hullvpn
|
|
Terminal=false
|
|
Type=Application" > ~/.config/autostart/hullvpn.desktop
|
|
|
|
|
|
setup_config $os;
|
|
elif [[ $os == "Fedora" ]]; then
|
|
echo "dnf is not yet supported";
|
|
setup_config $os;
|
|
elif [[ $os == "Arch" ]]; then
|
|
echo "pacman is not yet supported";
|
|
setup_config $os;
|
|
else
|
|
echo "OS package manager is not yet supported";
|
|
|
|
fi
|
|
|
|
cd ~/git/;
|
|
pwd
|
|
gh auth login;
|
|
xclip -sel clip ~/.ssh/id_ed25519.pub
|
|
firefox https://github.com/settings/ssh/new
|
|
|
|
# after logged into gh
|
|
|
|
|
|
#TODO: do gpg stuff toO
|
|
|
|
# gpg --export --armor KEY > pubkey.asc && gpg --export-secret-keys --armor KEY > privatekey.asc
|
|
# scp them to machine ~/keys
|
|
|
|
[ ! -d ~/keys ] && echo "No keys found" || gpg --import keys/*
|
|
|
|
gh repo list --limit 100 |awk '{print $1}' | xargs -L1 gh repo clone;
|