Books/.Books/upload.sh

17 lines
450 B
Bash
Executable File

#!/usr/bin/env bash
BOOK_DIR="$(cat $HOME/.Books/bookdir)"
cd $BOOK_DIR
git add .
if (git log --oneline | grep autosave &>/dev/null); then # autosaves exist
firstautosavecommit=$(git log --oneline | grep autosave | tail -n1 | cut -d\ -f1)
git reset --soft ${firstautosavecommit}~1
fi
git commit -m "Uploaded at $(date) from $(hostname)"
git push
if [[ -e "$HOME/.Books/local.d/postupload.sh" ]]; then
$HOME/.Books/local.d/postupload.sh
fi