Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1 from iceydee/master

Easy installation of settings
  • Loading branch information...
commit a27a8d01ad5d79f9576a88807877d4ca054f7296 2 parents 7fc7e93 + ab4b712
@alexfish alexfish authored
Showing with 100 additions and 0 deletions.
  1. +8 −0 README.md
  2. +24 −0 install.sh
  3. +68 −0 settings
View
8 README.md
@@ -1,6 +1,14 @@
settings
========
+# Easy installation
+
+Run this command in your terminal
+
+ curl -L https://raw.github.com/alexefish/settings/master/settings | bash
+
+## About
+
All of my system settings files in one convenient place
## Sublime Text 2
View
24 install.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+BASE_PATH="."
+if [ -n "${1}" ]; then
+ BASE_PATH=${1}
+fi
+
+echo -n "Installing Sublime Text 2: "
+mkdir -p "${HOME}/Library/Application Support/Sublime Text 2"
+cp -R "${BASE_PATH}/Sublime Text 2/" "${HOME}/Library/Application Support/Sublime Text 2/"
+echo "finished."
+
+echo -n "Installing bash prompt: "
+for FILE in `find ${BASE_PATH}/Prompt -type f`; do
+ mv ${FILE} "${HOME}/"
+done
+if [ ! -f "${HOME}/.bash_profile" ]; then
+ mv "${BASE_PATH}/.bash_profile" "${HOME}/"
+else
+ cat >> ${HOME}/.bash_profile << EOF
+. ~/.aliases
+EOF
+fi
+echo "finished."
View
68 settings
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+REPO="alexefish/settings"
+TMP_FILENAME="_settings.tar.gz"
+
+fetch_version()
+{
+ # Arg1: Version, ie. v1.0 -> will return v1.0.1 etc.
+
+ curl -s https://api.github.com/repos/${REPO}/tags |
+ sed -n '/"name": / {s/^.*".*": "\(.*\)".*$/\1/; p;}' |
+ sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n |
+ GREP_OPTIONS="" \grep "^${1:-}" | tail -n 1
+}
+
+archive_dir()
+{
+ # Arg1: tag name (version)
+ # Returns the name of the archive folder
+
+ typeset _version
+ _version=$1
+
+ local _archiveVersion=`echo ${_version} | sed 's/[^0-9\.]//g'`
+ local _repoName=`echo ${REPO} | cut -d'/' -f2`
+
+ echo "/tmp/${_repoName}-${_archiveVersion}"
+}
+
+download_archive()
+{
+ # Arg1: Tag name (version), ie. v0.0.1 etc.
+ typeset _version
+ _version=$1
+
+ local _url="https://github.com/${REPO}/archive/${_version}.tar.gz"
+
+ if curl -L ${_url} -o /tmp/${TMP_FILENAME}
+ then
+ true
+ else
+ echo "Could not download '${_url}'."
+ exit -1
+ fi
+}
+
+unpack_archive()
+{
+ # Arg1: Tag name (version), ie. v0.0.1 etc.
+ typeset _version
+ _version=$1
+
+ cd /tmp
+ tar zxf ${TMP_FILENAME}
+}
+
+VERSION=`fetch_version v0.0`
+download_archive ${VERSION}
+unpack_archive ${VERSION}
+
+# Run the install-script inside the archive
+cd `archive_dir ${VERSION}`
+./install.sh `archive_dir ${VERSION}`
+
+# Cleanup
+cd /tmp
+rm -f ${TMP_FILENAME}
+rm -rf `archive_dir ${VERSION}`
Please sign in to comment.
Something went wrong with that request. Please try again.