diff --git a/.gitignore b/.gitignore index 233ddb7..92d984c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .venv .env -.vscode \ No newline at end of file +.vscode +/build \ No newline at end of file diff --git a/install.sh b/install.sh deleted file mode 100755 index d529aba..0000000 --- a/install.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -e - -APP_BIN=msi_ec_backend -DBUS_CONF='msi_ec_backend.conf' -DBUS_SERVICE='org.msi_ec_backend.service' - -LIBEXEC_PATH='/usr/libexec/' -DBUS_SYSTEM_PATH='/usr/share/dbus-1/system.d/' -DBUS_SERVICES_PATH='/usr/share/dbus-1/system-services/' - -echo "Installation..." - -mkdir -p /opt/msi-control -cp ./msi-control /opt/msi-control/msi-control -cp ./requirements.txt /opt/msi-control/ -cp -r ./icons /opt/msi-control/ -python3 -m venv /opt/msi-control/.venv -/opt/msi-control/.venv/bin/pip install -r /opt/msi-control/requirements.txt - -install -vDm755 ./$APP_BIN $LIBEXEC_PATH$APP_BIN -install -vDm644 ./msi_ec_backend/dbus_conf/$DBUS_CONF $DBUS_SYSTEM_PATH$DBUS_CONF -install -vDm644 ./msi_ec_backend/dbus_conf/$DBUS_SERVICE $DBUS_SERVICES_PATH$DBUS_SERVICE - -echo "Done." diff --git a/msi_control_ui/Cargo.lock b/msi_control_ui/Cargo.lock index cf0692e..86f7a5c 100644 --- a/msi_control_ui/Cargo.lock +++ b/msi_control_ui/Cargo.lock @@ -161,7 +161,7 @@ dependencies = [ ] [[package]] -name = "msi_control_ui" +name = "msi_control" version = "0.1.0" dependencies = [ "dbus", diff --git a/msi_control_ui/src/controllers/power_mode_controller.rs b/msi_control_ui/src/controllers/power_mode_controller.rs index 9d3658b..88d4a7b 100644 --- a/msi_control_ui/src/controllers/power_mode_controller.rs +++ b/msi_control_ui/src/controllers/power_mode_controller.rs @@ -78,9 +78,9 @@ impl PowerModeController { where A: AppendAll { - let proxy = &self.dbus_conn.with_proxy("org.msi_ec_backend", "/power_control", Duration::from_millis(5000)); + let proxy = &self.dbus_conn.with_proxy("org.msi_ec_dbus", "/power_control", Duration::from_millis(5000)); - let (result,): (String,) = proxy.method_call("org.msi_ec_backend", method_name, args)?; + let (result,): (String,) = proxy.method_call("org.msi_ec_dbus", method_name, args)?; Ok(Some(result)) } diff --git a/msi_ec_dbus b/msi_ec_dbus index 746b271..a205e92 160000 --- a/msi_ec_dbus +++ b/msi_ec_dbus @@ -1 +1 @@ -Subproject commit 746b271cd010ea697bc21900b8837dd8a5b8ca37 +Subproject commit a205e922eec0f34dd238956b6535fe2417f11428 diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 0000000..fd9b407 --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,20 @@ +#!/bin/bash -e + +cd ../ +mkdir -p build +cp -r ./msi_ec_dbus/dbus_conf ./build/dbus_conf +cp -r ./msi_control_ui/icons ./build/icons +cp ./scripts/install.sh ./build +cp ./scripts/uninstall.sh ./build + +echo 'Building dbus service...' +cd ./msi_ec_dbus +cargo build --release +cp ./target/release/msi_ec_dbus ../build/ + +echo 'Building binary...' +cd ../msi_control_ui +cargo build --release +cp ./target/release/msi_control ../build/ + +echo 'Done.' diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100755 index 0000000..7bd552a --- /dev/null +++ b/scripts/install.sh @@ -0,0 +1,28 @@ +#!/bin/bash -e + +if [ "$(id -u)" != "0" ]; then + echo "This script must be run as root" 1>&2 + exit 1 +fi + +DBUS_BIN=msi_ec_dbus +DBUS_CONF='msi_ec_dbus.conf' +DBUS_SERVICE='org.msi_ec_dbus.service' + +LIBEXEC_PATH='/usr/libexec/' +DBUS_SYSTEM_PATH='/usr/share/dbus-1/system.d/' +DBUS_SERVICES_PATH='/usr/share/dbus-1/system-services/' + +GUI_BIN=msi_control + +echo "Installation..." + +mkdir -p /opt/msi_control +cp ./msi_control /opt/msi_control/msi_control +cp -r ./icons /opt/msi_control/ + +install -vDm755 ./$DBUS_BIN $LIBEXEC_PATH$DBUS_BIN +install -vDm644 ./dbus_conf/$DBUS_CONF $DBUS_SYSTEM_PATH$DBUS_CONF +install -vDm644 ./dbus_conf/$DBUS_SERVICE $DBUS_SERVICES_PATH$DBUS_SERVICE + +echo "Done." diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh new file mode 100755 index 0000000..5d42b7e --- /dev/null +++ b/scripts/uninstall.sh @@ -0,0 +1,16 @@ +#!/bin/bash -e + +if [ "$(id -u)" != "0" ]; then + echo "This script must be run as root" 1>&2 + exit 1 +fi + +echo 'Uninstallation...' + +rm -rfv /opt/msi_control + +rm -fv /usr/libexec/msi_ec_dbus +rm -fv /usr/share/dbus-1/system.d/msi_ec_dbus.conf +rm -fv /usr/share/dbus-1/system-services/org.msi_ec_dbus.service + +echo 'Done.' diff --git a/uninstall.sh b/uninstall.sh deleted file mode 100755 index cff6132..0000000 --- a/uninstall.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -e - -echo 'Uninstallation...' - -rm -rfv /opt/msi-control - -rm -fv /usr/libexec/msi_ec_backend -rm -fv /usr/share/dbus-1/system.d/msi_ec_backend.conf -rm -fv /usr/share/dbus-1/system-services/org.msi_ec_backend.service - -echo 'Done.'