From 408af9c38289b222ceda2875c34354c51676e346 Mon Sep 17 00:00:00 2001 From: Kubat <mael.martin31@gmail.com> Date: Wed, 2 Dec 2020 20:41:06 +0100 Subject: [PATCH] Update the readme and the stphg script --- README.md | 8 ++++++ stpkg | 77 ++++++++++++++++++++++++++----------------------------- 2 files changed, 45 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 255ead4..9170473 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,8 @@ Pour cela: ```bash cd matrix-stickers ./stpkg -install + # ou pour une installation avec sshfs (cf "Utilisation de stpkg") + ./stpkg -install -sshfs nomAAAA@perso.iiens.net -local ~/mnt/perso ``` 4. Se connecter à Element. Utiliser la commande `/devtools` dans n'importe quel tchat.  @@ -219,3 +221,9 @@ Les commandes de `stpkg` : utiliser les options `-sshfs <ssh address> -local <point de montage locale>`. Veillez noter que si vous utilisez l'option `-sshfs`, l'option `folder` pointera sur un dossier *sur perso*. + +Voici un exemple d'installation avec sshfs, où votre repo est sur votre ordi et +les stickers sur perso : +```bash +./stpkg -install -sshfs nomAAAA@perso.iiens.net -local ~/mnt/perso +``` diff --git a/stpkg b/stpkg index 526376f..4d2b70a 100755 --- a/stpkg +++ b/stpkg @@ -2,7 +2,6 @@ STPKG_CONF_FILE=~/.config/stpkg.sh BASE_DIR="$PWD" -DISPLAY_DEPS_NOTES="yes" # Detect install if [ "x$1" = "x-install" ]; then @@ -38,11 +37,42 @@ die() { exit 1 } +# Be paranoid +REQUIREMENTS="" +require() { + local __cmd=`which $1` + [ $? -ne 0 ] && die "Failed to find the '$1' command" + alias $1=$__cmd + REQUIREMENTS="$1 $REQUIREMENTS" +} +require column +require uuidgen +require convert +require montage +require identify +require python +require curl +require sed +require tr +require git +require sponge +require ls +require find +require jq +require chmod +__grep=`which egrep` +if [ $? -ne 0 ]; then + __grep=`which grep` + [ $? -ne 0 ] && die "Failed to find 'grep' or 'egrep'" + warn "Cound not find 'grep', will use 'egrep 'instead" +fi +alias grep=$__grep + # Source conf file, may have the sshfs hook [ -f $STPKG_CONF_FILE ] && source $STPKG_CONF_FILE if [ "x$STPKG_NO_MSG" = "xyes" ]; then - error() { return 0; } + # Do not silence errors warn() { return 0; } info() { return 0; } fi @@ -92,27 +122,18 @@ cat << EOF path is ~/html/stickerpicker. This command will give you a STPKG_INSTALL and a STPKG_BASE env that you must put in your bashrc for the rest of the stpkg commands to work. -EOF - - if [ "x$DISPLAY_DEPS_NOTES" = "xyes" ]; then -cat << EOF `__bold Requirements:` The stpkg command requires 'jq' and 'egrep'. If 'egrep' is not found, 'grep' will be used. 'git' is obviously required, but if you are using this repo you should have clone it so it's ok. -EOF - fi + Here is a list of all the requirements: + $REQUIREMENTS +EOF exit 0 } -require() { - local __cmd=`which $1` - [ $? -ne 0 ] && die "Failed to find the '$1' command" - alias $1=$__cmd -} - slugify() { echo "$1" | \ iconv -c -t ascii//TRANSLIT | \ @@ -125,23 +146,6 @@ default_index() { \"packs\": [ \"scalar-privacy_pam.json\" ] }" } -# Be paranoid -require column -require uuidgen -require convert -require montage -require identify -require python -require curl -require sed -require tr -require git -require sponge -require ls -require find -require jq -require chmod - ################################ # The special install function # ################################ @@ -197,6 +201,8 @@ fi EOF # Do the sshfs hook + [ -f "$MNT" ] && die "The destination mount pount already exists" + mkdir "$MNT" mountpoint $MNT >/dev/null 2>&1 [ $? -eq 0 ] && die "The '$MNT' folder is already a mountpoint" sshfs $SSHFS: $MNT || die "Failed to mount $SSHFS:~/ to $MNT" @@ -250,15 +256,6 @@ if [ "x$STPKG_BASE" = "x" ]; then "It should have been given by the install script" fi -__grep=`which egrep` -if [ $? -ne 0 ]; then - __grep=`which grep` - [ $? -ne 0 ] && die "Failed to find 'grep' or 'egrep'" - warn "Cound not find 'grep', will use 'egrep 'instead" -fi -alias grep=$__grep -DISPLAY_DEPS_NOTES="no" - ######################### # Cmd handler functions # ######################### -- GitLab