initial project scheme

This commit is contained in:
0x6775737461 2022-08-12 15:58:41 -04:00
parent 42953c2f94
commit 26536a829c
3 changed files with 62 additions and 0 deletions

56
src/config.sh Executable file
View File

@ -0,0 +1,56 @@
#!/usr/bin/env bash
config_path() {
: ''' [func scope]
configure the path/dirs to use the tool
'''
local bin_path="${HOME}/.local/bin/coragyps"
# var used to store user answer.
local answer=''
test -d "$bin_path" && {
echo "dir exists, do you want to replace them?"
# the user should answer 'y' or 'n' only.
while [[ ! "$answer" =~ [yYnN] ]]; do
read -p '[yY / nN] ' answer
done
test "$answer" == 'y' && {
# at the moment bin path is configured,
# now we should insert the tool at the dir
rm -rf "$bin_path"
}
}
mkdir -p "$bin_path"
insert_bin
}
insert_bin() {
: ''' [func scope]
copy all necessary data to use the tool
'''
local bin_path="${HOME}/.local/bin/coragyps"
local bashrc="${HOME}/.bashrc"
local new_path_cmd="export PATH=\"\${PATH}:${bin_path}\""
#TODO: test if file exists
cp coragyps.sh "${bin_path}/coragyps"
# enabling the tool on shell
#TODO: check if tool path is on the bashrc file
echo "$new_path" >> "$bashrc"
source "$bashrc"
exit 0
}
main() {
config_path
}
main "$@"

3
src/coragyps.sh Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
echo 'Hello World :)'

3
src/modules/recon/env_vars.sh Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
echo 'useless for now!'