Skip to content

Commit

Permalink
Create jrnl default config and journals in ascinit correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
doctorfree committed May 31, 2022
1 parent 4a151e2 commit 1459dc5
Showing 1 changed file with 23 additions and 15 deletions.
38 changes: 23 additions & 15 deletions bin/ascinit
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,29 @@ pip list | grep asciimatics > /dev/null || python3 -m pip install asciimatics
pip list | grep rainbowstream > /dev/null || python3 -m pip install rainbowstream
pip list | grep tuir > /dev/null || python3 -m pip install tuir

# Custom jrnl configuration for this user unless one exists
[ -d ${CONFDIR}/jrnl ] && {
if [ -d ${HOME}/.config/jrnl ]
then
for jc in ${CONFDIR}/jrnl/*
do
[ "${jc}" == "${CONFDIR}/jrnl/*" ] && continue
bj=`basename ${jc}`
[ -f ${HOME}/.config/jrnl/${bj} ] || cp ${jc} ${HOME}/.config/jrnl/${bj}
done
else
cp -a ${CONFDIR}/jrnl ${HOME}/.config/jrnl
fi
[ -d ${HOME}/.local/share/jrnl ] || {
[ -d ${HOME}/.local ] || mkdir ${HOME}/.local
[ -d ${HOME}/.local/share ] || mkdir ${HOME}/.local/share
mkdir ${HOME}/.local/share/jrnl
}
touch ${HOME}/.local/share/jrnl/journal.txt
chmod 600 ${HOME}/.local/share/jrnl/journal.txt
touch ${HOME}/.local/share/jrnl/asciiville.txt
chmod 600 ${HOME}/.local/share/jrnl/asciiville.txt
}
# Install the 'jrnl' command if not already installed
have_jrnl=`type -p jrnl`
[ "${have_jrnl}" ] || {
Expand All @@ -399,21 +422,6 @@ have_jrnl=`type -p jrnl`
python3 -m pip install --user pipx 2> /dev/null
python3 -m pipx ensurepath 2> /dev/null
}
# Custom jrnl configuration for this user unless one exists
[ -d ${CONFDIR}/jrnl ] && {
[ -d ${HOME}/.config/jrnl ] || {
cp -a ${CONFDIR}/jrnl ${HOME}/.config/jrnl
[ -d ${HOME}/.local/share/jrnl ] || {
[ -d ${HOME}/.local ] || mkdir ${HOME}/.local
[ -d ${HOME}/.local/share ] || mkdir ${HOME}/.local/share
mkdir ${HOME}/.local/share/jrnl
touch ${HOME}/.local/share/jrnl/journal.txt
chmod 600 ${HOME}/.local/share/jrnl/journal.txt
touch ${HOME}/.local/share/jrnl/asciiville.txt
chmod 600 ${HOME}/.local/share/jrnl/asciiville.txt
}
}
}
pipx install jrnl 2> /dev/null
echo "Welcome to @jrnl" > /tmp/jrnl$$
echo "" >> /tmp/jrnl$$
Expand Down

0 comments on commit 1459dc5

Please sign in to comment.