aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjason2024-08-30 09:41:44 -0600
committerjason2024-08-30 09:41:44 -0600
commit67c2c0f6f62f19b0feedf13f991891ddcf1dbf6b (patch)
tree8a07297bba8c3c7d81bb34f8c21ac147f0dc0d2e
parent9642b052a83ee89a04f869f1a9590dcc778dd0db (diff)
downloaddotfiles-67c2c0f6f62f19b0feedf13f991891ddcf1dbf6b.tar.gz
dotfiles-67c2c0f6f62f19b0feedf13f991891ddcf1dbf6b.zip
add fossil init helper funciton
-rw-r--r--bash/.bashrc52
1 files changed, 52 insertions, 0 deletions
diff --git a/bash/.bashrc b/bash/.bashrc
index 51ee105..421ce28 100644
--- a/bash/.bashrc
+++ b/bash/.bashrc
@@ -394,5 +394,57 @@ if [[ $(type -t __git_ps1) == function ]]; then
394 # DISABLED because this doesn't work with $(show_virtualenv) 394 # DISABLED because this doesn't work with $(show_virtualenv)
395 #export PROMPT_COMMAND="__git_ps1 '${PS1}' '${END_PS1}'; ${PROMPT_COMMAND}" 395 #export PROMPT_COMMAND="__git_ps1 '${PS1}' '${END_PS1}'; ${PROMPT_COMMAND}"
396fi 396fi
397
398# Helper Functions
399at-finit() {
400 local OPTIND name adminuser password
401 while getopts "n:u:" opt; do
402 case $opt in
403 n)
404 name=$OPTARG
405 ;;
406 u)
407 adminuser=$OPTARG
408 ;;
409 \?)
410 # quit on arg error
411 return 1
412 ;;
413 esac
414 done
415
416 if [ -z "$name" ]; then
417 echo "-n required"
418 return 1
419 fi
420 if [ -z "$adminuser" ]; then
421 echo "-u required"
422 return 1
423 fi
424
425 repopath="$HOME/Code/Museum/$name.fossil"
426 printf "path is: $repopath\n"
427
428 stty -echo
429 printf "Set admin password: "
430 read password
431 stty echo
432 printf "\n"
433
434 fossil init --template $HOME/Sync/Files/template-repo-v1.fossil --admin-user "$adminuser" "$repopath" > /dev/null
435 fossil user -R $repopath password $adminuser $password
436
437 chmod 0664 $repopath
438 rsync --perms $repopath jason@depot.waldorf._.antitech.org:/var/www/htdocs/depot.antitech.org
439 chmod 0644 $repopath
440
441 urluser=$(echo $adminuser | jq "@uri" -jRr)
442 urlpasswd=$(echo $password | jq "@uri" -jRr)
443 echo "Defining remote..."
444 fossil remote-url -R $repopath https://$urluser:$urlpasswd@depot.antitech.org/$name
445
446 printf "\nSuccess. View your public repository at https://depot.antitech.org/${name}/\n"
447}
448
397# Close off the PS1 with the $ 449# Close off the PS1 with the $
398PS1=${PS1}${END_PS1} 450PS1=${PS1}${END_PS1}