Add some early bails for non-standard devices

This commit is contained in:
Sage Vaillancourt 2024-02-26 00:21:53 -05:00
parent 6eac61d6bd
commit f09a1ae032
2 changed files with 38 additions and 24 deletions

24
copy.sh
View File

@ -11,7 +11,9 @@ if ! command -v wget &> /dev/null; then
exit 1 exit 1
fi fi
if ! command -v sofi &> /dev/null && ! test -f /usr/bin/sofi; then mkdir -p "$HOME/.tmp" || exit 1
if command -v sudo &> /dev/null && ! command -v sofi &> /dev/null && ! test -f /usr/bin/sofi; then
echo -e '#!/bin/bash\n$HOME/.sofi.sh --launch' | sudo tee /usr/bin/sofi echo -e '#!/bin/bash\n$HOME/.sofi.sh --launch' | sudo tee /usr/bin/sofi
sudo chmod +x /usr/bin/sofi sudo chmod +x /usr/bin/sofi
fi fi
@ -85,12 +87,12 @@ if ! test -d "$HOME/.nvm"; then
nvm use node nvm use node
fi fi
if ! command -v dotnet &> /dev/null; then if command -v sudo &> /dev/null && ! command -v dotnet &> /dev/null; then
echo "dotnet is not installed. Installing..." echo "dotnet is not installed. Installing..."
wget https://dot.net/v1/dotnet-install.sh -O /tmp/dotnet-install.sh wget https://dot.net/v1/dotnet-install.sh -O $HOME/.tmp/dotnet-install.sh
chmod +x /tmp/dotnet-install.sh chmod +x $HOME/.tmp/dotnet-install.sh
/tmp/dotnet-install.sh --version latest $HOME/.tmp/dotnet-install.sh --version latest
rm /tmp/dotnet-install.sh rm $HOME/.tmp/dotnet-install.sh
fi fi
if ! command -v starship &> /dev/null; then if ! command -v starship &> /dev/null; then
@ -101,8 +103,8 @@ fi
if ! test -d $HOME/.config/JetBrains/; then if ! test -d $HOME/.config/JetBrains/; then
echo "JetBrains toolbox is not installed. Installing..." echo "JetBrains toolbox is not installed. Installing..."
ARCHIVE_URL="$(curl -s 'https://data.services.jetbrains.com/products/releases?code=TBA&latest=true&type=release' | grep -Po '"linux":.*?[^\\]",' | awk -F ':' '{print $3,":"$4}'| sed 's/[", ]//g')" ARCHIVE_URL="$(curl -s 'https://data.services.jetbrains.com/products/releases?code=TBA&latest=true&type=release' | grep -Po '"linux":.*?[^\\]",' | awk -F ':' '{print $3,":"$4}'| sed 's/[", ]//g')"
wget -q --show-progress -cO "/tmp/jetbrains-toolbox-latest.tar.gz" "$ARCHIVE_URL" wget -q --show-progress -cO "$HOME/.tmp/jetbrains-toolbox-latest.tar.gz" "$ARCHIVE_URL"
cd /tmp/ cd $HOME/.tmp/
tar -xvf jetbrains-toolbox-latest.tar.gz --strip-components=1 tar -xvf jetbrains-toolbox-latest.tar.gz --strip-components=1
chmod +x jetbrains-toolbox chmod +x jetbrains-toolbox
./jetbrains-toolbox ./jetbrains-toolbox
@ -111,9 +113,9 @@ fi
mkdir -p "$HOME/.local/share/fonts" mkdir -p "$HOME/.local/share/fonts"
if ! test -f "$HOME/.local/share/fonts/FiraCodeNerdFontMono-Medium.ttf"; then if ! test -f "$HOME/.local/share/fonts/FiraCodeNerdFontMono-Medium.ttf"; then
echo "FiraCode is not installed. Installing..." echo "FiraCode is not installed. Installing..."
wget -O /tmp/firacode.zip "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.1/FiraCode.zip" wget -O $HOME/.tmp/firacode.zip "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.1/FiraCode.zip"
unzip -d "$HOME/.local/share/fonts" /tmp/firacode.zip unzip -d "$HOME/.local/share/fonts" $HOME/.tmp/firacode.zip
rm /tmp/firacode.zip rm $HOME/.tmp/firacode.zip
fc-cache -f -v fc-cache -f -v
fi fi

View File

@ -105,6 +105,10 @@ function dconf-dump {
} }
function push-dconf { function push-dconf {
if ! command -v dconf &> /dev/null; then
echo "The current system does not include dconf"
return
fi
if ! command -v scpace &> /dev/null; then if ! command -v scpace &> /dev/null; then
echo "An alias for scpace has not been defined on this device!" echo "An alias for scpace has not been defined on this device!"
return 1 return 1
@ -180,6 +184,26 @@ function pushdot {
return $res return $res
} }
function sync-dconf {
if ! command -v dconf &> /dev/null; then
echo "System does not use dconf"
return
fi
rm /tmp/dconf-dump &> /dev/null
scp -P 11275 'sage@sagev.space:~/dconf-dump' /tmp/dconf-dump
dconf-dump > /tmp/current-dconf-dump
if ! git --no-pager diff --no-index /tmp/current-dconf-dump /tmp/dconf-dump &> /dev/null; then
echo
echo "Incoming conf changes:"
echo
git --no-pager diff --no-index /tmp/current-dconf-dump /tmp/dconf-dump
echo
bash -c 'read -p "Press enter to continue, or Ctrl-C to cancel."' || return 1
echo "Applying changes..."
fi
dconf load / < /tmp/dconf-dump || return 1
}
function getdot { function getdot {
if ! command -v scpace &> /dev/null; then if ! command -v scpace &> /dev/null; then
echo "An alias for scpace has not been defined on this device!" echo "An alias for scpace has not been defined on this device!"
@ -194,20 +218,8 @@ function getdot {
load-extensions load-extensions
sync-history sync-history
sync-dconf
rm /tmp/dconf-dump &> /dev/null
scp -P 11275 'sage@sagev.space:~/dconf-dump' /tmp/dconf-dump
dconf-dump > /tmp/current-dconf-dump
if ! git --no-pager diff --no-index /tmp/current-dconf-dump /tmp/dconf-dump &> /dev/null; then
echo
echo "Incoming conf changes:"
echo
git --no-pager diff --no-index /tmp/current-dconf-dump /tmp/dconf-dump
echo
bash -c 'read -p "Press enter to continue, or Ctrl-C to cancel."' || return 1
echo "Applying changes..."
fi
dconf load / < /tmp/dconf-dump || return 1
cd - > /dev/null cd - > /dev/null
} }