Skip to content

Commit

Permalink
add some scripts and fix installation issues
Browse files Browse the repository at this point in the history
  • Loading branch information
lmaxyz committed Dec 25, 2023
1 parent 4e3d84a commit 05df96d
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 40 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.venv
.env
.vscode
.vscode
/build
24 changes: 0 additions & 24 deletions install.sh

This file was deleted.

2 changes: 1 addition & 1 deletion msi_control_ui/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions msi_control_ui/src/controllers/power_mode_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down
2 changes: 1 addition & 1 deletion msi_ec_dbus
20 changes: 20 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -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.'
28 changes: 28 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
@@ -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."
16 changes: 16 additions & 0 deletions scripts/uninstall.sh
Original file line number Diff line number Diff line change
@@ -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.'
11 changes: 0 additions & 11 deletions uninstall.sh

This file was deleted.

0 comments on commit 05df96d

Please sign in to comment.