github.com/e154/smart-home@v0.17.2-0.20240311175135-e530a6e5cd45/bin/server (about) 1 # This file is part of the Smart Home 2 # Program complex distribution https://github.com/e154/smart-home 3 # Copyright (C) 2016-2023, Filippov Alex 4 # 5 # This library is free software: you can redistribute it and/or 6 # modify it under the terms of the GNU Lesser General Public 7 # License as published by the Free Software Foundation; either 8 # version 3 of the License, or (at your option) any later version. 9 # 10 # This library is distributed in the hope that it will be useful, 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 # Library General Public License for more details. 14 # 15 # You should have received a copy of the GNU Lesser General Public 16 # License along with this library. If not, see 17 # <https://www.gnu.org/licenses/>. 18 19 #!/bin/sh 20 21 FILENAME=$0 22 BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}")" && pwd)" 23 24 COMMAND=$* 25 OS_TYPE="unknown" 26 OS_ARCH="unknown" 27 28 UNAME=`which uname` 29 30 if [ -z "$UNAME" ]; then 31 # message "Required tools are missing - check beginning of \"$0\" file for details." 32 exit 1 33 fi 34 35 #cd ${BASEDIR} 36 37 main() { 38 39 __check_os 40 41 exec ${FILENAME}-${OS_TYPE}-${OS_ARCH} ${COMMAND} 42 } 43 44 __check_os() { 45 46 # get os type 47 case `${UNAME} -s` in 48 (Linux) 49 OS_TYPE="linux" 50 ;; 51 (Darwin) 52 OS_TYPE="darwin-10.6" 53 ;; 54 esac 55 56 # get os arch 57 case `${UNAME} -m` in 58 (x86_64) 59 OS_ARCH="amd64" 60 ;; 61 (386) 62 OS_ARCH="386" 63 ;; 64 (armv7l) 65 OS_ARCH="arm-7" 66 ;; 67 (aarch64) 68 OS_ARCH="arm-7" 69 ;; 70 (armv64l) 71 OS_ARCH="arm-64" 72 ;; 73 (armv6l) 74 OS_ARCH="arm-6" 75 ;; 76 (armv5l) 77 OS_ARCH="arm-5" 78 ;; 79 (mip64) 80 OS_ARCH="mip64" 81 ;; 82 (mip64le) 83 OS_ARCH="mip64le" 84 ;; 85 (arm64) 86 OS_ARCH="arm64" 87 ;; 88 esac 89 } 90 91 main