Skip to content

IDV services #14

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

Merged
merged 9 commits into from
Jun 20, 2025
Merged
Show file tree
Hide file tree
Changes from 5 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
5 changes: 2 additions & 3 deletions idv-services/etc/systemd/user/idv-init.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ After=graphical.target
[Service]
Type=simple
Environment=DISPLAY=:0
ExecStartPre=/bin/bash -c 'cd /opt/idv/init && /usr/bin/sudo ./setup_display.sh'
ExecStartPre=-/bin/bash -c 'cd /usr/local/bin/idv/init && /usr/bin/sudo ./setup_display.sh'
ExecStart=/usr/bin/sudo /usr/bin/X
ExecStartPost=/bin/bash -c 'cd /opt/idv/init && /usr/bin/sudo ./setup_file_permissions.sh'
ExecStartPost=/bin/bash -c 'cd /opt/idv/init && /usr/bin/sudo ./setup_sriov_vfs.sh'
ExecStartPost=/bin/bash -c 'cd /usr/local/bin/idv/init && /usr/bin/sudo ./setup_sriov_vfs.sh'
ExecStartPost=/usr/bin/xhost +
ExecStartPost=/bin/bash -c 'openbox &'
Restart=on-failure
Expand Down
4 changes: 2 additions & 2 deletions idv-services/etc/systemd/user/idv-launcher.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ After=idv-init.service
[Service]
Type=simple
Environment=DISPLAY=:0
ExecStart=/bin/bash -c 'sleep 5 && cd /opt/idv/launcher && /usr/bin/sudo ./start_all_vms.sh >> /opt/idv/launcher/start_all_vms.log 2>&1 '
ExecStop=/bin/bash -c 'cd /opt/idv/launcher && /usr/bin/sudo ./stop_all_vms.sh'
ExecStart=/bin/bash -c 'sleep 5 && cd /usr/local/bin/idv/launcher && /usr/bin/sudo ./start_all_vms.sh | systemd-cat -t idv-services'
ExecStop=/bin/bash -c 'cd /usr/local/bin/idv/launcher && /usr/bin/sudo ./stop_all_vms.sh'
Restart=always
RestartSec=5

Expand Down
1 change: 0 additions & 1 deletion idv-services/init/setup_display.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# These contents may have been developed with support from one or more
# Intel-operated generative artificial intelligence solutions.


extensions_file="/usr/share/X11/xorg.conf.d/10-extensions.conf"
serverflags_file="/usr/share/X11/xorg.conf.d/10-serverflags.conf"

Expand Down
12 changes: 0 additions & 12 deletions idv-services/init/setup_file_permissions.sh

This file was deleted.

5 changes: 4 additions & 1 deletion idv-services/init/setup_sriov_vfs.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash
#

# Copyright (C) 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

# These contents may have been developed with support from one or more
# Intel-operated generative artificial intelligence solutions.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
Name: idv-solution
Version: 1.0
Release: 1%{?dist}
Summary: A package to install scripts and systemd services
%define systemd_user_dir %{buildroot}/usr/lib/systemd/user
%define systemd_system_dir %{buildroot}/etc/systemd/system
%define local_bin_dir %{buildroot}/usr/local/bin

License: Proprietary
Name: intel-idv-services
Version: 0.1
Release: 1%{?dist}
Summary: A package to install scripts and systemd services for Intelligent Desktop Virtualization
Distribution: Edge Microvisor Toolkit
Vendor: Intel Corporation
License: Apache-2.0
URL: https://github.com/open-edge-platform/edge-desktop-virtualization
Source0: %{name}-%{version}.tar.gz
Source1: setup_permissions.sh

BuildArch: noarch
Requires(post): systemd
Expand All @@ -21,42 +26,29 @@ This package installs the scripts folder to /opt/idv, enables and starts a root-

%install
# Copy the scripts folder to /opt/idv
mkdir -p %{buildroot}/opt/idv
cp -r init %{buildroot}/opt/idv
cp -r launcher %{buildroot}/opt/idv

