Compare commits
No commits in common. "cd1d73174fcb2d0b8c53de4184ff42d25fac5ddf" and "d5ed3d209d110fa9e1f703370b370a1dcb65adff" have entirely different histories.
cd1d73174f
...
d5ed3d209d
3 changed files with 10 additions and 14 deletions
|
@ -42,7 +42,7 @@ dotinstall:
|
||||||
|
|
||||||
### functions
|
### functions
|
||||||
|
|
||||||
#### required_commands
|
#### bin_check
|
||||||
|
|
||||||
This function check if binary file is avaible in the `PATH`.
|
This function check if binary file is avaible in the `PATH`.
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
# └── mail.timer
|
# └── mail.timer
|
||||||
|
|
||||||
# check required executables
|
# check required executables
|
||||||
required_commands "neomutt notmuch mbsync afew msmtp"
|
check_bin "neomutt notmuch mbsync afew msmtp"
|
||||||
|
|
||||||
# symblink folder which contains configurations folders to $HOME/.config/
|
# symblink folder which contains configurations folders to $HOME/.config/
|
||||||
process_dirs config ${HOME}/.config
|
process_dirs config ${HOME}/.config
|
||||||
|
|
|
@ -181,10 +181,9 @@ process_dirs () {
|
||||||
# $2: destination directory
|
# $2: destination directory
|
||||||
|
|
||||||
local dest="${repository}/$1"
|
local dest="${repository}/$1"
|
||||||
local source="$2"
|
printf "\nProcess directory %s\n" "$1"
|
||||||
printf "\nProcess directory %s\n" "$source"
|
|
||||||
|
|
||||||
[ ! -d "$source" ] && { error " -> source is not a directory"; return; }
|
[ ! -d "$dest" ] && { error " -> source is not a directory $dest"; return; }
|
||||||
[ ! -d "$dest" ] && { error " -> destination is not a directory"; return; }
|
[ ! -d "$dest" ] && { error " -> destination is not a directory"; return; }
|
||||||
|
|
||||||
while read d
|
while read d
|
||||||
|
@ -264,13 +263,11 @@ install_service ()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
required_commands ()
|
check_bin ()
|
||||||
{
|
{
|
||||||
# Check if an executable exist
|
# Check if an executable exist
|
||||||
# $1 executables separated with spaces
|
# $1 executables separated with spaces
|
||||||
|
|
||||||
# if uninstall, we don't need to process required commands.
|
|
||||||
[ $install -eq 0 ] && return
|
|
||||||
printf "Checking required programs :\n"
|
printf "Checking required programs :\n"
|
||||||
for p in $1
|
for p in $1
|
||||||
do
|
do
|
||||||
|
@ -327,10 +324,9 @@ define_env ()
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
## create bin and cache direcories
|
## create bin directory
|
||||||
[ ! -d $BIN_DIRECTORY ] && mkdir -p $BIN_DIRECTORY
|
[ ! -d $BIN_DIRECTORY ] && mkdir -p $BIN_DIRECTORY || printf "bin exist\n"
|
||||||
[ ! -d $CACHE_DIR ] && mkdir -p $CACHE_DIR
|
[ ! -d $CACHE_DIR ] && mkdir -p $CACHE_DIR || printf "cache exist\n"
|
||||||
|
|
||||||
# define mode : install, uninstall or update
|
# define mode : install, uninstall or update
|
||||||
case $1 in
|
case $1 in
|
||||||
"uninstall")
|
"uninstall")
|
||||||
|
@ -371,6 +367,7 @@ fi
|
||||||
[ ! -f "$bootstrap_file" ] && die "$bootstrap_file does not exist" 2 1
|
[ ! -f "$bootstrap_file" ] && die "$bootstrap_file does not exist" 2 1
|
||||||
|
|
||||||
private:get_bootstrap_path "$bootstrap_file"
|
private:get_bootstrap_path "$bootstrap_file"
|
||||||
|
|
||||||
cache_file="${CACHE_DIR}/$(echo $repository | tr '/' '_')"
|
cache_file="${CACHE_DIR}/$(echo $repository | tr '/' '_')"
|
||||||
|
|
||||||
if [ $update -eq 1 ]
|
if [ $update -eq 1 ]
|
||||||
|
@ -383,8 +380,7 @@ then
|
||||||
printf "There is no difference between cached copy and the bootstrap file\n";
|
printf "There is no difference between cached copy and the bootstrap file\n";
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
# for updating the dotfile repo, we need to uninstall it then
|
# Uninstall old files
|
||||||
# install it. We need the cached copy for unistall.
|
|
||||||
install=0
|
install=0
|
||||||
source "$cache_file"
|
source "$cache_file"
|
||||||
rm "$cache_file"
|
rm "$cache_file"
|
Reference in a new issue