Improve install permissions (#91)
* Improve install command * Update README * Add go+x permissions to C++ program * Specify group permissions for comfortable-swipe-buffer * Bump to version 1.2.4
This commit is contained in:
1 parent
9d25f1cc9f
commit
7728495350
5 files changed
+32
-12
No files matched your search
@@ -98,9 +98,15 @@ function install_configuration_file {
|
||||
function install_main_program {
|
||||
# copy source to target with executable permissions
|
||||
# install to target, with hardcoded version
|
||||
trysudo sed -E "s/^VERSION=.*/VERSION=$VERSION/" "$SOURCE" > "$TARGET"
|
||||
# allow execute permissions
|
||||
if [[ -f "$TARGET" ]]; then
|
||||
trysudo rm "$TARGET"
|
||||
fi
|
||||
trysudo cp "$SOURCE" "$TARGET"
|
||||
trysudo sed -E "s/^VERSION=.*/VERSION=$VERSION/" -i "$TARGET"
|
||||
# allow execute permissions with group
|
||||
trysudo chmod +x "$TARGET"
|
||||
# make sure non-root user is owner
|
||||
trysudo chown "$USER" "$TARGET"
|
||||
echo "Installed: $TARGET"
|
||||
}
|
||||
|
||||
@@ -114,9 +120,17 @@ function install_cpp_program {
|
||||
# compile program to temporary file first
|
||||
TMP_TARGET="$(mktemp)"
|
||||
$COMPILE "$COMPILE_SOURCE" -o "$TMP_TARGET" -DCOMFORTABLE_SWIPE_VERSION="\"$VERSION\"" -DCOMFORTABLE_SWIPE_CONFIG="\"$CONF_TARGET\"" -DCOMFORTABLE_SWIPE_AUTOSTART="\"$AUTOSTART_TARGET\""
|
||||
# compilation ok, now try to install
|
||||
# check permissions maybe if will need sudo
|
||||
# compilation ok, now try to install with sudo
|
||||
trysudo mkdir -p "$(dirname "$COMPILE_TARGET")"
|
||||
# remove existing file for permissions to work
|
||||
if [[ -f "$COMPILE_TARGET" ]]; then
|
||||
sudo rm "$COMPILE_TARGET"
|
||||
fi
|
||||
trysudo mv "$TMP_TARGET" "$COMPILE_TARGET"
|
||||
# bugfix: add with group permissions
|
||||
trysudo chmod go+x "$COMPILE_TARGET"
|
||||
# make sure non-root user is owner
|
||||
trysudo chown "$USER" "$COMPILE_TARGET"
|
||||
echo "Installed: $COMPILE_TARGET"
|
||||
}
|
||||
|
||||
@@ -127,6 +141,7 @@ function install_cpp_program {
|
||||
# /home/$USER/.config/autostart/comfortable-swipe.desktop
|
||||
#
|
||||
function install_autostart {
|
||||
mkdir -p "$(dirname "$AUTOSTART_TARGET")"
|
||||
cat "$AUTOSTART_SOURCE" > "$AUTOSTART_TARGET"
|
||||
echo "Installed: $AUTOSTART_TARGET"
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user