migrate/post-install

49 lines
1.2 KiB
Plaintext
Raw Normal View History

2022-11-22 18:40:45 +00:00
#!/usr/bin/env bash
# set some variables
homeDir=$HOME
echo $homeDir
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
gitDir=$homeDir"/git"
[ ! -d $gitDir ] && mkdir -p $gitDir || echo $gitDir" already exists"
sshDir=$homeDir"/.ssh"
[ ! -d $sshDir ] && mkdir -p $sshDir || echo $sshDir" already exists"
configDir=$homeDir"/.config"
[ ! -d $configDir ] && mkdir -p $configDir || echo $configDir" already exists"
# 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
# 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 21:18:39 +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-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-22 19:01:23 +00:00
else
2022-11-22 21:04:21 +00:00
echo "OS not yet supported";
2022-11-22 19:01:23 +00:00
fi
2022-11-22 20:59:06 +00:00
cd $gitdir
gh auth login
# after logged into gh
2022-11-22 21:04:21 +00:00
gh repo list --limit 100 |awk '{print $1}' | xargs -L1 gh repo clone