Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • keegoid/quick-config
1 result
Show changes
Commits on Source (27)
# Quick Config
 
Quickly configures a fresh install of [Ubuntu 16.04.1 LTS 64-bit][xx] on a workstation.
Quickly configures a fresh install of [Ubuntu 17.04 64-bit][zz] on a workstation.
 
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
 
- [What it can do](#what-it-can-do)
- [What qc can do](#what-qc-can-do)
- [Installation](#installation)
- [Usage](#usage)
- [Clone or download this project](#clone-or-download-this-project)
- [Run it](#run-it)
- [SSH Keys](#ssh-keys)
- [License](#license)
 
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
 
## What qc can do
 
- update [Ubuntu][ubuntu] and install some programs using apt-get, gem, npm and pip
- update [Ubuntu][ubuntu] and install some useful packages
- setup standard developement environment utilizing package managers: [rbenv][rbenv], [nvm][nvm], [virtualenv][venv]
- install gem, npm, and pip packages using appropriate package managers
- generate an [RSA key][sshkey] for remote [SSH sessions][ssh]
- add useful [shell aliases][sa]
- make the [terminal][gt] easier to read and use with:
- colored prompts
- dark profile
- colored prompt string (PS1)
- [autojump][aj]
- [incremental history searching][ihs]
- add [blackboard][bb] and [solarized][gsolar] color schemes to [gedit][gedit]
- add [solarized][msolar] color scheme to [Mutt][mutt]
- configure [tmux][tmux]
- install and configure [vim-gtk][vim]
- install and configure [Sublime Text][subl], it really is sublime for coding
- install and configure [Sublime Text 3][subl]
- install [Keybase][keyb]
- configure [git][git] global settings
- install the latest [VirtualBox][vb] and [Vagrant][vg]
- install [LXD][lxd], use it to download an [Ubuntu][xx] cloud image and create an [LXC][lxc] container
- install [ZFS][zfs] for use with [LXD][lxd]
- install [Juju][juju]
- fix ownership issues in Home directory (warning: dangerous command, run at your own risk)
 
## Installation
 
Loading
Loading
@@ -55,28 +49,21 @@ SEE: http://keegoid.mit-license.org
 
 
[ubuntu]: http://www.ubuntu.com/global
[xx]: https://wiki.ubuntu.com/XenialXerus/ReleaseNotes
[lxd]: https://linuxcontainers.org/lxd/introduction/
[lxc]: https://linuxcontainers.org/lxc/introduction/
[zfs]: https://wiki.ubuntu.com/ZFS
[juju]: http://www.ubuntu.com/cloud/juju
[gedit]: https://wiki.gnome.org/Apps/Gedit
[zz]: https://wiki.ubuntu.com/ZestyZapus/ReleaseNotes
[subl]: https://www.sublimetext.com/
[vim]: http://www.vim.org/
[gt]: http://manpages.ubuntu.com/manpages/hardy/man1/gnome-terminal.1.html
[ihs]: https://help.ubuntu.com/community/UsingTheTerminal#An_extremely_handy_tool_::_Incremental_history_searching
[tsolar]: https://github.com/Anthony25/gnome-terminal-colors-solarized
[gsolar]: https://github.com/mattcan/solarized-gedit
[msolar]: https://github.com/altercation/mutt-colors-solarized
[bb]: https://github.com/afair/dot-gedit
[tmux]: https://tmux.github.io/
[mutt]: http://www.mutt.org/
[vb]: https://www.virtualbox.org/
[vg]: https://www.vagrantup.com/
[keyb]: https://keybase.io/
[aj]: https://github.com/wting/autojump
[ssh]: http://en.wikipedia.org/wiki/Secure_Shell
[sshkey]: http://en.wikipedia.org/wiki/Ssh-keygen
[sa]: http://en.wikipedia.org/wiki/Alias_%28command%29
[gh]: https://github.com/
[git]: https://git-scm.com/
[lp]: https://lastpass.com/f?3202156
[rbenv]: https://github.com/rbenv/rbenv
[nvm]: https://github.com/creationix/nvm
[venv]: https://github.com/pypa/virtualenv
Loading
Loading
@@ -19,6 +19,7 @@
 
# note: true=0 and false=1 in bash
 
# shellcheck source=/dev/null
source colors.sh
 
# -------------------------- STRING MANIPULATION
Loading
Loading
@@ -175,7 +176,7 @@ lkm_pause() {
[ -z "${prompt}" ] && prompt="Press [Enter] key to continue"
# how to go back, with either default or user message
[ "$back" = true ] && prompt="${prompt}, [Ctrl+Z] to go back"
read -p "$prompt..."
read -rp "$prompt..."
}
 
lkm_confirm() {
Loading
Loading
@@ -381,7 +382,7 @@ lkm_install_gem() {
for pkg in $names; do
if ! gem list "$pkg" -i >/dev/null 2>&1; then
echo
read -p "Press [Enter] to install $pkg..."
read -rp "Press [Enter] to install $pkg..."
gem install "$pkg"
fi
done
Loading
Loading
@@ -399,7 +400,7 @@ lkm_install_npm() {
for pkg in $names; do
if ! npm ls -gs | grep -qw "$pkg"; then
echo
read -p "Press [Enter] to install $pkg..."
read -rp "Press [Enter] to install $pkg..."
npm install -g "$pkg"
fi
done
Loading
Loading
@@ -419,7 +420,7 @@ lkm_install_pip() {
pkg=$(lkm_trim_longest_right_pattern "$pkg" "[")
if ! pip list | grep "$pkg" >/dev/null 2>&1; then
echo
read -p "Press [Enter] to install $pkg..."
read -rp "Press [Enter] to install $pkg..."
sudo -H pip install "$pkg"
fi
done
Loading
Loading
@@ -443,7 +444,7 @@ lkm_gen_ssh_key() {
else
# create a new ssh key with provided ssh key comment
lkm_pause "Press [Enter] to generate a new SSH key at: ${ssh_dir}/id_rsa" true
read -ep "Enter an ssh key comment: " -i 'coding key' comment
read -rep "Enter an ssh key comment: " -i 'coding key' comment
ssh-keygen -b 4096 -t rsa -C "$comment"
echo "SSH key generated"
chmod -c 0600 "${ssh_dir}/id_rsa"
Loading
Loading
@@ -501,7 +502,7 @@ lkm_authorized_ssh_key() {
echo "*** NOTE ***"
echo "Paste (using ctrl+shift+v) your public ssh-rsa key from your workstation"
echo "to SSH into this server."
read -ep "Paste it here: " ssh_rsa
read -rep "Paste it here: " ssh_rsa
echo "${ssh_rsa}" > "${ssh_dir}/authorized_keys"
echo "public SSH key saved to ${ssh_dir}/authorized_keys"
chmod -c 0600 "${ssh_dir}/authorized_keys"
Loading
Loading
Loading
Loading
@@ -4,7 +4,7 @@
 
echo "# --------------------------------------------"
echo "# Quickly configures a fresh install of "
echo "# Ubuntu 16.04 64-bit. "
echo "# Ubuntu 17.04 64-bit. "
echo "# "
echo "# Author : Keegan Mullaney "
echo "# Website: keegoid.com "
Loading
Loading
@@ -27,10 +27,6 @@ QC_DEBUG_MODE=0
# make sure $HOME variable is set
lkm_variable_set "$HOME"
 
# config for server
lkm_confirm "Is this a server?"
QC_IS_SERVER="$?"
# make sure curl and git are installed
lkm_program_must_exist curl
lkm_program_must_exist git
Loading
Loading
@@ -40,6 +36,7 @@ lkm_program_must_exist git
# if any files in home are not owned by home user, fix that
qc_fix_permissions() {
# set ownership
lkm_notify2 "Warning: The following is a dangerous command, run at your own risk."
lkm_pause "Press [Enter] to make sure all files in $HOME are owned by $(whoami)" true
sudo chown --preserve-root -cR "$(whoami)":"$(whoami)" "$HOME"
}
Loading
Loading
@@ -57,26 +54,18 @@ qc_exit_msg() {
qc_display_menu() {
[ $QC_DEBUG_MODE -eq 1 ] || clear
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~"
if [ $QC_IS_SERVER -eq 0 ]; then
echo " M A I N - M E N U "
echo " server "
else
echo " M A I N - M E N U "
echo " workstation "
fi
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "1. APT PACKAGES & UPDATES"
echo "2. RUBY & RUBYGEMS VIA RBENV"
echo "3. NODEJS & NPMS VIA NVM"
echo "4. PYTHON PACKAGES VIA PIP"
echo "5. SUBLIME TEXT"
echo "4. PYTHON & PIP VIA VIRTUALENV"
echo "5. SUBLIME TEXT 3"
echo "6. KEYBASE"
echo "7. SYSTEM CONFIG"
echo "8. SSH KEY"
echo "9. VIRTUALBOX & VAGRANT"
echo "10. WORDPRESS WITH LXD, ZFS & JUJU"
echo "11. FIX PERMISSIONS"
echo "12. QUIT"
echo "9. FIX HOME OWNERSHIP"
echo "10. QUIT"
}
 
# -------------------------- USER SELECTION
Loading
Loading
@@ -85,20 +74,18 @@ qc_select_options() {
local choice
# make sure we're always starting from the right place
cd "$QC_DIR" || exit
read -rp "Enter choice [1 - 12]: " choice
read -rp "Enter choice [1 - 10]: " choice
case $choice in
1) lkm_run_script apts.sh "script";;
2) lkm_run_script gems.sh "script";;
3) lkm_run_script npms.sh "script";;
4) lkm_run_script pips.sh "script";;
5) lkm_run_script subl.sh "script";;
6) lkm_run_script keybase.sh "script";;
7) lkm_run_script config.sh "script";;
8) lkm_run_script sshkey.sh "script";;
9) lkm_run_script vm.sh "script";;
10) lkm_run_script lxd.sh "script";;
11) qc_fix_permissions;;
12) qc_exit_msg && exit 0;;
1) lkm_run_script apts.sh "script";;
2) lkm_run_script gems.sh "script";;
3) lkm_run_script npms.sh "script";;
4) lkm_run_script pips.sh "script";;
5) lkm_run_script subl.sh "script";;
6) lkm_run_script keybase.sh "script";;
7) lkm_run_script config.sh "script";;
8) lkm_run_script sshkey.sh "script";;
9) qc_fix_permissions;;
10) qc_exit_msg && exit 0;;
*) lkm_alert "Error..." && sleep 1
esac
 
