Compare commits
No commits in common. "1fb4bcac81400eea02fc875ac9aeed7c8f307cb8" and "da921ae09a8504589fac36ab307713191254d0d3" have entirely different histories.
1fb4bcac81
...
da921ae09a
3 changed files with 2 additions and 46 deletions
15
README.md
15
README.md
|
@ -103,21 +103,6 @@ Install a systemd service as user, can be useful for timers for example :
|
||||||
service_install "services/myservice.service" 1
|
service_install "services/myservice.service" 1
|
||||||
```
|
```
|
||||||
|
|
||||||
### define_env
|
|
||||||
|
|
||||||
Define an evirnment variable into the file `~/.config/environment`, you have to
|
|
||||||
source this file on your `.bashrc` or your `.zprofile`.
|
|
||||||
|
|
||||||
- **input*** :
|
|
||||||
- `$1` : name of the variable
|
|
||||||
- `$2` : value, `""` if empty
|
|
||||||
- **output** : no value, but exit the function if the variale is already
|
|
||||||
defined (install) or not in file (uninstall)
|
|
||||||
|
|
||||||
```
|
|
||||||
define_env "NOTMUCH_CONFIG" "~/.config/notmuch"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Avaible variables
|
### Avaible variables
|
||||||
|
|
||||||
- `$repository` : the root folder of the repository
|
- `$repository` : the root folder of the repository
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# This is an example of a bootstrap file for mail dotfile
|
# this is an example of a bootstrap file for mail dotfile
|
||||||
# here is the strucure of files :
|
# here is the strucure of files :
|
||||||
#
|
#
|
||||||
# .
|
# .
|
||||||
|
@ -37,6 +37,3 @@ install_service "services/mail.timer" 1
|
||||||
|
|
||||||
# Symblink an executable to $HOME\.local\bin\
|
# Symblink an executable to $HOME\.local\bin\
|
||||||
install_bin "bin/check_mails.sh"
|
install_bin "bin/check_mails.sh"
|
||||||
|
|
||||||
# Define the environment variable for Notmuch
|
|
||||||
define_env "NOTMUCH_CONFIG" "~/.config/notmuch"
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ BIN_DIRECTORY="${HOME}/.local/bin/"
|
||||||
LIB_DIRECTORY="${HOME}/.local/lib/"
|
LIB_DIRECTORY="${HOME}/.local/lib/"
|
||||||
SYD_DIRECTORY="${HOME}/.config/systemd/user"
|
SYD_DIRECTORY="${HOME}/.config/systemd/user"
|
||||||
DOTREPO="${HOME}/.config/dotrepo/"
|
DOTREPO="${HOME}/.config/dotrepo/"
|
||||||
ENV_FILE="${HOME}/.config/environment"
|
|
||||||
|
|
||||||
# DEFAULT VALUES
|
# DEFAULT VALUES
|
||||||
OVERWRITE_DIRECTORY=0
|
OVERWRITE_DIRECTORY=0
|
||||||
|
@ -281,32 +281,6 @@ install_bin ()
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
define_env ()
|
|
||||||
{
|
|
||||||
# Put a couple name value into $ENV_FILE file or remove it
|
|
||||||
# on uninstall mode
|
|
||||||
# $1 variable name
|
|
||||||
# $2 value
|
|
||||||
|
|
||||||
[ -z $1 ] && { error "You must define a name"; return; }
|
|
||||||
[ ! -f $ENV_FILE ] && touch $ENV_FILE
|
|
||||||
if [ $install -eq 1 ]
|
|
||||||
then
|
|
||||||
printf "\nCreate an environment variable %s : " "$1"
|
|
||||||
[ $(grep -c -m 1 $1 $ENV_FILE) -eq 1 ] && { error "already exist"; return; }
|
|
||||||
local line
|
|
||||||
line="export ${1}=\"${2}\""
|
|
||||||
echo "$line" >> $ENV_FILE
|
|
||||||
printf "\e[32mdone\e[0m\n"
|
|
||||||
else
|
|
||||||
printf "\nRemove an environment variable %s : " "$1"
|
|
||||||
[ $(grep -c -m 1 $1 $ENV_FILE) -eq 0 ] && { error "not exist"; return; }
|
|
||||||
sed -i "/^export $1=*/d" $ENV_FILE
|
|
||||||
printf "\e[32mdone\e[0m\n"
|
|
||||||
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
## create bin directory
|
## create bin directory
|
||||||
[ ! -d $BIN_DIRECTORY ] && mkdir -p $BIN_DIRECTORY || printf "bin exist\n"
|
[ ! -d $BIN_DIRECTORY ] && mkdir -p $BIN_DIRECTORY || printf "bin exist\n"
|
||||||
|
|
||||||
|
|
Reference in a new issue