Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux support #4

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
#!/bin/bash

OS=$(uname)
BACKUP_DIR="$(pwd)/backup"
SUBLIME_FILES="$(pwd)/sublime/User"
SUBLIME_DEST_DIR="${HOME}/Library/Application Support/Sublime Text 3/Packages/User"
if [[ $OS == 'Darwin']]; then
SUBLIME_DEST_DIR="${HOME}/Library/Application Support/Sublime Text 3/Packages/User"
elif [[ $OS == "Linux" ]]; then
SUBLIME_DEST_DIR="${HOME}/.config/sublime-text-3/Packages/User"
else
warn "OS not supported"
exit 1
fi

function warn() {
echo "$(tput bold)$(tput setaf 3) *** ${1}$(tput sgr0)"
Expand All @@ -11,8 +19,10 @@ function warn() {
function backup_sublime() {
[[ -d "$SUBLIME_DEST_DIR" && ! -L "$SUBLIME_DEST_DIR" ]] || return;
backup="${BACKUP_DIR}/sublime/User"
if [[ -d "$backup" ]]; then
if [[ -d $backup ]]; then
warn "$backup already exists"
elif [[ -L $backup ]]; then
warn "$backup is a symbolic link. I don't know what to do. Please remove it manually and re-run me"
else
cp -r "$SUBLIME_DEST_DIR" ${backup}
rm -rf "$SUBLIME_DEST_DIR"
Expand Down