# Create log file
touch %{buildroot}/opt/idv/launcher/start_all_vms.log
mkdir -p %{local_bin_dir}/idv
cp -r init /%{local_bin_dir}/idv
cp -r launcher %{local_bin_dir}/idv

# Install the idv-init service
mkdir -p %{buildroot}/usr/lib/systemd/user/
install -m 644 idv-init.service %{buildroot}/usr/lib/systemd/user/idv-init.service
mkdir -p %{systemd_user_dir}
install -m 644 idv-init.service %{systemd_user_dir}/idv-init.service

# Install the idv-launcher service
mkdir -p %{buildroot}/usr/lib/systemd/user/
install -m 644 idv-launcher.service %{buildroot}/usr/lib/systemd/user/idv-launcher.service
install -m 644 idv-launcher.service %{systemd_user_dir}/idv-launcher.service

# Install the autologin.conf file
mkdir -p %{buildroot}/etc/systemd/system/getty@tty1.service.d
install -m 644 autologin.conf %{buildroot}/etc/systemd/system/getty@tty1.service.d/autologin.conf

# Install the setup_permissions.sh file
mkdir -p %{buildroot}/usr/local/bin
install -m 755 %{SOURCE1} %{buildroot}/usr/local/bin/setup_permissions.sh
mkdir -p %{systemd_system_dir}/getty@tty1.service.d
install -m 644 autologin.conf %{systemd_system_dir}/getty@tty1.service.d/autologin.conf

%files
/opt/idv/
/usr/lib/systemd/user/idv-init.service
/usr/lib/systemd/user/idv-launcher.service
/usr/local/bin/setup_permissions.sh
/usr/local/bin/idv/
/usr/lib/systemd/user/idv-*.service
%config(noreplace) /etc/systemd/system/getty@tty1.service.d/autologin.conf

%post
systemctl daemon-reload

# Run setup_sudoers.sh script
/usr/local/bin/setup_permissions.sh

USER_ID=1000
USER=$(getent passwd 1000 | cut -d: -f1)
export XDG_RUNTIME_DIR=/run/user/$USER_ID
Expand All @@ -81,9 +73,18 @@ if [ $1 -eq 0 ]; then
sudo -u $SUDO_USER XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR systemctl --user disable idv-launcher.service
fi

rm -rf /opt/idv/
rm -rf /usr/local/bin/idv/
fi

%changelog
* Fri Jun 13 2025 Dhanya A <dhanya.a@intel.com> - 1.0-1
* Thu Jun 19 2025 Dhanya A <dhanya.a@intel.com> - 0.1-5
- Copy scripts to bin directory, use macros for standard path, remove logs file

* Tue Jun 17 2025 Dhanya A <dhanya.a@intel.com> - 0.1-3
- Remove command to create logs file.

* Mon Jun 16 2025 Dhanya A <dhanya.a@intel.com> - 0.1-2
- Initial Edge Microvisor Toolkit import from Fedora 43 (license: MIT). License verified.

* Fri Jun 13 2025 Dhanya A <dhanya.a@intel.com> - 0.1-1
- Initial RPM package for scripts and systemd services
1 change: 0 additions & 1 deletion idv-services/launcher/start_all_vms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# These contents may have been developed with support from one or more
# Intel-operated generative artificial intelligence solutions.


source vm.conf

declare -A VM_LIST
Expand Down
1 change: 0 additions & 1 deletion idv-services/launcher/start_vm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# These contents may have been developed with support from one or more
# Intel-operated generative artificial intelligence solutions.


source vm.conf

set -eE
Expand Down
1 change: 0 additions & 1 deletion idv-services/launcher/stop_all_vms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# These contents may have been developed with support from one or more
# Intel-operated generative artificial intelligence solutions.


source vm.conf

declare -A VM_LIST
Expand Down
3 changes: 3 additions & 0 deletions idv-services/launcher/stop_vm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# Copyright (C) 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

