From: Armaan Bhojwani <3fb650a9-b47e-4604-a282-1dd91953b2ee@anonaddy.me> Date: Sun, 20 Sep 2020 22:26:33 +0000 (-0400) Subject: switched to using makefile, and ~/.cache instead of /tmp X-Git-Url: https://git.armaanb.net/?p=charsel.git;a=commitdiff_plain;h=66274bfc3aab75ab79d5325d1219dfbdc91e790f switched to using makefile, and ~/.cache instead of /tmp --- diff --git a/INSTALL b/INSTALL deleted file mode 100755 index 74dd1d8..0000000 --- a/INSTALL +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/env sh -# Make the folder in /tmp and make sure that it is writeable -mkdir /tmp/charsel/ -chmod 777 /tmp/charsel/ - -# Makes charsel executeable -chmod +x src/charsel - -# Makes local folder -mkdir -p ~/.local/share/charsel/charfiles/ - -# 2 sets of commands for whether it is root or not -if [ `whoami` == root ]; then - mkdir -p /usr/share/charsel/charfiles/ - cp charfiles/* /usr/share/charsel/charfiles/ - mkdir /usr/share/doc/charsel - cp README.md /usr/share/doc/charsel/ - cp src/motd /usr/share/charsel - cp src/charsel /usr/bin/ - exit -else - cp charfiles/* ~/.local/share/charsel/charfiles/ - cp src/motd ~/.local/share/charsel/ - cp src/charsel ~/.local/bin/ - exit -fi diff --git a/README.md b/README.md index a6d2af2..c5aaa70 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,8 @@ A very simple shell script to make copying frequently used special characters to It uses a plain-text file known as a "charfile" to define shortcuts to special characters that are easy to access on the keyboard. ## Installation -Running the INSTALL shell script should work fine for most people, or you could manually copy the files into place using it as a template. - -If it is run as root or with sudo, the program and charfiles will be installed for all users. If it is run without elevated privileges, it will just be installed for the local user. +Run `make install` as root to install +Run `make uninstall` as root to remove. Will not delete your personal charfiles ## Dependencies * Posix shell diff --git a/src/charsel b/src/charsel index 80909d3..6713b59 100755 --- a/src/charsel +++ b/src/charsel @@ -15,7 +15,8 @@ #!/usr/bin/env sh # Merge both global and local charfiles -CHARDIR=/tmp/charsel +CHARDIR=~/.cache/charsel +mkdir $CHARDIR/ cp -R /usr/share/charsel/* $CHARDIR/ cp -R ~/.local/share/charsel/* $CHARDIR/ @@ -39,7 +40,7 @@ CHARFILE=$CHARDIR/charfiles/$1 LENGTH=$(cat $CHARFILE | cut -f 1 -d ',' -s | wc -L | cut -b 1) # MOTD -cat /tmp/charsel/motd +cat $CHARDIR/motd # Main program while :