Skip to content
Extraits de code Groupes Projets
Vérifiée Valider 1577d388 rédigé par salixor's avatar salixor
Parcourir les fichiers

stpkg: Make it possible to provide alternative port for sshfs

parent ebc4c57e
Aucune étiquette associée trouvée
1 requête de fusion!5stpkg: Make it possible to provide alternative port for sshfs
...@@ -101,7 +101,7 @@ __usage() { ...@@ -101,7 +101,7 @@ __usage() {
echo `__bold "$BASE_NAME usage:"` echo `__bold "$BASE_NAME usage:"`
local BASE_NAME=`__green "$BASE_NAME"` local BASE_NAME=`__green "$BASE_NAME"`
cat << EOF cat << EOF
$BASE_NAME -install [`__yellow "-sshfs 'username@server' -local mnt_point -pickerrepo 'foo@git.fr:stickerpicker.git'"`] [`__yellow "install_path"`] $BASE_NAME -install [`__yellow "-sshfs 'username@server' -port '22' -local mnt_point -pickerrepo 'foo@git.fr:stickerpicker.git'"`] [`__yellow "install_path"`]
$BASE_NAME show $BASE_NAME show
$BASE_NAME help $BASE_NAME help
$BASE_NAME update $BASE_NAME update
...@@ -272,16 +272,21 @@ __install() { ...@@ -272,16 +272,21 @@ __install() {
local SSHFS="$2" local SSHFS="$2"
shift 2 shift 2
;; ;;
-port)
local SSHFS_PORT="$2"
shift 2
;;
-local) -local)
local MNT="$2" local MNT="$2"
shift 2 shift 2
;; ;;
*) *)
local PARSE_FLAGS=0 local PARSE_FLAGS=0
;; ;;
esac esac
done done
STPKG_STICKER_REPO=${STPKG_STICKER_REPO:="https://github.com/maunium/stickerpicker.git"} STPKG_STICKER_REPO=${STPKG_STICKER_REPO:="https://github.com/maunium/stickerpicker.git"}
SSHFS_PORT=${SSHFS_PORT:="22"}
# Create the ~/.config/stpkg.sh # Create the ~/.config/stpkg.sh
[ ! -d ~/.config ] && mkdir ~/.config [ ! -d ~/.config ] && mkdir ~/.config
...@@ -313,18 +318,18 @@ EOF ...@@ -313,18 +318,18 @@ EOF
local STPKG_INSTALL=$MNT${STPKG_INSTALL:="/html/stickerpicker/"} local STPKG_INSTALL=$MNT${STPKG_INSTALL:="/html/stickerpicker/"}
# The sshfs hook # The sshfs hook
cat >> $STPKG_CONF_FILE << EOF cat >> $STPKG_CONF_FILE << EOF
STPKG_SSHFS='yes' STPKG_SSHFS='yes'
STPKG_INSTALL="$STPKG_INSTALL" STPKG_INSTALL="$STPKG_INSTALL"
SSHFS_USER="$SSHFS" SSHFS_USER="$SSHFS"
SSHFS_MNT="`echo "$MNT" | sed "s+$HOME+~+g"`" SSHFS_MNT="`echo "$MNT" | sed "s+$HOME+~+g"`"
fi fi
__do_mount() { __do_mount() {
mountpoint $MNT >/dev/null 2>&1 mountpoint $MNT >/dev/null 2>&1
[ \$? -ne 0 -a ! "x\$INSTALL" = "xyes" ] && { [ \$? -ne 0 -a ! "x\$INSTALL" = "xyes" ] && {
[ ! -d "\$STPKG_INSTALL" ] && { [ ! -d "\$STPKG_INSTALL" ] && {
sshfs $SSHFS: $MNT \ sshfs $SSHFS: -p $SSHFS_PORT $MNT \
|| die "Failed to mount $SSHFS:~/ to $MNT"; || die "Failed to mount $SSHFS:~/ to $MNT";
} }
[ ! -d "\$STPKG_INSTALL" ] \ [ ! -d "\$STPKG_INSTALL" ] \
...@@ -338,7 +343,7 @@ EOF ...@@ -338,7 +343,7 @@ EOF
mkdir "$MNT" mkdir "$MNT"
mountpoint $MNT >/dev/null 2>&1 mountpoint $MNT >/dev/null 2>&1
[ $? -eq 0 ] && die "The '$MNT' folder is already a mountpoint" [ $? -eq 0 ] && die "The '$MNT' folder is already a mountpoint"
sshfs $SSHFS: $MNT || die "Failed to mount $SSHFS:~/ to $MNT" sshfs $SSHFS: -p $SSHFS_PORT $MNT || die "Failed to mount $SSHFS:~/ to $MNT"
else else
local STPKG_INSTALL=$1 local STPKG_INSTALL=$1
local STPKG_INSTALL=${STPKG_INSTALL:="~/html/stickerpicker/"} local STPKG_INSTALL=${STPKG_INSTALL:="~/html/stickerpicker/"}
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter