More consistent $ escapes
This commit is contained in:
@@ -17,7 +17,7 @@ fi
|
||||
|
||||
# Prevent concurrent runs
|
||||
readonly install_lock_file="$dotfiles_dir/.dotlock"
|
||||
if [ -f $install_lock_file ]; then
|
||||
if [ -f "$install_lock_file" ]; then
|
||||
printf "Failed: ${C_RED}Script already running${C_NC}\n"
|
||||
printf "Please wait for script to exit or ${C_YELLOW}make clean${C_NC}\n"
|
||||
exit 1
|
||||
@@ -27,13 +27,13 @@ touch "$install_lock_file" # Requires clean
|
||||
# Run all install scripts
|
||||
readonly install_dir="$dotfiles_dir/install"
|
||||
readonly script_filter="$install_dir/*.sh"
|
||||
for script in $script_filter; do
|
||||
for script in "$script_filter"; do
|
||||
|
||||
# Avoid pattern matching self
|
||||
[ -e "$script" ] || continue
|
||||
|
||||
# Log execution
|
||||
script_name=$(basename "$script" ".sh")
|
||||
script_name="$(basename "$script" ".sh")"
|
||||
printf "Running ${C_YELLOW}$script_name${C_NC}...\n${C_DGRAY}"
|
||||
|
||||
# Run and indent output
|
||||
|
||||
@@ -11,5 +11,5 @@ update
|
||||
upgrade
|
||||
|
||||
# Package installs
|
||||
readonly package_list=$(cat $install_dir/$package_list_file)
|
||||
readonly package_list="$(cat $install_dir/$package_list_file)"
|
||||
install -y "$package_list"
|
||||
|
||||
@@ -23,7 +23,7 @@ printf "fish is installed\n"
|
||||
fish --version
|
||||
|
||||
# 2. fish shell is default login shell
|
||||
readonly fish_path=$(which fish)
|
||||
readonly fish_path="$(which fish)"
|
||||
if [ "$SHELL" != fish_path ]; then
|
||||
|
||||
# Update default login shell
|
||||
|
||||
@@ -41,7 +41,8 @@ if not_installed "docker-compose"; then
|
||||
printf "Installing docker-compose...\n"
|
||||
|
||||
# Docker-compose
|
||||
curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
|
||||
readonly docker_compose_url="https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m)"
|
||||
curl -L docker_compose_url -o /usr/local/bin/docker-compose
|
||||
sudo chmod +x /usr/local/bin/docker-compose
|
||||
|
||||
fi
|
||||
@@ -56,7 +57,7 @@ fi
|
||||
printf "group '$docker_group' is created\n"
|
||||
|
||||
# 4. user is in docker group
|
||||
if ! groups $USER | grep -q "\b$docker_group\b"; then
|
||||
if ! groups "$USER" | grep -q "\b$docker_group\b"; then
|
||||
sudo usermod -aG docker "$USER"
|
||||
fi
|
||||
printf "user '$USER' is in '$docker_group' group\n"
|
||||
|
||||
8
utils.sh
8
utils.sh
@@ -17,7 +17,7 @@ upgrade() {
|
||||
|
||||
# @arg $1 packages to install
|
||||
install() {
|
||||
sudo apt-get install -y $1
|
||||
sudo apt-get install -y "$1"
|
||||
}
|
||||
|
||||
# @arg $1 repository to add
|
||||
@@ -27,13 +27,13 @@ app_ppa() {
|
||||
|
||||
# @arg $1 url to add
|
||||
add_key() {
|
||||
curl -fsSL $1 | sudo apt-key add -
|
||||
curl -fsSL "$1" | sudo apt-key add -
|
||||
}
|
||||
|
||||
# @arg $1 URL to run
|
||||
# @arg $2 binary to use
|
||||
run() {
|
||||
curl -fsSL $1 | $2
|
||||
curl -fsSL "$1" | "$2"
|
||||
}
|
||||
|
||||
# Symlink contents of source folder to target
|
||||
@@ -41,7 +41,7 @@ run() {
|
||||
# @arg $1 source folder
|
||||
# @arg $2 target folder
|
||||
link_folder() {
|
||||
cp -srf $1 $2
|
||||
cp -srf "$1" "$2"
|
||||
}
|
||||
|
||||
indent() { sed 's/^/ /'; }
|
||||
|
||||
Reference in New Issue
Block a user