# These contents may have been developed with support from one or more
# Intel-operated generative artificial intelligence solutions.

# Kill QEMU process
grep_output=$(ps aux | grep qemu | grep -i $1)

Expand Down
2 changes: 1 addition & 1 deletion idv-services/launcher/vm.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
guest=3
guest=0

OVMF_CODE_FILE=/opt/qcow2/OVMF_CODE.fd

Expand Down
12 changes: 6 additions & 6 deletions idv-services/rpm-packaging-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ This guide provides step-by-step instructions to package and run IDV services us
- Run the following commands to create a tar file for the IDV solution:

```bash
sudo mkdir idv-solution-1.0
sudo cp -r autologin.conf etc/systemd/user/idv-init.service etc/systemd/user/idv-launcher.service init/ launcher/ idv-solution-1.0/
sudo tar -czf idv-solution-1.0.tar.gz idv-solution-1.0/
sudo chmod +x idv-solution-1.0.tar.gz
sudo mkdir intel-idv-services-0.1
sudo cp -r autologin.conf etc/systemd/user/idv-init.service etc/systemd/user/idv-launcher.service init/ launcher/ intel-idv-services-0.1/
sudo tar -czf intel-idv-services-0.1.tar.gz intel-idv-services-0.1/
sudo chmod +x intel-idv-services-0.1.tar.gz
```

## Step 2: Copy Files to RPM SOURCES
Expand Down Expand Up @@ -86,7 +86,7 @@ sudo ./setup_permissions.sh
## Step 5: Build the RPM Package

```bash
rpmbuild -ba ~/rpmbuild/SPECS/idv-solution.spec
rpmbuild -ba ~/rpmbuild/SPECS/intel-idv-services.spec
```
- If successful, the RPM package will be created in the `~/rpmbuild/RPMS/noarch/` directory. Make a note of the path of RPM package for further steps.
> **Note**: If the build fails, check the .spec file for syntax errors or missing dependencies.
Expand Down Expand Up @@ -138,7 +138,7 @@ sudo ./setup_permissions.sh
- To uninstall the RPM package, run:

```bash
sudo rpm -e idv-solution
sudo rpm -e intel-idv-services
```

### Post-Reboot Instructions
Expand Down
2 changes: 1 addition & 1 deletion idv-services/setup_permissions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# Copyright (C) 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

echo "guest ALL=(ALL) NOPASSWD: /usr/bin/X,/opt/idv/init/setup_sriov_vfs.sh,/opt/idv/init/setup_display.sh,/opt/idv/init/setup_file_permissions.sh,/opt/idv/launcher/start_vm.sh,/opt/idv/launcher/start_all_vms.sh,/opt/idv/launcher/stop_vm.sh,/opt/idv/launcher/stop_all_vms.sh" | sudo tee -a /etc/sudoers.d/guest > /dev/null
echo "ALL ALL=(ALL) NOPASSWD: /usr/bin/X,/opt/idv/init/setup_sriov_vfs.sh,/opt/idv/init/setup_display.sh,/opt/idv/init/setup_file_permissions.sh,/opt/idv/launcher/start_vm.sh,/opt/idv/launcher/start_all_vms.sh,/opt/idv/launcher/stop_vm.sh,/opt/idv/launcher/stop_all_vms.sh" | sudo tee -a /etc/sudoers.d/guest > /dev/null
4 changes: 2 additions & 2 deletions idv-services/setup_rpm_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
# SPDX-License-Identifier: Apache-2.0

sudo cp setup_permissions.sh $HOME/rpmbuild/SOURCES
sudo cp idv-solution-1.0.tar.gz $HOME/rpmbuild/SOURCES
sudo cp intel-idv-services-0.1.tar.gz $HOME/rpmbuild/SOURCES

sudo cp idv-solution.spec $HOME/rpmbuild/SPECS/idv-solution.spec
sudo cp intel-idv-services.spec $HOME/rpmbuild/SPECS/
Loading