fix termux

This commit is contained in:
thek4n 2024-07-23 00:17:41 +03:00
parent 7673e7f0ca
commit a44f38820e
2 changed files with 20 additions and 9 deletions

22
install
View File

@ -1,24 +1,29 @@
#!/bin/bash #!/usr/bin/env bash
set -ueo pipefail set -ueo pipefail
shopt -s nullglob shopt -s nullglob
declare -r TARGET_PATH="$HOME" declare -r TARGET_PATH="$HOME"
declare -r DOTFILES_ROOT="$PWD"
_detect_current_script_real_directory() {
realpath -e -- "$(dirname -- "$(readlink -e -- "${BASH_SOURCE[0]:-$0}")")"
}
declare DOTFILES_ROOT
DOTFILES_ROOT="$(_detect_current_script_real_directory)"
readonly DOTFILES_ROOT
declare -xr SUB="$DOTFILES_ROOT/home/user" declare -xr SUB="$DOTFILES_ROOT/home/user"
source "$DOTFILES_ROOT/TARGETS.sh"
_die() { _die() {
echo "$0: $1" >&2 echo "$0: $1" >&2
exit $2 exit $2
} }
test "$0" = "./install" || _die "Error: Please, run this file from root of dotfiles, like this './install.sh TARGET" 1
source "$DOTFILES_ROOT/TARGETS.sh"
_link_files_in_sandbox() { _link_files_in_sandbox() {
local targetfile local targetfile
for targetfile in "$@" for targetfile in "$@"
@ -60,6 +65,7 @@ __install_from_sandbox() {
} }
_execute_hook_if_executable() { _execute_hook_if_executable() {
# all hooks gets SUB and SANDBOX_PATH env variables
local hook_path="$DOTFILES_ROOT/install-hooks/$1/$2" local hook_path="$DOTFILES_ROOT/install-hooks/$1/$2"
if [ -x "$hook_path" ]; then if [ -x "$hook_path" ]; then
echo "Executing $2 for target '$1'" echo "Executing $2 for target '$1'"

7
install-hooks/termux/post-install Normal file → Executable file
View File

@ -1,3 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
cp -r home/user/.shortcuts "$HOME"
if [[ -d "$HOME/.shortcuts" ]]; then
cp "$SUB/.shortcuts/*" "$HOME/.shortcuts"
else
cp -r "$SUB/.shortcuts" "$HOME"
fi