Loading
Loading
{
"folders":
[
{
"path": "."
}
]
}
Loading
Loading
@@ -103,26 +103,20 @@ fi
 
# -------------------------- DEFAULT APT PACKAGES
 
DEFAULT_SERVER_LIST='ca-certificates gettext-base less man-db openssh-server python-software-properties software-properites-common vim-gtk wget'
DEFAULT_WORKSTATION_LIST='autojump gpgv2 links mutt pinta x11vnc xclip vlc arp-scan'
DEFAULT_DEV_LIST='autoconf automake build-essential checkinstall dconf-cli shellcheck silversearcher-ag tidy xdotool vim-gtk'
 
# -------------------------- PROMPT FOR PROGRAMS
 
if [ "$QC_IS_SERVER" -eq 0 ]; then
lkm_notify "Server packages to install (none to skip)"
read -ep " : " -i "$DEFAULT_SERVER_LIST" APTS1
else
lkm_notify3 "The following default packages can be modified prior to installation."
echo
echo "WORKSTATION"
echo "DEVELOPER"
echo
lkm_notify "Workstation packages to install (delete all to skip)"
read -ep " : " -i "$DEFAULT_WORKSTATION_LIST" APTS1
lkm_notify "Developer packages to install"
read -ep " : " -i "$DEFAULT_DEV_LIST" APTS2
fi
lkm_notify3 "The following default packages can be modified prior to installation."
echo
echo "WORKSTATION"
echo "DEVELOPER"
echo
lkm_notify "Workstation packages to install (delete all to skip)"
read -rep " : " -i "$DEFAULT_WORKSTATION_LIST" APTS1
lkm_notify "Developer packages to install"
read -rep " : " -i "$DEFAULT_DEV_LIST" APTS2
 
