2022-11-22 18:40:45 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2022-11-22 23:07:07 +00:00
|
|
|
# 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
|
|
|
|
|
|
|
|
|
2022-11-22 22:42:07 +00:00
|
|
|
# 'system migration' script designed to be ran once an os installed.
|
2022-11-22 18:40:45 +00:00
|
|
|
|
|
|
|
# set some variables
|
|
|
|
|
|
|
|
hostname=$HOSTNAME
|
|
|
|
echo $hostname
|
|
|
|
|
|
|
|
os=$(lsb_release -d| awk '{print $2}') # definitely works on Fedora
|
|
|
|
echo $os
|
|
|
|
|
2022-11-22 18:48:48 +00:00
|
|
|
|
2022-11-22 18:40:45 +00:00
|
|
|
# ensure some directories exist
|
2022-11-22 21:58:58 +00:00
|
|
|
gitDir="~/git"
|
2022-11-22 18:40:45 +00:00
|
|
|
[ ! -d $gitDir ] && mkdir -p $gitDir || echo $gitDir" already exists"
|
|
|
|
|
2022-11-22 21:58:58 +00:00
|
|
|
sshDir="~/.ssh"
|
2022-11-22 18:40:45 +00:00
|
|
|
[ ! -d $sshDir ] && mkdir -p $sshDir || echo $sshDir" already exists"
|
|
|
|
|
2022-11-22 21:58:58 +00:00
|
|
|
configDir="~/.config"
|
2022-11-22 18:40:45 +00:00
|
|
|
[ ! -d $configDir ] && mkdir -p $configDir || echo $configDir" already exists"
|
|
|
|
|
2022-11-22 22:42:07 +00:00
|
|
|
userBinDir="~/bin"
|
|
|
|
[ ! -d $userBinDir ] && mkdir -p $userBinDir || echo $userBindir" already exists"
|
|
|
|
|
2022-11-22 18:40:45 +00:00
|
|
|
|
|
|
|
# create an ssh key, for use with git/github
|
2022-11-22 18:48:48 +00:00
|
|
|
ssh-keygen -t ed25519 -f $sshDir"/id_ed25519_git" -N ''
|
2022-11-22 19:01:23 +00:00
|
|
|
|
2022-11-23 09:08:04 +00:00
|
|
|
setup_config()
|
|
|
|
{
|
2022-11-22 19:01:23 +00:00
|
|
|
|
2022-11-23 09:08:04 +00:00
|
|
|
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
|
|
|
|
}
|
2022-11-22 19:01:23 +00:00
|
|
|
# check package manager
|
|
|
|
if [[ $os == "Ubuntu" ]]; then
|
2022-11-22 21:04:21 +00:00
|
|
|
echo "using apt package manager";
|
2022-11-22 19:37:11 +00:00
|
|
|
sudo apt-get update && sudo apt-get upgrade;
|
|
|
|
sudo apt install -y `cat apt-packages`;
|
2022-11-22 22:45:57 +00:00
|
|
|
cat snap-packages| xargs -n 1 sudo snap install --classic;
|
2022-11-22 19:18:50 +00:00
|
|
|
wget https://dl.discordapp.net/apps/linux/0.0.21/discord-0.0.21.deb;
|
2022-11-22 21:05:05 +00:00
|
|
|
sudo apt install ./discord-0.0.21.deb;
|
2022-11-23 00:24:57 +00:00
|
|
|
setup_config $os;
|
2022-11-22 19:24:56 +00:00
|
|
|
elif [[ $os == "Fedora" ]]; then
|
2022-11-22 21:04:21 +00:00
|
|
|
echo "dnf is not yet supported";
|
2022-11-23 00:24:57 +00:00
|
|
|
setup_config $os;
|
2022-11-23 00:08:11 +00:00
|
|
|
elif [[ $os == "Arch" ]]; then
|
|
|
|
echo "pacman is not yet supported";
|
2022-11-23 00:24:57 +00:00
|
|
|
setup_config $os;
|
2022-11-22 19:01:23 +00:00
|
|
|
else
|
2022-11-23 00:24:57 +00:00
|
|
|
echo "OS package manager is not yet supported";
|
|
|
|
|
2022-11-22 19:01:23 +00:00
|
|
|
fi
|
2022-11-22 20:59:06 +00:00
|
|
|
|
2022-11-22 22:45:57 +00:00
|
|
|
cd $gitdir;
|
2022-11-23 09:21:57 +00:00
|
|
|
pwd
|
2022-11-22 22:45:57 +00:00
|
|
|
gh auth login;
|
2022-11-22 20:59:06 +00:00
|
|
|
# after logged into gh
|
2022-11-23 00:00:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
#TODO: do gpg stuff toO
|
|
|
|
|
2022-11-23 09:02:00 +00:00
|
|
|
# gpg --export --armor KEY > pubkey.asc && gpg --export-secret-keys --armor KEY > privatekey.asc
|
|
|
|
# scp them to machine ~/keys
|
|
|
|
|
2022-11-23 09:21:57 +00:00
|
|
|
[ ! -d ~/keys ] && echo "No keys found" || gpg --import keys/*
|
2022-11-23 09:02:00 +00:00
|
|
|
|
2022-11-22 22:45:57 +00:00
|
|
|
gh repo list --limit 100 |awk '{print $1}' | xargs -L1 gh repo clone;
|