86 lines
2.6 KiB
Bash
Executable File
86 lines
2.6 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
|
|
gitDir="~/git"
|
|
[ ! -d $gitDir ] && mkdir -p $gitDir || echo $gitDir" already exists"
|
|
|
|
sshDir="~/.ssh"
|
|
[ ! -d $sshDir ] && mkdir -p $sshDir || echo $sshDir" already exists"
|
|
|
|
configDir="~/.config"
|
|
[ ! -d $configDir ] && mkdir -p $configDir || echo $configDir" already exists"
|
|
|
|
userBinDir="~/bin"
|
|
[ ! -d $userBinDir ] && mkdir -p $userBinDir || echo $userBindir" already exists"
|
|
|
|
|
|
# create an ssh key, for use with git/github
|
|
ssh-keygen -t ed25519 -f $sshDir"/id_ed25519_git" -N ''
|
|
|
|
setup_config()
|
|
{
|
|
|
|
git clone https://github.com/crimsontome/config;
|
|
cp -f config/bin/* $userBinDir;
|
|
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 $sshDir/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_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 $gitdir;
|
|
gh auth login;
|
|
# 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/*; echo "GPG keys imported"
|
|
|
|
gh repo list --limit 100 |awk '{print $1}' | xargs -L1 gh repo clone;
|