From 28ea452e4af480344d7de39a004bbdd34955e173 Mon Sep 17 00:00:00 2001 From: Lars Berning <151194+laberning@users.noreply.github.com> Date: Tue, 25 May 2021 11:55:37 +0200 Subject: [PATCH] adds network share creation and hostname adjustment to installer --- README.md | 2 +- install/install.sh | 37 +++++++++++++++-- install/smb.conf | 50 ++++++++++++++++++++++ package-lock.json | 101 +++++++++++++++++---------------------------- package.json | 8 ++-- 5 files changed, 126 insertions(+), 72 deletions(-) create mode 100644 install/smb.conf diff --git a/README.md b/README.md index 9b46638..bb9fc33 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Fitness Machine Service (FTMS) is a standardized GATT protocol for different typ Open Rowing Monitor can create Training Center XML files (TCX). You can upload these files to training platforms like [Strava](https://www.strava.com), [Garmin Connect](https://connect.garmin.com) or [Trainingpeaks](https://trainingpeaks.com) to track your training sessions. -Currently this is a manual step. The easiest way to do so is to place the configurable `data` directory onto a network share and then just grab the files from there. +Currently this is a manual step. The installer can set up a network share that contains all training data so it is easy to grab the files from there and upload them to the training platform of your choice. Open Rowing Monitor can also store the raw measurements of the flywheel into CSV files. These files are great to start your own exploration of your rowing style and also to learn about the specifics of your rowing machine (some Excel files that can help with this are included in the `docs` folder). diff --git a/install/install.sh b/install/install.sh index 6972295..0b0b5d3 100755 --- a/install/install.sh +++ b/install/install.sh @@ -87,8 +87,24 @@ fi # todo: once we know what hardware we support we can check for that via /sys/firmware/devicetree/base/model +HOSTNAME=$(hostname) +TARGET_HOSTNAME="rowingmonitor" +if [[ $HOSTNAME != $TARGET_HOSTNAME ]]; then + if ask "Do you want to change the device name from '$HOSTNAME' to '$TARGET_HOSTNAME'?" Y; then + sudo hostname -b $TARGET_HOSTNAME + sudo sed -i "s/$HOSTNAME/$TARGET_HOSTNAME/" /etc/hosts 2> /dev/null + sudo hostnamectl set-hostname $TARGET_HOSTNAME + sudo systemctl restart avahi-daemon + fi +fi + +INIT_SHARE=false +if ask "Do you want to create a samba network share to simplify access to trainings and configuration?" Y; then + INIT_SHARE=true +fi + INIT_GUI=false -if ask "Do you also want to run the Graphical User Interface on this device (requires attached screen, optional)?" N; then +if ask "Do you also want to run the Graphical User Interface on this device (requires attached screen)?" N; then INIT_GUI=true fi @@ -165,9 +181,24 @@ sudo systemctl daemon-reload sudo systemctl enable openrowingmonitor sudo systemctl restart openrowingmonitor +if $INIT_SHARE; then + print + print "Creating network share..." + # set the installer selections via debconf-set-selections, otherwise installing samba will open + # the wizard to manually set those settings + echo "samba-common samba-common/workgroup string WORKGROUP" | sudo debconf-set-selections + echo "samba-common samba-common/dhcp boolean true" | sudo debconf-set-selections + echo "samba-common samba-common/do_debconf boolean true" | sudo debconf-set-selections + sudo apt-get -y install samba samba-common-bin smbclient cifs-utils + sudo cp -f install/smb.conf /etc/samba/smb.conf + sudo systemctl restart smbd + print + print "Network share created" +fi + if $INIT_GUI; then print - print "Installing Graphical User Interface" + print "Installing Graphical User Interface..." sudo apt-get -y install --no-install-recommends xserver-xorg xserver-xorg-legacy x11-xserver-utils xinit openbox chromium-browser sudo sed -i 's/allowed_users=console/allowed_users=anybody/' /etc/X11/Xwrapper.config sudo cp install/webbrowserkiosk.service /lib/systemd/system/ @@ -190,4 +221,4 @@ print print "Installation of Open Rowing Monitor finished." print "Open Rowing Monitor should now be up and running." print -print "You should now adjust the configuration in $INSTALL_DIR/config/config.js" +print "You should now adjust the configuration in $INSTALL_DIR/config/config.js either via ssh or via the network share" diff --git a/install/smb.conf b/install/smb.conf new file mode 100644 index 0000000..17ea7fd --- /dev/null +++ b/install/smb.conf @@ -0,0 +1,50 @@ +# Open Rowing Monitor, https://github.com/laberning/openrowingmonitor +# +# Samba Configuration for Open Rowing Monitor + +[global] + browseable = yes + writeable = yes + printable = no + deadtime = 30 + mangled names = no + name resolve order = host bcast + printcap name = /dev/null + load printers = no + enable core files = no + passdb backend = smbpasswd + smb encrypt = disabled + fruit:model = Xserve + + # samba share options + map to guest = Bad User + guest account = root + security = user + + # samba tuning options + socket options = TCP_NODELAY IPTOS_LOWDELAY + min receivefile size = 16384 + aio read size = 16384 + aio write size = 16384 + use sendfile = yes + + # "strict allocate = yes" breaks large network transfers to external hdd + # Force this to "no" in case "yes" becomes the default in future + strict allocate = no + +[Training] + comment = Open Rowing Monitor Training Data + path = /opt/openrowingmonitor/data + available = yes + browseable = yes + public = yes + writable = yes + root preexec = mkdir -p /opt/openrowingmonitor/data + +[Configuration] + comment = Open Rowing Monitor Configuration + path = /opt/openrowingmonitor/config + available = yes + browseable = yes + public = yes + writable = yes diff --git a/package-lock.json b/package-lock.json index b79771b..6c6a12f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -839,16 +839,6 @@ "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" }, - "contains-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-1.0.0.tgz", - "integrity": "sha1-NFizMhhWA+ju0Y9RjUoQiIo6vJE=", - "dev": true, - "requires": { - "normalize-path": "^2.1.1", - "path-starts-with": "^1.0.0" - } - }, "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", @@ -1030,9 +1020,9 @@ }, "dependencies": { "iconv-lite": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.2.tgz", - "integrity": "sha512-2y91h5OpQlolefMPmUlivelittSWy0rP+oYVpn6A7GwVHNE8AWzoYOBNmlwks3LobaJxgHCYZAnyNo2GgpNRNQ==", + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", "dev": true, "optional": true, "requires": { @@ -1147,9 +1137,9 @@ "dev": true }, "eslint": { - "version": "7.26.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.26.0.tgz", - "integrity": "sha512-4R1ieRf52/izcZE7AlLy56uIHHDLT74Yzz2Iv2l6kDaYvEu9x+wMB5dZArVL8SYGXSYV2YAg70FcW5Y5nGGNIg==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.27.0.tgz", + "integrity": "sha512-JZuR6La2ZF0UD384lcbnd0Cgg6QJjiCwhMD6eU4h/VGPcVGwawNNzKU41tgokGXnfjOOyI6QIffthhJTPzzuRA==", "dev": true, "requires": { "@babel/code-frame": "7.12.11", @@ -1160,12 +1150,14 @@ "debug": "^4.0.1", "doctrine": "^3.0.0", "enquirer": "^2.3.5", + "escape-string-regexp": "^4.0.0", "eslint-scope": "^5.1.1", "eslint-utils": "^2.1.0", "eslint-visitor-keys": "^2.0.0", "espree": "^7.3.1", "esquery": "^1.4.0", "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", "functional-red-black-tree": "^1.0.1", "glob-parent": "^5.0.0", @@ -1177,7 +1169,7 @@ "js-yaml": "^3.13.1", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", - "lodash": "^4.17.21", + "lodash.merge": "^4.6.2", "minimatch": "^3.0.4", "natural-compare": "^1.4.0", "optionator": "^0.9.1", @@ -1186,7 +1178,7 @@ "semver": "^7.2.1", "strip-ansi": "^6.0.0", "strip-json-comments": "^3.1.0", - "table": "^6.0.4", + "table": "^6.0.9", "text-table": "^0.2.0", "v8-compile-cache": "^2.0.3" }, @@ -1197,6 +1189,12 @@ "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", "dev": true }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, "semver": { "version": "7.3.5", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", @@ -1224,9 +1222,9 @@ } }, "eslint-config-standard": { - "version": "16.0.2", - "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-16.0.2.tgz", - "integrity": "sha512-fx3f1rJDsl9bY7qzyX8SAtP8GBSk6MfXFaTfaGgk12aAYW4gJSyRm7dM790L6cbXv63fvjY4XeSzXnb4WM+SKw==", + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-16.0.3.tgz", + "integrity": "sha512-x4fmJL5hGqNJKGHSjnLdgA6U6h1YW/G2dW9fA+cyVur4SK6lyue8+UgNKWlZtUDTXvgKDD/Oa3GQjmB5kjtVvg==", "dev": true }, "eslint-import-resolver-node": { @@ -1288,14 +1286,13 @@ } }, "eslint-plugin-import": { - "version": "2.23.2", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.23.2.tgz", - "integrity": "sha512-LmNoRptHBxOP+nb0PIKz1y6OSzCJlB+0g0IGS3XV4KaKk2q4szqQ6s6F1utVf5ZRkxk/QOTjdxe7v4VjS99Bsg==", + "version": "2.23.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.23.3.tgz", + "integrity": "sha512-wDxdYbSB55F7T5CC7ucDjY641VvKmlRwT0Vxh7PkY1mI4rclVRFWYfsrjDgZvwYYDZ5ee0ZtfFKXowWjqvEoRQ==", "dev": true, "requires": { "array-includes": "^3.1.3", "array.prototype.flat": "^1.2.4", - "contains-path": "^1.0.0", "debug": "^2.6.9", "doctrine": "^2.1.0", "eslint-import-resolver-node": "^0.3.4", @@ -1512,9 +1509,9 @@ "dev": true }, "fdir": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-5.0.0.tgz", - "integrity": "sha512-cteqwWMA43lEmgwOg5HSdvhVFD39vHjQDhZkRMlKmeoNPtSSgUw1nUypydiY2upMdGiBFBZvNBDbnoBh0yCzaQ==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-5.1.0.tgz", + "integrity": "sha512-IgTtZwL52tx2wqWeuGDzXYTnNsEjNLahZpJw30hCQDyVnoHXwY5acNDnjGImTTL1R0z1PCyLw20VAbE5qLic3Q==", "dev": true }, "file-entry-cache": { @@ -2222,12 +2219,6 @@ "path-exists": "^3.0.0" } }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, "lodash.clonedeep": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", @@ -2251,6 +2242,12 @@ "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=", "dev": true }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, "lodash.truncate": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", @@ -2828,15 +2825,6 @@ "validate-npm-package-license": "^3.0.1" } }, - "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", - "dev": true, - "requires": { - "remove-trailing-separator": "^1.0.1" - } - }, "nosleep.js": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/nosleep.js/-/nosleep.js-0.12.0.tgz", @@ -3374,15 +3362,6 @@ "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", "dev": true }, - "path-starts-with": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/path-starts-with/-/path-starts-with-1.0.0.tgz", - "integrity": "sha1-soJDAV6LE43lcmgqxS2kLmRq2E4=", - "dev": true, - "requires": { - "normalize-path": "^2.1.1" - } - }, "path-type": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", @@ -3398,9 +3377,9 @@ "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" }, "picomatch": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.3.tgz", - "integrity": "sha512-KpELjfwcCDUb9PeigTs2mBJzXUPzAuP2oPcA989He8Rte0+YUAjw1JVedDhuTKPkHjSYzMN3npC9luThGYEKdg==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", + "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", "dev": true }, "pidtree": { @@ -3579,12 +3558,6 @@ "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==", "dev": true }, - "remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", - "dev": true - }, "request": { "version": "2.88.2", "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", @@ -3856,9 +3829,9 @@ "dev": true }, "snowpack": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/snowpack/-/snowpack-3.5.0.tgz", - "integrity": "sha512-RlQbyXlILgGKYkvlYHzDydM1V2xAgQ5ZQsb/BUlkzAqNlbFSbyM2Genfw3eWTfk6o5kG0BrpdAmyGcTpN1Q+UQ==", + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/snowpack/-/snowpack-3.5.1.tgz", + "integrity": "sha512-YOpC3hpGSzFOKgbHfMmWmJ1KYEtdBWkbUUdT0H3E1fsc73qRv97wskNkVaeNKtr/yrImR5+KHUvxcWY6jgHVtw==", "dev": true, "requires": { "cli-spinners": "^2.5.0", diff --git a/package.json b/package.json index 61e6dcb..f8657a3 100644 --- a/package.json +++ b/package.json @@ -37,15 +37,15 @@ "xml2js": "^0.4.23" }, "devDependencies": { - "eslint": "^7.26.0", - "eslint-config-standard": "^16.0.2", - "eslint-plugin-import": "^2.22.1", + "eslint": "^7.27.0", + "eslint-config-standard": "^16.0.3", + "eslint-plugin-import": "^2.23.3", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^5.1.0", "markdownlint-cli": "^0.27.1", "npm-run-all": "^4.1.5", "simple-git-hooks": "^2.4.1", - "snowpack": "^3.5.0", + "snowpack": "^3.5.1", "uvu": "^0.5.1" } }