setup includes media sync and defaults editor; moved almost all prompts to the start of the setup

This commit is contained in:
Wryn Wagner 2021-09-24 10:20:54 -06:00
parent 72d6e76602
commit e04a16bbcd
11 changed files with 86 additions and 65 deletions

19
bin/aws/configure vendored Executable file
View File

@ -0,0 +1,19 @@
#!/bin/zsh
source "$HOME/.config/wryn/env/env.zsh"
source $ZSH_COLOR_UTIL
#####################################################################
CONFIGURE() {
CHECK "checking for '$DOTWRYN_AWS_PROFILE' aws credentials"
grep -q "^\\[$DOTWRYN_AWS_PROFILE\\]$" "$HOME/.aws/credentials" \
&& { OK; return 0 } || WARN
USER_PROMPT "set up credentials now? [Y/n]"
READ_K yn
[[ $yn =~ ^[nN] ]] && return 1
aws --profile $DOTWRYN_AWS_PROFILE configure
}
CONFIGURE

6
env/env.zsh vendored
View File

@ -23,7 +23,11 @@ WEBBROWSER='google-chrome-stable'
#I3__DMENU_FONT_SIZE= #I3__DMENU_FONT_SIZE=
#I3__BORDER_PIXEL_SIZE= #I3__BORDER_PIXEL_SIZE=
S3_SYNC_AWS_PROFILE='yage' DOTWRYN_AWS_PROFILE='yage'
DOTWRYN_AWS_REGION='us-east-2'
DOTWRYN_AWS_OUTPUT='json'
S3_SYNC_AWS_PROFILE=$DOTWRYN_AWS_PROFILE
S3_SYNC_BUCKET='yage' S3_SYNC_BUCKET='yage'
S3_SYNC_MEDIA=( S3_SYNC_MEDIA=(
"Games/roms" "Games/roms"

7
setup/aws/setup.zsh Normal file
View File

@ -0,0 +1,7 @@
AWS__SETUP() {
STATUS 'starting aws setup'
"$DOTWRYN_PATH/bin/aws/configure"
STATUS 'getting media from s3'
"$DOTWRYN_PATH/bin/aws/s3/sync-media" pull
}

View File

@ -1,4 +1,4 @@
DOTCONFIG__SETUP() { CONFIG__SETUP() {
############################################################################################ ############################################################################################
# Friendly Name ~/.config/THE_REST .wryn/config/THE_REST (if different) # Friendly Name ~/.config/THE_REST .wryn/config/THE_REST (if different)
CONFIG__SYMLINK 'compton' 'compton/compton.conf' CONFIG__SYMLINK 'compton' 'compton/compton.conf'
@ -19,6 +19,9 @@ DOTCONFIG__SETUP() {
############################################################################################ ############################################################################################
CONFIG__TERMINFO CONFIG__TERMINFO
CONFIG__RC 'zsh'
CONFIG__RC 'vim'
} }
function CONFIG__SYMLINK() { function CONFIG__SYMLINK() {
@ -34,14 +37,52 @@ function CONFIG__SYMLINK() {
CHECK "linking $1" CHECK "linking $1"
{ {
mv "$LOCAL_CONFIG" "$LOCAL_CONFIG.bak" mv "$LOCAL_CONFIG" "$LOCAL_CONFIG.bak"
ln -s "$DOTWRYN_CONFIG" "$LOCAL_CONFIG" ln -s "$DOTWRYN_CONFIG" "$LOCAL_CONFIG"
} >>$LOG 2>&1 && OK || WARN } >>$LOG 2>&1 && OK || WARN
} }
function CONFIG__TERMINFO() { function CONFIG__TERMINFO() {
for file in $(find "$DOTWRYN_PATH/config/terminfo" -type f); do for file in $(find "$DOTWRYN_PATH/config/terminfo" -type f); do
CHECK "adding '$(basename $file)'" CHECK "adding $(basename $file)"
tic -x $file >>$LOG 2>&1 \ tic -x $file >>$LOG 2>&1 \
&& OK || WARN && OK || WARN
done done
} }
function CONFIG__RC() {
local DEFAULT_CONFIG="$DOTWRYN_PATH/env/env.$1"
local LOCAL_CONFIG="$HOME/.config/wryn/env/env.$1"
[ -f $LOCAL_CONFIG ] && {
WARNING "local $1 configuration exists ($LOCAL_CONFIG)"
USER_PROMPT 'overwrite? [y/N]'
READ_K yn
[[ $yn =~ ^[yY] ]] && {
CHECK "backing up local copy ($LOCAL_CONFIG.bak)"
mv "$LOCAL_CONFIG" "$LOCAL_CONFIG.bak" && OK || WARN
} || {
STATUS 'skipping'
return
}
}
CHECK "setting up $1 configuration ($LOCAL_CONFIG)"
case $1 in
vim ) COMMENT='"' ;;
zsh ) COMMENT='#' ;;
esac
{
echo "source $DEFAULT_CONFIG"
echo -e "\\n$COMMENT\n$COMMENT .wryn configuration overrides\n$COMMENT\n"
sed "s/^[^$COMMENT].*/$COMMENT&/" $DEFAULT_CONFIG
} > $LOCAL_CONFIG && OK || WARN
USER_PROMPT 'change local configuration options? [y/N]'
READ_K yn
[[ $yn =~ ^[yY] ]] && {
$EDITOR "$HOME/.config/wryn/env/env.$1"
}
}

View File

@ -118,7 +118,8 @@ MAKE_REQUIRED_DIRECTORY_STRUCTURE() {
source "$DOTWRYN_PATH/setup/os-dependencies/setup.zsh" source "$DOTWRYN_PATH/setup/os-dependencies/setup.zsh"
source "$DOTWRYN_PATH/setup/zsh/setup.zsh" source "$DOTWRYN_PATH/setup/zsh/setup.zsh"
source "$DOTWRYN_PATH/setup/vim/setup.zsh" source "$DOTWRYN_PATH/setup/vim/setup.zsh"
source "$DOTWRYN_PATH/setup/dotconfig/setup.zsh" source "$DOTWRYN_PATH/setup/config/setup.zsh"
source "$DOTWRYN_PATH/setup/aws/setup.zsh"
################################################################################ ################################################################################
@ -132,9 +133,11 @@ GET_SUDO_PASSWORD
OS_DEPENDENCY__SETUP || FATAL 'user abort' OS_DEPENDENCY__SETUP || FATAL 'user abort'
MAKE_REQUIRED_DIRECTORY_STRUCTURE MAKE_REQUIRED_DIRECTORY_STRUCTURE
ZSH__SETUP || ERROR=1 CONFIG__SETUP || ERROR=1
VIM__SETUP || ERROR=2
DOTCONFIG__SETUP || ERROR=3 ZSH__SETUP || ERROR=2
VIM__SETUP || ERROR=3
AWS__SETUP || ERROR=4
CLEANUP $ERROR CLEANUP $ERROR

View File

@ -1,4 +1,4 @@
base-devel aws-cli-v2
cmake cmake
cowsay cowsay
figlet figlet

View File

@ -1,3 +1,4 @@
awscli
build-essential build-essential
cmake cmake
cowsay cowsay

View File

@ -1,3 +1,4 @@
aws
build-essential build-essential
cmake cmake
cowsay cowsay

View File

@ -21,6 +21,7 @@ function OS_DEPENDENCY__SETUP() {
case $OS_NAME in case $OS_NAME in
arch ) arch )
OS_INSTALL() { OS_INSTALL__ARCH $@; } OS_INSTALL() { OS_INSTALL__ARCH $@; }
WARNING 'base-devel is required; make sure it is installed'
YAY__INSTALL_FROM_SOURCE YAY__INSTALL_FROM_SOURCE
;; ;;
debian | ubuntu ) debian | ubuntu )
@ -60,10 +61,6 @@ function OS_DEPENDENCY__SETUP() {
function OS_INSTALL__ARCH() { function OS_INSTALL__ARCH() {
local TARGET="$1" local TARGET="$1"
[[ $TARGET =~ ^base-devel$ ]] && {
WARNING 'base-devel is required; make sure it is installed'
return 0
}
CHECK "checking for $TARGET" CHECK "checking for $TARGET"
pacman -Qq | grep -q "^$TARGET$\|^$TARGET-git$" && OK || { pacman -Qq | grep -q "^$TARGET$\|^$TARGET-git$" && OK || {
WARN "$TARGET not found" WARN "$TARGET not found"

View File

@ -6,7 +6,6 @@ function VIM__SETUP() {
STATUS 'starting vim setup' STATUS 'starting vim setup'
VIM__COMPILE_FROM_SOURCE VIM__COMPILE_FROM_SOURCE
VIM__SOURCE_RC VIM__SOURCE_RC
VIM__SET_LOCAL_CONFIG
VIM__UPDATE_COLORSCHEMES VIM__UPDATE_COLORSCHEMES
VIM__INSTALL_VUNDLE_PLUGINS VIM__INSTALL_VUNDLE_PLUGINS
VIM__CREATE_PANE_DEFAULT_APP VIM__CREATE_PANE_DEFAULT_APP
@ -31,31 +30,6 @@ function VIM__SOURCE_RC() {
} }
} }
function VIM__SET_LOCAL_CONFIG() {
local DEFAULT_CONFIG="$DOTWRYN_PATH/env/env.vim"
local LOCAL_CONFIG="$HOME/.config/wryn/env/env.vim"
[ -f $LOCAL_CONFIG ] && {
WARNING "local vim env configuration ($LOCAL_CONFIG)"
USER_PROMPT 'overwrite? [y/N]'
READ_K yn
[[ $yn =~ ^[yY] ]] && {
CHECK "backing up local copy ($LOCAL_CONFIG.bak)"
mv "$LOCAL_CONFIG" "$LOCAL_CONFIG.bak" && OK || WARN
} || {
STATUS 'skipping'
return
}
}
CHECK "setting vim configuration file ($LOCAL_CONFIG)"
{
echo "source $DEFAULT_CONFIG"
echo -e '\n"\n" .wryn configuration overrides\n"\n'
sed 's/["]*\(.*\)/"\1/' $DEFAULT_CONFIG
} > $LOCAL_CONFIG && OK || WARN
}
function VIM__UPDATE_COLORSCHEMES() { function VIM__UPDATE_COLORSCHEMES() {
CHECK 'updating colorschemes' CHECK 'updating colorschemes'
$DOTWRYN_PATH/bin/vim/update_colorschemes >>$LOG 2>&1\ $DOTWRYN_PATH/bin/vim/update_colorschemes >>$LOG 2>&1\

View File

@ -3,7 +3,6 @@
function ZSH__SETUP() { function ZSH__SETUP() {
ZSH__SET_DEFAULT_SHELL ZSH__SET_DEFAULT_SHELL
ZSH__SOURCE_RC ZSH__SOURCE_RC
ZSH__SET_LOCAL_CONFIG
} }
##################################################################### #####################################################################
@ -27,28 +26,3 @@ function ZSH__SOURCE_RC() {
&& OK || WARN && OK || WARN
} }
} }
function ZSH__SET_LOCAL_CONFIG() {
local DEFAULT_CONFIG="$DOTWRYN_PATH/env/env.zsh"
local LOCAL_CONFIG="$HOME/.config/wryn/env/env.zsh"
[ -f $LOCAL_CONFIG ] && {
WARNING "local zsh env configuration ($LOCAL_CONFIG)"
USER_PROMPT 'overwrite? [y/N]'
READ_K yn
[[ $yn =~ ^[yY] ]] && {
CHECK "backing up local copy ($LOCAL_CONFIG.bak)"
mv "$LOCAL_CONFIG" "$LOCAL_CONFIG.bak" && OK || WARN
} || {
STATUS 'skipping'
return
}
}
CHECK "setting zsh configuration file ($LOCAL_CONFIG)"
{
echo "source $DEFAULT_CONFIG"
echo -e '\n#\n# .wryn configuration overrides\n#\n'
sed 's/^[^#].*/#&/' $DEFAULT_CONFIG
} > $LOCAL_CONFIG && OK || WARN
}