# -------------------------- ARRAY ASSIGNMENTS
 
Loading
Loading
Loading
Loading
@@ -14,22 +14,23 @@
 
[ -z "$QC_CONFIG" ] && QC_CONFIG="$HOME/.qc"
[ -z "$QC_BACKUP" ] && QC_BACKUP="$QC_CONFIG/backup"
[ -z "$QC_SYNCED" ] && read -ep "Directory to store/sync your config: " -i "$HOME/Dropbox/config" QC_SYNCED
[ -z "$QC_SYNCED" ] && read -rep "Directory to store/sync Sublime Text config: " -i "$HOME/" QC_SYNCED
 
# system and program config files
CONF1="$HOME/.bashrc"
CONF2="$HOME/.inputrc"
CONF3="$QC_SYNCED/sublime/User/Preferences.sublime-settings"
CONF5="$HOME/.muttrc"
CONF6="$HOME/.vimrc"
CONF7="$HOME/.gitignore_global"
CONF3="$QC_SYNCED/subl/User/Preferences.sublime-settings"
CONF4="$HOME/.muttrc"
CONF5="$HOME/.vimrc"
CONF6="$HOME/.gitignore_global"
 
# config files copied from repositories
REPO1="/usr/share/autojump/autojump.sh"
REPO3="$HOME/.config/sublime-text-3/Packages/Theme - KMS/subl.conf"
REPO5="$QC_CONFIG/mutt/colors/mutt-colors-solarized-dark-16.muttrc"
REPO6="$QC_CONFIG/vim/vim.conf"
REPO7="$QC_CONFIG/git/gitignore_global"
REPO1="/usr/share/autojump/autojump.sh" #autojump.bash in CentOS
REPO3="$QC_CONFIG/subl/subl.conf"
REPO4="$QC_CONFIG/mutt/colors/mutt-colors-solarized-dark-16.muttrc"
REPO5="$QC_CONFIG/vim/vim.conf"
REPO6="$QC_CONFIG/git/gitignore_global"
REPO7="$QC_CONFIG/bashrc/ps1.conf"
 
# -------------------------- BACKUPS
 
