#!/bin/bash # ---------------------------------------------------------------------- # File: mount.eosx # Author: Andreas-Joachim Peters - CERN # ---------------------------------------------------------------------- # ************************************************************************ # * EOS - the CERN Disk Storage System * # * Copyright (C) 2017 CERN/Switzerland * # * * # * This program is free software: you can redistribute it and/or modify * # * it under the terms of the GNU General Public License as published by * # * the Free Software Foundation, either version 3 of the License, or * # * (at your option) any later version. * # * * # * This program is distributed in the hope that it will be useful, * # * but WITHOUT ANY WARRANTY; without even the implied warranty of * # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * # * GNU General Public License for more details. * # * * # * You should have received a copy of the GNU General Public License * # * along with this program. If not, see .* # ************************************************************************ case $1 in -h|--help|-?) echo "mount.eosxd is a private mount(8) wrapper for eosxd/EOS." echo "Don't use it directly!" exit 1 ;; esac restricted=1 if [ $UID -eq 0 ] && [ $UID -eq $EUID ]; then restricted=0 fi EOSXD="/usr/bin/eosxd" if [ -e "/etc/sysconfig/eosxd" ]; then . /etc/sysconfig/eosxd fi # mount(8) in restricted mode (for non-root users) does not allow to use any # mount options, # we fail for users if [ $restricted -eq 1 ]; then echo "error: non-root mount attempted !" exit -1; fi if [ -z "$1" ]; then echo "error: please provide the name of your FUSE mount !" exit -1; fi shift options=() eoo=0 # filter out '-n ' which is passwd by automount if /etc/mtab is a symlink into /proc while [[ $1 ]] do if ! ((eoo)); then case "$1" in -n) shift ;; *) options+=("$1") shift ;; esac else options+=("$1") # Another (worse) way of doing the same thing: # options=("${options[@]}" "$1") shift fi done echo ${options[@]} $EOSXD ${options[@]} -oautofs >& /dev/null < /dev/zero