Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update specfile to include config from release dir #68

Merged
merged 2 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions command_line_assistant/dbus/constants.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from dasbus.connection import SessionMessageBus
from dasbus.connection import SystemMessageBus
from dasbus.error import ErrorMapper
from dasbus.identifier import DBusServiceIdentifier

ERROR_MAPPER = ErrorMapper()

SESSION_BUS = SessionMessageBus(error_mapper=ERROR_MAPPER)
SESSION_BUS = SystemMessageBus(error_mapper=ERROR_MAPPER)

SERVICE_NAMESPACE = ("com", "redhat", "lightspeed")

Expand Down
5 changes: 2 additions & 3 deletions data/release/clad.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ Documentation=https://github.com/rhel-lightspeed/command-line-assistant
After=network.service

[Service]
BusName=com.rhel.lightspeed
PrivateTmp=yes
RemainAfterExit=no
ExecStart=$(exec_prefix}/sbin/clad
ExecStart=/usr/sbin/clad

[Install]
WantedBy=multi-user.target
WantedBy=default.target
Alias=clad.service
15 changes: 15 additions & 0 deletions data/release/com.redhat.lightspeed.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<!-- Allow the command line assistant service to own the name -->
<policy context="default">
<allow own="com.redhat.lightspeed"/>
</policy>

<!-- Allow any user to invoke methods -->
<policy context="default">
<allow send_destination="com.redhat.lightspeed"/>
<allow receive_sender="com.redhat.lightspeed"/>
</policy>
</busconfig>
19 changes: 19 additions & 0 deletions data/release/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[output]
# otherwise recording via script session will be enforced
enforce_script = false
# file with output(s) of regular commands (e.g. ls, echo, etc.)
file = "/tmp/command-line-assistant/output.txt"
# Keep non-empty if your file contains only output of commands (not prompt itself)
prompt_separator = "$"

[history]
enabled = true
file = "/tmp/command-line-assistant/history.json"
# max number of queries in history (including responses)
max_size = 100

[backend]
endpoint = "http://localhost:8080"

[logging]
level = "DEBUG"
11 changes: 11 additions & 0 deletions packaging/command-line-assistant.spec
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,18 @@ A simple wrapper to interact with RAG

# Create sbin directory in buildroot
%{__install} -d %{buildroot}/%{_sbindir}
%{__install} -d %{buildroot}/%{_sysconfdir}/xdg/%{python_package_src}

# Move the daemon to /usr/sbin instead of /usr/bin
%{__install} -m 0755 %{buildroot}/%{_bindir}/%{daemon_binary_name} %{buildroot}/%{_sbindir}/%{daemon_binary_name}
%{__rm} %{buildroot}/%{_bindir}/%{daemon_binary_name}

# System units
%{__install} -D -m 0644 data/release/%{daemon_binary_name}.service %{buildroot}/%{_unitdir}/%{daemon_binary_name}.service
%{__install} -D -m 0644 data/release/com.redhat.lightspeed.conf %{buildroot}/%{_sysconfdir}/dbus-1/system.d/com.redhat.lightspeed.conf

# Config file
%{__install} -D -m 0644 data/release/config.toml %{buildroot}/%{_sysconfdir}/xdg/%{python_package_src}/config.toml

%files
%doc README.md
Expand All @@ -61,8 +66,14 @@ A simple wrapper to interact with RAG
# Binaries
%{_bindir}/%{binary_name}
%{_sbindir}/%{daemon_binary_name}

# System units
%{_unitdir}/%{daemon_binary_name}.service

# Config file
%config %{_sysconfdir}/xdg/%{python_package_src}/config.toml
%config %{_sysconfdir}/dbus-1/system.d/com.redhat.lightspeed.conf

%preun
if [ "$1" -eq 0 ]; then
systemctl stop %{daemon_binary_name}.service || :
Expand Down
Loading