Loading
Loading
@@ -58,6 +59,15 @@ qc_do_backup() {
return 0
}
 
# -------------------------- MORE SECURE LOGIN SCREEN
# sudo mkdir -p /etc/lightdm/lightdm.conf.d
# cat '[SeatDefaults] \
# user-session=ubuntu \
# greeter-show-manual-login=true \
# greeter-hide-users=true \
# allow-guest=false'
# -------------------------- SUBL CONFIG
 
# clone or pull git repo and copy repo files into proper places
Loading
Loading
@@ -65,29 +75,37 @@ qc_set_subl_config() {
local repo_url="$1"
local conf_file="$CONF3"
local repo_file="$REPO3"
local conf_dir
local conf_parent_dir
local repo_dir
local repo_name
local cloned=1
local user_dir="$HOME/.config/sublime-text-3/Packages/User"
 
conf_dir=$(lkm_trim_shortest_right_pattern "$CONF3" "/")
conf_parent_dir=$(lkm_trim_shortest_right_pattern "$conf_dir" "/")
repo_dir=$(lkm_trim_shortest_right_pattern "$REPO3" "/")
repo_name=$(lkm_trim_longest_left_pattern "$repo_dir" "/")
 
# check if standard directory exists and if so, make a backup and remove it
[ -d "$user_dir" ] && { mv "$user_dir" "${user_dir}-bak"; rm -r "$user_dir"; }
echo "conf_dir: $conf_dir"
echo "conf_parent_dir: $conf_parent_dir"
echo "repo_dir: $repo_dir"
 
# make sure directories exist
mkdir -p "$HOME/.config/sublime-text-3/Packages"
mkdir -p "$QC_SYNCED/sublime/User"
# make sure directory exists for symlink
echo "attempting to make $user_dir"
mkdir -p "$user_dir"
 
# symlink to User directory in Dropbox
ln -s "$QC_SYNCED/sublime/User" "$user_dir"
# check if $conf_dir exists, else create parent and move $user_dir to $conf_parent_dir
echo "checking if $conf_dir exists"
[ -d "$conf_dir" ] || { echo "making $conf_parent_dir" ; mkdir -p "$conf_parent_dir" ; echo "moving $user_dir to $conf_parent_dir" ; mv "$user_dir" "$conf_parent_dir" ; }
 
# update or clone repository
# remove default user directory if not already a symlink
echo "checking for symlink at $user_dir"
[ -L "$user_dir" ] || { echo "creating symlink from $user_dir to $conf_dir" ; ln -s "$conf_dir" "$user_dir" ; }
# update or clone repository if symbolic link exists for User directory
if [ -d "$repo_dir" ]; then
(
cd "$repo_dir" || exit
echo "checking for updates: $repo_name"
echo "checking for updates: Keegoid's Sublime Text preferences"
git pull
)
else
Loading
Loading
@@ -95,7 +113,8 @@ qc_set_subl_config() {
fi
 
# copy config file to proper location
cp "$repo_file" "$conf_file"
echo -e "copying $repo_file to \n$conf_file"
cp -i "$repo_file" "$conf_file"
if [ $? -eq 0 ] && [ "$cloned" -eq 0 ]; then
lkm_success "configured: $conf_file"
fi
Loading
Loading
@@ -109,13 +128,13 @@ qc_set_subl_config() {
# clone or pull git repo and copy repo file onto conf file
qc_set_git_config() {
local repo_url="$1"
local conf_file="$CONF7"
local repo_file="$REPO7"
local conf_file="$CONF6"
local repo_file="$REPO6"
local repo_dir
local repo_name
local cloned=1
 
repo_dir=$(lkm_trim_shortest_right_pattern "$REPO7" "/")
repo_dir=$(lkm_trim_shortest_right_pattern "$REPO6" "/")
repo_name=$(lkm_trim_longest_left_pattern "$repo_dir" "/")
 
# update or clone repository
Loading
Loading
@@ -137,12 +156,18 @@ qc_set_git_config() {
 
# check if git is already configured
if ! git config --list | grep -q "user.name"; then
read -ep "your name for git commit logs: " -i 'Keegan Mullaney' real_name
read -ep "your email for git commit logs: " -i 'keeganmullaney@gmail.com' email_address
read -ep "your preferred text editor for git commits: " -i 'vi' git_editor
lkm_configure_git "$real_name" "$email_address" "$git_editor" && lkm_success "configured: $CONF7"
read -rep "your name for git commit logs: " -i 'Keegan Mullaney' real_name
read -rep "your email for git commit logs: " -i 'keeganmullaney@gmail.com' email_address
read -rep "your preferred text editor for git commits: " -i 'subl --wait' git_editor
lkm_configure_git "$real_name" "$email_address" "$git_editor" && lkm_success "configured: $CONF6"
fi
 
# todo:
# [diff]
# tool = default-difftool
# [difftool "default-difftool"]
# cmd = code --wait --diff $LOCAL $REMOTE
RET="$?"
lkm_debug
}
Loading
Loading
@@ -170,33 +195,63 @@ EOF
lkm_debug
}
 
# -------------------------- TERMINAL COLOR PROMPTS
# -------------------------- AUTOJUMP (so awesome)
 
qc_set_terminal_color() {
qc_set_autojump() {
local conf_file="$1"
local src_cmd="$2"
 
if grep -q "#force_color_prompt=yes" "$conf_file" >/dev/null 2>&1; then
lkm_pause "Press [Enter] to activate color terminal prompts" true
sed -i.bak -e "/force_color_prompt=yes/ s/^# //" "$conf_file" && source "$conf_file" && lkm_success "configured: $conf_file with color terminal prompts"
if grep -q "autojump/autojump.sh" "$conf_file" >/dev/null 2>&1; then
echo "already added autojump (usage: j directory)"
else
echo "already set color prompts"
lkm_pause "Press [Enter] to configure autojump for gnome-terminal" true
# shellcheck disable=SC1090
echo -e "$src_cmd" >> "$conf_file" && source "$conf_file" && lkm_success "configured: $conf_file with autojump (usage: j directory)"
fi
 
# shellcheck disable=SC2034
RET="$?"
lkm_debug
}
 
# -------------------------- AUTOJUMP (so awesome)
# -------------------------- SET PS1
 
qc_set_autojump() {
local conf_file="$1"
qc_set_ps1() {
local repo_url="$1"
local src_cmd="$2"
local conf_file="$CONF1"
local repo_file="$REPO7"
local repo_dir
local repo_name
local configured=1
 
if grep -q "autojump/autojump.sh" "$conf_file" >/dev/null 2>&1; then
echo "already added autojump (usage: j directory)"
repo_dir=$(lkm_trim_shortest_right_pattern "$REPO7" "/")
repo_name=$(lkm_trim_longest_left_pattern "$repo_dir" "/")
# update or clone repository
if [ -d "$repo_dir" ]; then
(
cd "$repo_dir" || exit
echo "checking for updates: $repo_name"
git pull
)
else
lkm_pause "Press [Enter] to configure autojump for gnome-terminal" true
echo -e "$src_cmd" >> "$conf_file" && source "$conf_file" && lkm_success "configured: $conf_file with autojump (usage: j directory)"
git clone "$repo_url" "$repo_dir"
fi
# check if already added, else set source command in conf_file
if grep -q "bashrc/ps1.conf" "$conf_file" >/dev/null 2>&1; then
echo "already added custom PS1 file"
else
lkm_pause "Press [Enter] to configure PS1 variable for gnome-terminal" true
# shellcheck disable=SC1090
sed -i.bak -e '0,/PS1/s//#PS1/' -e "/\"\$color_prompt\" = yes/ a $src_cmd" "$conf_file" && configured=0
fi
# success message
if [ $? -eq 0 ] && [ "$configured" -eq 0 ]; then
lkm_success "configured: $conf_file with custom PS1 variable"
echo "Close and reopen the terminal to see the new prompt string."
fi
 
# shellcheck disable=SC2034
Loading
Loading
@@ -208,14 +263,14 @@ qc_set_autojump() {
 
# unset the various functions defined during execution of the script
qc_reset() {
unset -f qc_reset qc_do_backup qc_set_subl_config qc_set_git_config qc_set_terminal_history qc_set_autojump
unset -f qc_reset qc_do_backup qc_set_code_config qc_set_git_config qc_set_terminal_history qc_set_autojump qc_set_ps1
}
 
# -------------------------- MAIN
 
lkm_pause "" true
 
qc_do_backup "$CONF1 $CONF2 $CONF3 $CONF5 $CONF6 $CONF7"
qc_do_backup "$CONF1 $CONF2 $CONF3 $CONF4 $CONF5 $CONF6"
 
# aliases (to practice terminal commands for Linux certification exams, I'm not using aliases at the moment)
#lkm_set_sourced_config "https://gist.github.com/9d74e08779c1db6cb7b7" \
Loading
Loading
@@ -225,36 +280,31 @@ qc_do_backup "$CONF1 $CONF2 $CONF3 $CONF5 $CONF6 $CONF7"
 
# mutt config
lkm_set_sourced_config "https://github.com/altercation/mutt-colors-solarized.git" \
"$CONF5" \
"$REPO5" \
"# source colorscheme file\nsource $REPO5\n\n# signature and alias files\nset signature=$QC_SYNCED/mutt/sig\nset alias_file=$QC_SYNCED/mutt/aliases\n\n# aliases are stored in their own file\nsource \"\$alias_file\""
"$CONF4" \
"$REPO4" \
"# source colorscheme file\nsource $REPO4\n\n# signature and alias files\nset signature=$QC_SYNCED/mutt/sig\nset alias_file=$QC_SYNCED/mutt/aliases\n\n# aliases are stored in their own file\nsource \"\$alias_file\""
 
# vim config
lkm_set_sourced_config "https://gist.github.com/00a60c7355c27c692262.git" \
"$CONF6" \
"$REPO6" \
"\" source config file\n:so $REPO6\n\nset spellfile=$QC_SYNCED/vim/vim.utf-8.add\t\" spell check file to sync with other computers"
[ -d "$QC_SYNCED/vim" ] || { mkdir -pv "$QC_SYNCED/vim"; lkm_notify3 "note: vim spellfile will be located in $QC_SYNCED/vim, you can change this in $CONF6"; }
"$CONF5" \
"$REPO5" \
"\" source config file\n:so $REPO5\n\nset spellfile=$QC_SYNCED/vim/vim.utf-8.add\t\" spell check file to sync with other computers"
 
# terminal profile (can't find profile file in new Ubuntu 16.04)
#set_copied_config "https://gist.github.com/dad1663d2463db32c6e8.git" \
# "$HOME/.gconf/apps/gnome-terminal/profiles/Default/%gconf.xml" \
# "$QC_CONFIG/terminal/profile/gconf.xml"
[ -d "$QC_SYNCED/vim" ] || { mkdir -pv "$QC_SYNCED/vim"; lkm_notify3 "note: vim spellfile will be located in $QC_SYNCED/vim, you can change this in $CONF5"; }
 
# sublime text
qc_set_subl_config "https://github.com/keegoid/kms-theme.git"
# sublime text 3
qc_set_subl_config "https://gist.github.com/6628da9ad09cf0eff9427c6dfdca6e5f.git"
 
qc_set_git_config "https://gist.github.com/efa547b362910ac7077c.git"
 
qc_set_terminal_history "$CONF2"
 
# already done in Ubuntu 16.04
#qc_set_terminal_color "$CONF1"
qc_set_autojump "$CONF1" \
"\n# source autojump file\nif [ -f $REPO1 ]; then\n . $REPO1\nfi"
 
qc_set_ps1 "https://gist.github.com/13482742b6140ec0ffbc818173805889.git" \
"# source PS1 file\n if [ -f $REPO7 ]; then\n . $REPO7\n fi"
qc_reset
 
} # this ensures the entire script is downloaded #
Loading
Loading
@@ -32,7 +32,7 @@ qc_gem_check() {
for pkg in "${gem_check_list[@]}"
do
if ~/.rbenv/shims/gem list ^"$pkg"$ -i >/dev/null 2>&1; then
pkg_version=$(~/.rbenv/shims/gem list ^"$pkg"$ | grep "${pkg}" | cut -d " " -f 2 | cut -d "(" -f 2 | cut -d ")" -f 1)
pkg_version=$(~/.rbenv/shims/gem list ^"$pkg"$ | grep "${pkg}" | cut -d' ' -f2 | cut -d'(' -f2 | cut -d')' -f1)
lkm_print_pkg_info "$pkg" "$pkg_version"
else
echo -e " ${YELLOW_BLACK} * $pkg [not installed] ${NONE_WHITE}"
Loading
Loading
@@ -84,7 +84,7 @@ qc_install_rbenv() {
'[[ ":$PATH:" =~ ":$HOME/.rbenv/bin:" ]] || PATH="$HOME/.rbenv/bin:$PATH"'
 
# optional, to speed up rbenv
[ -d "$HOME/.rbenv" ] && cd "$HOME/.rbenv" && src/configure && make -C src && cd - >/dev/null
[ -d "$HOME/.rbenv" ] && cd "$HOME/.rbenv" && src/configure && make -C src && cd - >/dev/null
 
# add rbenv init - command to .bashrc and .bash_profile (for SublimeLinter)
# shellcheck disable=SC2016
Loading
Loading
@@ -124,7 +124,7 @@ qc_install_ruby() {
# export MAKE=make
 
# install the latest stable ruby version
ruby_global_v=$(~/.rbenv/bin/rbenv install --list | tr -d ' ' | grep "^2.*.[0..9]$" | tail -1)
ruby_global_v=$(~/.rbenv/bin/rbenv install --list | tr -d ' ' | grep "^\w.\w.\w$" | tail -1)
[ $? -eq 0 ] && ~/.rbenv/bin/rbenv install "$ruby_global_v"
 
# set global ruby version
Loading
Loading
@@ -165,7 +165,7 @@ echo
echo "Rubygems"
echo
lkm_notify "Packages to install with gem"
read -ep " : " -i 'bundler gist travis' GEMS
read -rep " : " -i 'bundler gist travis' GEMS
 
# -------------------------- ARRAY ASSIGNMENTS
 
Loading
Loading
Loading
Loading
@@ -14,7 +14,7 @@
 
# -------------------------- SETUP PARAMETERS
 
[ -z "$QC_REPOS" ] && read -ep "Directory to use for repositories: ~/" -i "Dropbox/coding/repos" QC_REPOS
[ -z "$QC_REPOS" ] && read -rep "Directory to use for repositories: ~/" -i "Dropbox/coding/repos" QC_REPOS
QC_SELECTED_CONTAINER
 
# -------------------------- INSTALL LXD/LXC
Loading
Loading
@@ -45,7 +45,7 @@ qc_init_juju_lxd() {
[ $? -eq 0 ] && sudo lxd init
 
# set compression and turn off dedup
read -ep "Enter the name you used for your zpool: " zpool_name
read -rep "Enter the name you used for your zpool: " zpool_name
sudo zfs set compression=on "$zpool_name"
sudo zfs set compression=lz4 "$zpool_name"
sudo zfs set dedup=off "$zpool_name"
Loading
Loading
@@ -97,7 +97,7 @@ qc_import_lxd_image() {
# $1 -> host name
qc_set_hosts() {
lxc list
read -ep "Type an existing container name to use for ${1}: " QC_SELECTED_CONTAINER
read -rep "Type an existing container name to use for ${1}: " QC_SELECTED_CONTAINER
 
# add container's ip to /etc/hosts
lkm_pause "Press [Enter] to add $1 to /etc/hosts"
Loading
Loading
@@ -134,8 +134,8 @@ qc_set_hosts() {
# $1 -> host name
qc_set_shared_directory() {
# set syncing directory paths
read -ep "Choose a source directory on host to sync: ~/${QC_REPOS}/" -i "${1}/site" relative_source
read -ep "Choose a target directory in container to sync: /" -i "var/www/${1}/public_html" target_dir
read -rep "Choose a source directory on host to sync: ~/${QC_REPOS}/" -i "${1}/site" relative_source
read -rep "Choose a target directory in container to sync: /" -i "var/www/${1}/public_html" target_dir
source_dir="$HOME/${QC_REPOS}/$relative_source"
target_dir="/${target_dir}"
 
Loading
Loading
@@ -185,8 +185,8 @@ qc_create_lxd_container() {
 
# select an image and choose a container name
lxc image list
read -ep "Select an image to use for the new container: " -i 'ubuntu-trusty' selected_image
read -ep "Enter a host name to use with /etc/hosts: " -i 'wordpress.dev' host_name
read -rep "Select an image to use for the new container: " -i 'ubuntu-trusty' selected_image
read -rep "Enter a host name to use with /etc/hosts: " -i 'wordpress.dev' host_name
 
# create and start container
lxc launch "$selected_image"
Loading
Loading
@@ -221,7 +221,7 @@ qc_deploy_wordpress() {
 
# optionally set wp-content to git repository
lkm_confirm "Use a git repository for wp-content?" true
[ $? -eq 0 ] && lkm_notify3 "Format: git@host:path/repo.git or http://host/path/repo.git" && read -ep "Enter a git repository: " git_repo && juju set wordpress wp-content="$git_repo"
[ $? -eq 0 ] && lkm_notify3 "Format: git@host:path/repo.git or http://host/path/repo.git" && read -rep "Enter a git repository: " git_repo && juju set wordpress wp-content="$git_repo"
 
RET="$?"
lkm_debug
Loading
Loading
Loading
Loading
@@ -15,9 +15,7 @@
{ # this ensures the entire script is downloaded #
 
# -------------------------- SETUP PARAMETERS
[ -z "$QC_LTS" ] && QC_LTS=4
[ -z "$NVM_V" ] && NVM_V=0.31.1
[ -z "$NVM_V" ] && read -rep "NVM version to use: " -i "0.33.2" NVM_V
 
# -------------------------- MISSING PROGRAM CHECKS
 
Loading
Loading
@@ -31,34 +29,29 @@ npm_check_list=()
 
# install the long term support version of Node.js via NVM
qc_nvm() {
local node_v
# install NVM
curl -o- "https://raw.githubusercontent.com/creationix/nvm/v${NVM_V}/install.sh" | bash
 
# source nvm
# shellcheck source=/dev/null
. ~/.nvm/nvm.sh
 
# make sure nvm is installed
lkm_has nvm || lkm_error "nvm install failed"
# get long term support version
node_v=$(nvm ls-remote | grep "v${QC_LTS}.*" | tail -1 | tr -d ' ')
# install nodejs
nvm install "$node_v"
# install latest long term support version
nvm install --lts=Boron
 
if [ $? -eq 0 ]; then
nvm alias default "$node_v"
fi
# check which node and npm
which node
which npm
# check which node and npm
echo "checking which node"
which node
echo "checking which npm"
which npm
 
# check npm version
npm -v
# check npm version
echo "checking npm version"
npm -v
 
lkm_notify "After switching node versions, remember to run \`npm build\`."
lkm_notify "After switching node versions, remember to run \`npm build\`."
fi
 
RET="$?"
lkm_debug
Loading
Loading
@@ -118,7 +111,7 @@ echo
echo "NODE.JS"
echo
lkm_notify "Packages to install with npm"
read -ep " : " -i 'bower browser-sync coffee-script csslint doctoc gulp npm-check-updates remark remark-lint' NPMS
read -rep " : " -i 'bower browser-sync coffee-script csslint doctoc gulp npm-check-updates remark remark-lint' NPMS
 
# -------------------------- ARRAY ASSIGNMENTS
 
Loading
Loading
Loading
Loading
@@ -43,6 +43,7 @@ qc_virtualenv() {
lkm_set_source_cmd "$HOME/.bashrc" \
'virtualenv/bin:' \
'[[ ":$PATH:" =~ ":$HOME/.virtualenv/bin:" ]] || PATH="$HOME/.virtualenv/bin:$PATH"'
# shellcheck source=/dev/null
source ~/.bashrc
 
# check which pip
Loading
Loading
@@ -151,10 +152,10 @@ echo
echo "PIPs"
echo
lkm_notify "Packages to install with pip"
read -ep " : " -i 'jrnl[encrypted] pyflakes python-slugify keyrings.alt' PIPS
read -rep " : " -i 'jrnl[encrypted] pyflakes python-slugify keyrings.alt' PIPS
# lkm_notify "Packages to install with pip3"
# shellcheck disable=SC2034
# read -ep " : " -i 'pep8' PIP3S
# read -rep " : " -i 'pep8' PIP3S
 
# -------------------------- ARRAY ASSIGNMENTS
 
Loading
Loading
@@ -172,6 +173,8 @@ qc_reset() {
# -------------------------- INSTALL PROGRAMS
 
lkm_confirm "Install PIP via Virtualenv?" true
# check if virtualenv and pip are already installed
[ -f ~/.virtualenv/bin/pip ] && lkm_confirm "Looks like Virtualenv and PIP are already installed. Proceed anyway?" true
if [ $? -eq 0 ]; then
qc_virtualenv
echo "Close the terminal window and reopen to enable the new PIP with Virtualenv. Then rerun this script."
Loading
Loading
Loading
Loading
@@ -23,8 +23,8 @@ qc_set_authorized_key() {
sudo chmod a-w /etc/ssh/sshd_config.original
 
# client allive interval
read -ep "Enter the client alive interval in seconds to prevent SSH from dropping out: " -i "60" client_alive
read -ep "Enter the ssh port number to use on the server: " -i "22" ssh_port
read -rep "Enter the client alive interval in seconds to prevent SSH from dropping out: " -i "60" client_alive
read -rep "Enter the ssh port number to use on the server: " -i "22" ssh_port
 
# edit /etc/ssh/sshd_config
sudo sed -i.bak -e "{ s/#Port 22/Port $ssh_port/
Loading
Loading
@@ -60,12 +60,6 @@ qc_set_authorized_key() {
 
# -------------------------- MAIN
 
if [ "$QC_IS_SERVER" -eq 0 ]; then
qc_set_authorized_key
else
lkm_gen_ssh_key "$HOME/.ssh" "$(whoami)"
fi
unset -f qc_set_authorized_key
lkm_gen_ssh_key "$HOME/.ssh" "$(whoami)"
 
} # this ensures the entire script is downloaded #
Loading
Loading
@@ -14,7 +14,8 @@
 
# install Sublime Text
qc_install_subl() {
local subl_v='3126'
local subl_v
[ -z "$subl_v" ] && read -rep "Sublime Text 3 version to use: " -i "3126" subl_v
local subl_url="https://download.sublimetext.com/sublime-text_build-${subl_v}_amd64.deb"
 
if lkm_not_installed "subl"; then
Loading
Loading
@@ -29,6 +30,9 @@ qc_install_subl() {
else
lkm_notify "subl is already installed"
fi
lkm_notify "Make sure to install Package Control so subl can install any packages listed in your User directory. It can be installed from https://packagecontrol.io/installation"
lkm_notify2 "Recommend installing the Material Theme package for Sublime Text 3 from https://github.com/equinusocio/material-theme"
}
 
# -------------------------- MAIN
Loading
Loading
#!/bin/bash
# --------------------------------------------
# Install or update virtual machine apps.
#
# Author : Keegan Mullaney
# Website: keegoid.com
# Email : keeganmullaney@gmail.com
# License: keegoid.mit-license.org
# --------------------------------------------
{ # this ensures the entire script is downloaded #
# -------------------------- MAIN
lkm_confirm "install Virtualbox?" true
[ $? -eq 0 ] && lkm_install_apt virtualbox
lkm_confirm "install Vagrant?" true
[ $? -eq 0 ] && lkm_install_apt vagrant
} # this ensures the entire script is downloaded #