🔥 Remove Ubuntu-specific code.
This commit is contained in:
parent
606a42a5a9
commit
a2dac20a5f
4 changed files with 143 additions and 172 deletions
|
@ -12,6 +12,4 @@ npm_install "gulp CLI" gulp-cli
|
||||||
|
|
||||||
if [ "$(uname)" = Darwin ]
|
if [ "$(uname)" = Darwin ]
|
||||||
brew_install WebStorm webstorm --cask
|
brew_install WebStorm webstorm --cask
|
||||||
else if [ "$(uname)" = Linux ] && cmd_exists snap
|
|
||||||
execute "sudo snap install webstorm --classic" WebStorm
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -36,29 +36,4 @@ if [ "$(uname)" = Darwin ]
|
||||||
|
|
||||||
# Utilities.
|
# Utilities.
|
||||||
brew_install "The Unarchiver" the-unarchiver --cask
|
brew_install "The Unarchiver" the-unarchiver --cask
|
||||||
|
|
||||||
else if [ "$(uname)" = Linux ] && cmd_exists snap
|
|
||||||
# Networking.
|
|
||||||
if ! cmd_exists windscribe
|
|
||||||
execute "sudo wget https://github.com/Windscribe/Desktop-App/releases/download/v2.8.6/windscribe_2.8.6_amd64.deb -O /tmp/ws.deb \
|
|
||||||
&& sudo apt install /tmp/ws.deb" \
|
|
||||||
Windscribe
|
|
||||||
end
|
|
||||||
|
|
||||||
execute "sudo snap install firefox" Firefox
|
|
||||||
execute "sudo snap install qbittorrent-arnatious" qBittorrent
|
|
||||||
|
|
||||||
# Social.
|
|
||||||
execute "sudo snap install discord" Discord
|
|
||||||
# TODO: add check for already installed.
|
|
||||||
execute "sudo wget https://github.com/BetterDiscord/Installer/releases/latest/download/BetterDiscord-Linux.AppImage -O /tmp/bd.AppImage \
|
|
||||||
&& sudo chmod u+x /tmp/bd.AppImage \
|
|
||||||
&& /tmp/bd.AppImage" \
|
|
||||||
BetterDiscord
|
|
||||||
|
|
||||||
# Productivity.
|
|
||||||
execute "sudo snap install obsidian --classic" Obsidian
|
|
||||||
|
|
||||||
# Media.
|
|
||||||
execute "sudo snap install vlc" VLC
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,6 +13,4 @@ brew_install Meilisearch meilisearch "" "" true
|
||||||
if [ "$(uname)" = Darwin ]
|
if [ "$(uname)" = Darwin ]
|
||||||
brew_install "Laravel Herd" herd --cask
|
brew_install "Laravel Herd" herd --cask
|
||||||
brew_install PhpStorm phpstorm --cask
|
brew_install PhpStorm phpstorm --cask
|
||||||
else if [ "$(uname)" = Linux ] && cmd_exists snap
|
|
||||||
execute "sudo snap install phpstorm --classic" PhpStorm
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,108 +16,108 @@ yes_to_all=false
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
download() {
|
download() {
|
||||||
url="$1"
|
url="$1"
|
||||||
output="$2"
|
output="$2"
|
||||||
|
|
||||||
if command -v "curl" >/dev/null 2>&1; then
|
if command -v "curl" >/dev/null 2>&1; then
|
||||||
curl \
|
curl \
|
||||||
--location \
|
--location \
|
||||||
--silent \
|
--silent \
|
||||||
--show-error \
|
--show-error \
|
||||||
--output "$output" \
|
--output "$output" \
|
||||||
"$url" \
|
"$url" \
|
||||||
>/dev/null 2>&1
|
>/dev/null 2>&1
|
||||||
|
|
||||||
return $?
|
return $?
|
||||||
|
|
||||||
elif command -v "wget" >/dev/null 2>&1; then
|
elif command -v "wget" >/dev/null 2>&1; then
|
||||||
wget \
|
wget \
|
||||||
--quiet \
|
--quiet \
|
||||||
--output-document="$output" \
|
--output-document="$output" \
|
||||||
"$url" \
|
"$url" \
|
||||||
>/dev/null 2>&1
|
>/dev/null 2>&1
|
||||||
|
|
||||||
return $?
|
return $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
download_utils() {
|
download_utils() {
|
||||||
tmp_file="$(mktemp /tmp/XXXXX)"
|
tmp_file="$(mktemp /tmp/XXXXX)"
|
||||||
|
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
download "$DOTFILES_UTILS" "$tmp_file" &&
|
download "$DOTFILES_UTILS" "$tmp_file" &&
|
||||||
. "$tmp_file" &&
|
. "$tmp_file" &&
|
||||||
rm -rf "$tmp_file" &&
|
rm -rf "$tmp_file" &&
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
extract() {
|
extract() {
|
||||||
archive="$1"
|
archive="$1"
|
||||||
output_dir="$2"
|
output_dir="$2"
|
||||||
|
|
||||||
if command -v "tar" >/dev/null 2>&1; then
|
if command -v "tar" >/dev/null 2>&1; then
|
||||||
tar \
|
tar \
|
||||||
--extract \
|
--extract \
|
||||||
--gzip \
|
--gzip \
|
||||||
--file "$archive" \
|
--file "$archive" \
|
||||||
--strip-components 1 \
|
--strip-components 1 \
|
||||||
--directory "$output_dir"
|
--directory "$output_dir"
|
||||||
|
|
||||||
return $?
|
return $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
download_dotfiles() {
|
download_dotfiles() {
|
||||||
print_title "Download and extract dotfiles archive"
|
print_title "Download and extract dotfiles archive"
|
||||||
|
|
||||||
tmp_file="$(mktemp /tmp/XXXXX)"
|
tmp_file="$(mktemp /tmp/XXXXX)"
|
||||||
|
|
||||||
download "$DOTFILES_TARBALL" "$tmp_file"
|
download "$DOTFILES_TARBALL" "$tmp_file"
|
||||||
print_result $? "Download archive" "true"
|
print_result $? "Download archive" "true"
|
||||||
printf "\n"
|
printf "\n"
|
||||||
|
|
||||||
if ! $yes_to_all; then
|
if ! $yes_to_all; then
|
||||||
|
|
||||||
while [ -e "$DOT" ]; do
|
while [ -e "$DOT" ]; do
|
||||||
ask "'$DOT' already exists, do you want to (o)verwrite or (b)ackup the existing directory?"
|
ask "'$DOT' already exists, do you want to (o)verwrite or (b)ackup the existing directory?"
|
||||||
answer="$(get_answer)"
|
answer="$(get_answer)"
|
||||||
|
|
||||||
case $answer in
|
case $answer in
|
||||||
o)
|
o)
|
||||||
rm -rf "$DOT"
|
rm -rf "$DOT"
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
b)
|
b)
|
||||||
mv "$DOT" "$DOT.bak"
|
mv "$DOT" "$DOT.bak"
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
*) print_warning "Please enter a valid option." ;;
|
*) print_warning "Please enter a valid option." ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
else
|
else
|
||||||
rm -rf "$DOT" >/dev/null 2>&1
|
rm -rf "$DOT" >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p "$DOT"
|
mkdir -p "$DOT"
|
||||||
print_result $? "Create '$DOT'" "true"
|
print_result $? "Create '$DOT'" "true"
|
||||||
|
|
||||||
# Extract archive.
|
# Extract archive.
|
||||||
extract "$tmp_file" "$DOT"
|
extract "$tmp_file" "$DOT"
|
||||||
print_result $? "Extract archive" "true"
|
print_result $? "Extract archive" "true"
|
||||||
|
|
||||||
rm -rf "$tmp_file"
|
rm -rf "$tmp_file"
|
||||||
print_result $? "Remove archive"
|
print_result $? "Remove archive"
|
||||||
|
|
||||||
cd "$DOT/script" ||
|
cd "$DOT/script" ||
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -125,23 +125,23 @@ download_dotfiles() {
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
are_xcode_cli_tools_installed() {
|
are_xcode_cli_tools_installed() {
|
||||||
xcode-select --print-path >/dev/null 2>&1
|
xcode-select --print-path >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
install_xcode_cli_toools() {
|
install_xcode_cli_toools() {
|
||||||
if [ "$(uname)" = "Darwin" ]; then
|
if [ "$(uname)" = "Darwin" ]; then
|
||||||
|
|
||||||
print_title "Xcode"
|
print_title "Xcode"
|
||||||
|
|
||||||
xcode-select --install >/dev/null 2>&1
|
xcode-select --install >/dev/null 2>&1
|
||||||
|
|
||||||
execute \
|
execute \
|
||||||
"until are_xcode_cli_tools_installed; do sleep 5; done" \
|
"until are_xcode_cli_tools_installed; do sleep 5; done" \
|
||||||
"Install Xcode Command Line Tools"
|
"Install Xcode Command Line Tools"
|
||||||
|
|
||||||
sudo xcodebuild -license accept >/dev/null 2>&1
|
sudo xcodebuild -license accept >/dev/null 2>&1
|
||||||
print_result $? "Agree to the terms of the Xcode license"
|
print_result $? "Agree to the terms of the Xcode license"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -149,30 +149,30 @@ install_xcode_cli_toools() {
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
setup_gitconfig() {
|
setup_gitconfig() {
|
||||||
cd "$DOT" || return
|
cd "$DOT" || return
|
||||||
|
|
||||||
if ! [ -f "$DOT/git/.gitconfig.local.symlink" ]; then
|
if ! [ -f "$DOT/git/.gitconfig.local.symlink" ]; then
|
||||||
print_title "Set up gitconfig"
|
print_title "Set up gitconfig"
|
||||||
|
|
||||||
git_credential="cache"
|
git_credential="cache"
|
||||||
|
|
||||||
if [ "$(uname)" = "Darwin" ]; then
|
if [ "$(uname)" = "Darwin" ]; then
|
||||||
git_credential="osxkeychain"
|
git_credential="osxkeychain"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
print_question "What is your Github author name?"
|
print_question "What is your Github author name?"
|
||||||
read -r git_authorname
|
read -r git_authorname
|
||||||
|
|
||||||
print_question "What is your Github author email?"
|
print_question "What is your Github author email?"
|
||||||
read -r git_authoremail
|
read -r git_authoremail
|
||||||
|
|
||||||
sed -e "s/AUTHORNAME/$git_authorname/g" \
|
sed -e "s/AUTHORNAME/$git_authorname/g" \
|
||||||
-e "s/AUTHOREMAIL/$git_authoremail/g" \
|
-e "s/AUTHOREMAIL/$git_authoremail/g" \
|
||||||
-e "s/GIT_CREDENTIAL_HELPER/$git_credential/g" \
|
-e "s/GIT_CREDENTIAL_HELPER/$git_credential/g" \
|
||||||
"$DOT/git/.gitconfig.local.symlink.example" >"$DOT/.gitconfig.local.symlink"
|
"$DOT/git/.gitconfig.local.symlink.example" >"$DOT/.gitconfig.local.symlink"
|
||||||
|
|
||||||
print_result $? "gitconfig"
|
print_result $? "gitconfig"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -180,20 +180,20 @@ setup_gitconfig() {
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
git_init() {
|
git_init() {
|
||||||
print_title "Initialize Git repository"
|
print_title "Initialize Git repository"
|
||||||
|
|
||||||
if [ -z "$DOTFILES_ORIGIN" ]; then
|
if [ -z "$DOTFILES_ORIGIN" ]; then
|
||||||
print_error "Please provide a URL for the Git origin"
|
print_error "Please provide a URL for the Git origin"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! is_git_repository; then
|
if ! is_git_repository; then
|
||||||
cd "$DOT" || print_error "Failed to cd $DOT"
|
cd "$DOT" || print_error "Failed to cd $DOT"
|
||||||
|
|
||||||
execute \
|
execute \
|
||||||
"git init && git remote add origin $DOTFILES_ORIGIN" \
|
"git init && git remote add origin $DOTFILES_ORIGIN" \
|
||||||
"Initialize the dotfiles Git repository"
|
"Initialize the dotfiles Git repository"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -201,57 +201,57 @@ git_init() {
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
if [ "$(uname)" != "Linux" ] && [ "$(uname)" != "Darwin" ]; then
|
if [ "$(uname)" != "Linux" ] && [ "$(uname)" != "Darwin" ]; then
|
||||||
printf "Sorry, this script is intended only for macOS and Ubuntu!"
|
printf "Sorry, this script is intended only for macOS and Linux!"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Load utils.
|
# Load utils.
|
||||||
|
|
||||||
if [ -x "${DOT}/script/utils.sh" ]; then
|
if [ -x "${DOT}/script/utils.sh" ]; then
|
||||||
. "${DOT}/script/utils.sh" || exit 1
|
. "${DOT}/script/utils.sh" || exit 1
|
||||||
else
|
else
|
||||||
download_utils || exit 1
|
download_utils || exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
skip_questions "$@" &&
|
skip_questions "$@" &&
|
||||||
yes_to_all=true
|
yes_to_all=true
|
||||||
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
ask_for_sudo
|
ask_for_sudo
|
||||||
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
# Check if this script was run directly, and if not, dotfiles will need to be
|
# Check if this script was run directly, and if not, dotfiles will need to be
|
||||||
# downloaded.
|
# downloaded.
|
||||||
|
|
||||||
printf "%s" "$(sh_source "$0")" | grep "bootstrap.sh" >/dev/null 2>&1 ||
|
printf "%s" "$(sh_source "$0")" | grep "bootstrap.sh" >/dev/null 2>&1 ||
|
||||||
download_dotfiles
|
download_dotfiles
|
||||||
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
setup_gitconfig
|
setup_gitconfig
|
||||||
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
install_xcode_cli_toools
|
install_xcode_cli_toools
|
||||||
|
|
||||||
"$DOT/homebrew/brew.sh"
|
"$DOT/homebrew/brew.sh"
|
||||||
|
|
||||||
"$DOT/git/git.sh"
|
"$DOT/git/git.sh"
|
||||||
|
|
||||||
"$DOT/fish/fish.sh"
|
"$DOT/fish/fish.sh"
|
||||||
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
if cmd_exists "git"; then
|
if cmd_exists "git"; then
|
||||||
if [ "$(git config --get remote.origin.url)" != "$DOTFILES_ORIGIN" ]; then
|
if [ "$(git config --get remote.origin.url)" != "$DOTFILES_ORIGIN" ]; then
|
||||||
git_init
|
git_init
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
|
|
Loading…
Reference in a new issue