-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from andresgongora/develop
Develop
- Loading branch information
Showing
12 changed files
with
832 additions
and
770 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule bash-tools
updated
5 files
+9 −2 | bash-tools/assemble_script.sh | |
+109 −0 | bash-tools/assert.sh | |
+3 −6 | bash-tools/hook_script.sh | |
+79 −0 | bash-tools/print_bar.sh | |
+19 −47 | bash-tools/user_io.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,63 +28,41 @@ | |
|
||
##============================================================================== | ||
## | ||
setup() | ||
{ | ||
include() { source "$( cd $( dirname "${BASH_SOURCE[0]}" ) >/dev/null 2>&1 && pwd )/$1" ; } | ||
include 'bash-tools/bash-tools/user_io.sh' | ||
include 'bash-tools/bash-tools/hook_script.sh' | ||
include 'bash-tools/bash-tools/assemble_script.sh' | ||
|
||
|
||
## SWITCH BETWEEN AUTOMATIC AND USER INSTALLATION | ||
if [ "$#" -eq 0 ]; then | ||
local output_script="$HOME/.config/synth-shell/synth-shell-greeter.sh" | ||
local output_config_dir="$HOME/.config/synth-shell" | ||
cp "$output_config_dir/synth-shell-greeter.config" "$output_config_dir/synth-shell-greeter.config.backup" | ||
printInfo "Installing script as $output_script" | ||
local action=$(promptUser "Add hook your .bashrc file or equivalent?\n\tRequired for autostart on new terminals" "[Y]/[n]?" "yYnN" "y") | ||
case "$action" in | ||
""|y|Y ) hookScript $output_script ;; | ||
n|N ) ;; | ||
*) printError "Invalid option"; exit 1 | ||
esac | ||
include(){ { [ -z "$_IR" ]&&_IR="$PWD"&&cd "$(dirname "$PWD/$0")"&&include "$1"&&cd "$_IR"&&unset _IR;}||{ local d=$PWD&&cd "$(dirname "$PWD/$1")"&&. "$(basename "$1")"&&cd "$d";}||{ echo "Include failed $PWD->$1"&&exit 1;};} | ||
|
||
include 'bash-tools/bash-tools/user_io.sh' | ||
include 'bash-tools/bash-tools/hook_script.sh' | ||
include 'bash-tools/bash-tools/assemble_script.sh' | ||
|
||
|
||
## SWITCH BETWEEN AUTOMATIC AND USER INSTALLATION | ||
if [ "$#" -eq 0 ]; then | ||
OUTPUT_SCRIPT="$HOME/.config/synth-shell/synth-shell-greeter.sh" | ||
OUTPUT_CONFIG_DIR="$HOME/.config/synth-shell" | ||
cp "$OUTPUT_CONFIG_DIR/synth-shell-greeter.config" \ | ||
"$OUTPUT_CONFIG_DIR/synth-shell-greeter.config.backup" | ||
printInfo "Installing script as $OUTPUT_SCRIPT" | ||
USER_CHOICE=$(promptUser "Add hook your .bashrc file or equivalent?\n\tRequired for autostart on new terminals" "[Y]/[n]?" "yYnN" "y") | ||
case "$USER_CHOICE" in | ||
""|y|Y ) hookScript $OUTPUT_SCRIPT ;; | ||
n|N ) ;; | ||
*) printError "Invalid option"; exit 1 | ||
esac | ||
|
||
else | ||
local output_script="$1" | ||
local output_config_dir="$2" | ||
fi | ||
|
||
|
||
## DEFINE LOCAL VARIABLES | ||
local dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd ) | ||
local input_script="$dir/synth-shell-greeter/synth-shell-greeter.sh" | ||
local input_config_dir="$dir/config/" | ||
|
||
|
||
## HEADER TO BE ADDED AT THE TOP OF THE ASSEMBLED SCRIPT | ||
local output_script_header=$(printf '%s'\ | ||
"##!/bin/bash\n"\ | ||
"\n"\ | ||
"## +-----------------------------------+-----------------------------------+\n"\ | ||
"## | |\n"\ | ||
"## | Copyright (c) 2014-2020, Andres Gongora <[email protected]> |\n"\ | ||
"## | https://github.com/andresgongora/synth-shell-greeter |\n"\ | ||
"## | Visit the above URL for details of license and authorship. |\n"\ | ||
"## | |\n"\ | ||
"## | This program is free software: you can redistribute it and/or modify |\n"\ | ||
"## | it under the terms of the GNU General Public License as published by |\n"\ | ||
"## | the Free Software Foundation, either version 3 of the License, or |\n"\ | ||
"## | (at your option) any later version. |\n"\ | ||
"## | |\n"\ | ||
"## | This program is distributed in the hope that it will be useful, |\n"\ | ||
"## | but WITHOUT ANY WARRANTY; without even the implied warranty of |\n"\ | ||
"## | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |\n"\ | ||
"## | GNU General Public License for more details. |\n"\ | ||
"## | |\n"\ | ||
"## | You should have received a copy of the GNU General Public License |\n"\ | ||
"## | along with this program. If not, see <http://www.gnu.org/licenses/>. |\n"\ | ||
"## | |\n"\ | ||
"## +-----------------------------------------------------------------------+\n"\ | ||
else | ||
OUTPUT_SCRIPT="$1" | ||
OUTPUT_CONFIG_DIR="$2" | ||
fi | ||
|
||
|
||
## DEFINE LOCAL VARIABLES | ||
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd ) | ||
INPUT_SCRIPT="$DIR/synth-shell-greeter/synth-shell-greeter.sh" | ||
INPUT_CONFIG_DIR="$DIR/config/" | ||
|
||
|
||
## HEADER TO BE ADDED AT THE TOP OF THE ASSEMBLED SCRIPT | ||
OUTPUT_SCRIPT_HEADER=$(printf '%s'\ | ||
"##\n"\ | ||
"##\n"\ | ||
"## =======================\n"\ | ||
|
@@ -93,43 +71,31 @@ setup() | |
"## =======================\n"\ | ||
"##\n"\ | ||
"## This file was generated by an installation script.\n"\ | ||
"## If you edit this file, it might be overwritten without warning\n"\ | ||
"## and you might lose all your changes.\n"\ | ||
"## It might be overwritten without warning at any time\n"\ | ||
"## and you will lose all your changes.\n"\ | ||
"##\n"\ | ||
"## Visit for instructions and more information:\n"\ | ||
"## https://github.com/andresgongora/synth-shell/\n"\ | ||
"##\n"\ | ||
"##\n\n\n") | ||
|
||
|
||
## SETUP SCRIPT | ||
assembleScript "$input_script" "$output_script" "$output_script_header" | ||
|
||
|
||
## SETUP CONFIGURATION FILES | ||
[ -d "$output_config_dir" ] || mkdir -p "$output_config_dir" | ||
cp -r "$input_config_dir/." "$output_config_dir/" | ||
|
||
## SETUP SCRIPT | ||
assembleScript "$INPUT_SCRIPT" "$OUTPUT_SCRIPT" "$OUTPUT_SCRIPT_HEADER" | ||
|
||
## SETUP DEFAULT SYNTH-SHELL-GREETER CONFIG FILE | ||
local config_file="$output_config_dir/synth-shell-greeter.config" | ||
if [ ! -f "$config_file" ]; then | ||
local distro=$(cat /etc/os-release | grep "ID=" | sed 's/ID=//g' | head -n 1) | ||
case "$distro" in | ||
'arch' ) cp "$output_config_dir/os/synth-shell-greeter.archlinux.config" "$config_file" ;; | ||
'manjaro' ) cp "$output_config_dir/os/synth-shell-greeter.manjaro.config" "$config_file" ;; | ||
*) cp "$output_config_dir/synth-shell-greeter.config.default" "$config_file" ;; | ||
esac | ||
fi | ||
} | ||
|
||
## SETUP CONFIGURATION FILES | ||
[ -d "$OUTPUT_CONFIG_DIR" ] || mkdir -p "$OUTPUT_CONFIG_DIR" | ||
cp -r "$INPUT_CONFIG_DIR/." "$OUTPUT_CONFIG_DIR/" | ||
|
||
|
||
|
||
|
||
|
||
##============================================================================== | ||
## SCRIPT | ||
##============================================================================== | ||
|
||
setup $@ | ||
|
||
## SETUP DEFAULT SYNTH-SHELL-GREETER CONFIG FILE | ||
CONFIG_FILE="$OUTPUT_CONFIG_DIR/synth-shell-greeter.config" | ||
if [ ! -f "$CONFIG_FILE" ]; then | ||
DISTRO=$(cat /etc/os-release | grep "ID=" | sed 's/ID=//g' | head -n 1) | ||
case "$DISTRO" in | ||
'arch' ) cp "$OUTPUT_CONFIG_DIR/os/synth-shell-greeter.archlinux.config" "$CONFIG_FILE" ;; | ||
'manjaro' ) cp "$OUTPUT_CONFIG_DIR/os/synth-shell-greeter.manjaro.config" "$CONFIG_FILE" ;; | ||
*) cp "$OUTPUT_CONFIG_DIR/synth-shell-greeter.config.default" "$CONFIG_FILE" ;; | ||
esac | ||
fi |
Oops, something went wrong.