Delete a bunch of stuff I don't think I'll need.

This commit is contained in:
James Pace 2022-08-16 19:08:55 -04:00
parent a8d8515b75
commit 5b22a10316
38 changed files with 1 additions and 3517 deletions

View File

@ -1,43 +0,0 @@
FROM centos:stream9-development
RUN dnf install -y 'dnf-command(config-manager)' && \
dnf config-manager --set-enabled crb && \
dnf copr enable -y @osbuild/osbuild
RUN dnf install -y \
"@Development Tools" \
# Some convenience packages \
bash-completion \
dnf \
emacs \
less \
strace \
vim \
git \
wget \
# Dependencies for building images \
osbuild-ostree \
osbuild-tools \
# Dependencies to build the kernel's RPM \
rpm-build \
hostname \
openssl-devel \
bc \
binutils-devel \
bpftool \
clang \
dwarves \
gcc-plugin-devel \
libcap-devel \
libcap-ng-devel \
libmnl-devel \
llvm \
net-tools \
numactl-devel \
perl-devel \
python3-devel \
python3-docutils \
rsync && \
dnf clean all
CMD ["/usr/bin/bash"]

View File

@ -1,107 +0,0 @@
{
"product": "Automotive-sig_images",
"version": 1,
"builds": {
"minimal": {
"manifest": "minimal",
"type": "ostree",
"target": "qemu",
"format" : "qcow2",
"arches": [
"x86_64",
"aarch64"
],
"package-sets": [
"automotive-product"
]
},
"minimal-rpi": {
"manifest": "minimal",
"type": "regular",
"target": "rpi4",
"format" : "img",
"arches": [
"aarch64"
],
"package-sets": [
"cs9"
]
},
"qa": {
"manifest": "qa",
"type": "ostree",
"target": "qemu",
"format" : "qcow2",
"arches": [
"x86_64",
"aarch64"
],
"package-sets": [
"cs9"
]
},
"neptune": {
"manifest": "neptune",
"type": "ostree",
"target": "qemu",
"format" : "qcow2",
"arches": [
"x86_64",
"aarch64"
],
"package-sets": [
"cs9"
]
},
"neptune-rpi": {
"manifest": "neptune",
"type": "regular",
"target": "rpi4",
"format" : "img",
"arches": [
"aarch64"
],
"package-sets": [
"cs9"
]
},
"developer": {
"manifest": "developer",
"type": "regular",
"target": "qemu",
"format" : "qcow2",
"arches": [
"x86_64",
"aarch64"
],
"package-sets": [
"cs9"
]
},
"developer-rpi": {
"manifest": "developer",
"type": "regular",
"target": "rpi4",
"format" : "img",
"arches": [
"aarch64"
],
"package-sets": [
"cs9"
]
},
"container": {
"manifest": "container",
"type": "regular",
"target": "qemu",
"format" : "qcow2",
"arches": [
"x86_64",
"aarch64"
],
"package-sets": [
"cs9"
]
}
}
}

View File

@ -41,7 +41,7 @@ export CHECKPOINTS=build
IMAGETYPES := regular ostree direct IMAGETYPES := regular ostree direct
FORMATS := img qcow2 oci.tar repo rootfs ext4 tar FORMATS := img qcow2 oci.tar repo rootfs ext4 tar
aarch64_TARGETS := rpi4 aarch64_TARGETS := rpi4
COMMON_TARGETS := qemu aws COMMON_TARGETS := qemu
HOST_TARGETS := $(COMMON_TARGETS) $($(HOST_ARCH)_TARGETS) HOST_TARGETS := $(COMMON_TARGETS) $($(HOST_ARCH)_TARGETS)
ALL_TARGETS := $(COMMON_TARGETS) $(foreach a,$(ARCHES), $($(a)_TARGETS)) ALL_TARGETS := $(COMMON_TARGETS) $(foreach a,$(ARCHES), $($(a)_TARGETS))

View File

@ -1,19 +0,0 @@
## custom.conf
# GDM configuration storage
[daemon]
# Uncomment the line below to force the login screen to use Xorg
# WaylandEnable=false
AutomaticLoginEnable=True
AutomaticLogin=neptune
[security]
[xdmcp]
[chooser]
[debug]
# Uncomment the line below to turn on debugging
#Enable=true

View File

@ -1,19 +0,0 @@
## custom.conf
# GDM configuration storage
[daemon]
# Uncomment the line below to force the login screen to use Xorg
WaylandEnable=false
AutomaticLoginEnable=True
AutomaticLogin=neptune
[security]
[xdmcp]
[chooser]
[debug]
# Uncomment the line below to turn on debugging
#Enable=true

View File

@ -1,14 +0,0 @@
[Unit]
Description=Init neptune gdm session conf
ConditionPathExists=!/var/lib/AccountsService/users/neptune
Before=gdm.service
[Service]
Type=service
ExecStart=/bin/sh -c ' \
echo -e "[User]\nSession=neptune-%i\nXSession=neptune-xorg\nPasswordHint=\nIcon=/var/lib/AccountsService/icons/guest\nSystemAccount=false\n" \
> /var/lib/AccountsService/users/neptune'
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

View File

@ -1,79 +0,0 @@
formatVersion: 1
formatType: am-configuration
---
# basic AM functionality - the builtin apps are in 'apps'.
# installations will go into the standard QStandardPath AppLocalDataLocation
# (e.g. ~/.local/share/Luxoft Sweden AB/Neptune UI) /am hierarchy
applications:
builtinAppsManifestDir: "${CONFIG_PWD}/apps"
installedAppsManifestDir: "${stdpath:AppLocalDataLocation}/neptune3-ui/manifests"
installationDir: "${stdpath:AppLocalDataLocation}/neptune3-ui/apps"
documentDir: "${stdpath:AppLocalDataLocation}/neptune3-ui/docs"
# QML apps will be able to import from modules...
runtimes:
qml:
importPaths: [ "${CONFIG_PWD}/imports_shared" ]
environmentVariables:
QT_PLUGIN_PATH: "${CONFIG_PWD}"
SERVER_CONF_PATH: "${CONFIG_PWD}/server.conf"
native:
importPaths: [ "${CONFIG_PWD}/imports_shared" ]
environmentVariables:
QT_PLUGIN_PATH: "${CONFIG_PWD}"
SERVER_CONF_PATH: "${CONFIG_PWD}/server.conf"
# ... as well as the SystemUI
ui:
fullscreen: yes
style: "${CONFIG_PWD}/styles/neptune"
iconThemeName: "neptune"
iconThemeSearchPaths: [ "${CONFIG_PWD}/imports_shared/assets/icons" ]
mainQml: "${CONFIG_PWD}/Main.qml"
importPaths: [ "${CONFIG_PWD}/imports_shared", "${CONFIG_PWD}/imports_system", "${CONFIG_PWD}/sysui" ]
windowIcon: "${CONFIG_PWD}/imports_shared/assets/icons/neptune/sysui/ic-menu-home.png"
enableTouchEmulation: yes
systemProperties:
public:
showCluster: no
showHUD: no
devMode: yes
enableCursorManagement: no
hardwareVariant: 'high'
#Qt Safe Renderer settings
qsrEnabled: no
qsrServerAddress: '127.0.0.1'
qsrServerPort: '1111'
showSystemAppsInLauncher: no
private:
appStoreServerUrl: 'http://demoappsdeploy.qt.io:8514'
userName: 't'
userPassword: 't'
imei: '112163001487801'
orientation: 'Landscape'
adjustSizesForScreen: yes
# development setup: no security
flags:
noSecurity: yes
noUiWatchdog: yes
# default logging
logging:
rules:
- "*=false"
- "qt.*=false"
- "qt.gamepad*=true"
- "am.*=false"
- "qml*=true"
- "cursor.navigation=false"
- "qt3ds.*=false"
- "shared.com.pelagicore.map.info=false"
- "*.warning=false"
- "*.critical=true"

View File

@ -1,7 +0,0 @@
[Desktop Entry]
Type=Application
Exec=neptune3-ui
StartupNotify=false
Terminal=false
Name[en_US]=neptune3-ui
Comment[en_US]=Launches neptune3-ui on logging in

View File

@ -1,7 +0,0 @@
[Desktop Entry]
Type=Application
Exec=env QT_QPA_PLATFORM=wayland QT_IM_MODULE=qtvirtualkeyboard neptune3-ui
StartupNotify=false
Terminal=false
Name[en_US]=neptune3-ui
Comment[en_US]=Launches neptune3-ui on logging in

View File

@ -1,3 +0,0 @@
[GNOME Session]
Name=Neptune XOrg
RequiredComponents=mutter;neptune3-ui-xorg;

View File

@ -1,3 +0,0 @@
[GNOME Session]
Name=Neptune
RequiredComponents=mutter;neptune3-ui;

View File

@ -1,7 +0,0 @@
[Desktop Entry]
Name=Neptune (Wayland)
Comment=This session logs you into Neptune
Exec=gnome-session --session=neptune
Type=Application
DesktopNames=GNOME
X-GDM-SessionRegisters=true

View File

@ -1,7 +0,0 @@
[Desktop Entry]
Name=Neptune (XOrg)
Comment=This session logs you into Neptune
Exec=gnome-session --session=neptune-xorg
Type=Application
DesktopNames=GNOME
X-GDM-SessionRegisters=true

View File

@ -1,125 +0,0 @@
version: '2'
mpp-vars:
name: gadget
image_size: '3221225472'
pipelines:
- mpp-import-pipelines:
path: include/build.ipp.yml
- name: rootfs
build: name:build
stages:
- type: org.osbuild.kernel-cmdline
options:
root_fs_uuid:
mpp-eval: rootfs_uuid
kernel_opts:
mpp-eval: ''' '' .join(kernel_opts)'
- type: org.osbuild.rpm
options:
gpgkeys:
- mpp-eval: centos_gpg_key
- mpp-eval: redhat_gpg_key
disable_dracut: true
exclude:
docs: true
inputs:
packages:
type: org.osbuild.files
origin: org.osbuild.source
mpp-depsolve:
architecture: $arch
ignore-weak-deps: true
module-platform-id: $distro_module_id
baseurl: $distro_baseurl/BaseOS/$arch/os/
repos:
mpp-join:
- mpp-eval: distro_repos
- mpp-eval: distro_devel_repos
- mpp-eval: target_repos
- mpp-eval: extra_repos
- - id: osbuild
baseurl: https://download.copr.fedorainfracloud.org/results/@osbuild/osbuild/centos-stream-9-$arch
packages:
mpp-join:
- mpp-eval: base_rpms
- mpp-eval: image_rpms
- mpp-eval: extra_rpms
- - "@Development Tools"
- firewalld
# Some convenience packages
- bash-completion
- dnf
- emacs-nox
- less
- strace
- sudo
- vim
- git
- wget
- make
# Dependencies to build RPMs and images
- rpm-build
- hostname
- openssl-devel
- bc
- binutils-devel
- bpftool
- clang
- dwarves
- gcc-plugin-devel
- libcap-devel
- libcap-ng-devel
- libmnl-devel
- llvm
- net-tools
- numactl-devel
- osbuild-ostree
- osbuild-tools
- openssh-clients
- openssh-server
- perl-devel
- python3-devel
- python3-docutils
- rsync
- iputils
- iproute
- qemu-kvm
- fuse-devel
- kernel-rpm-macros
# Container tools
- podman
- buildah
- skopeo
# Gadget
- pi_gadget
excludes:
- dracut-config-rescue
- type: org.osbuild.locale
options:
language: en_US.UTF-8
- type: org.osbuild.users
options:
users:
guest:
password:
mpp-eval: guest_password
- type: org.osbuild.firewall
options:
enabled_services:
- cockpit
- ssh
- type: org.osbuild.sshd.config
options:
config:
PermitRootLogin:
mpp-eval: ssh_permit_root_login
- type: org.osbuild.systemd
options:
enabled_services:
- NetworkManager.service
- firewalld.service
- rngd.service
- sshd.service
- cockpit.socket
- mpp-import-pipelines:
path: include/image.ipp.yml

View File

@ -1,206 +0,0 @@
version: '2'
mpp-vars:
name: neptune
display_server: wayland
pipelines:
- mpp-import-pipelines:
path: include/build.ipp.yml
- name: rootfs
build: name:build
stages:
- type: org.osbuild.kernel-cmdline
options:
root_fs_uuid:
mpp-eval: rootfs_uuid
kernel_opts:
mpp-eval: ''' '' .join(kernel_opts)'
- type: org.osbuild.rpm
options:
gpgkeys:
- mpp-eval: centos_gpg_key
- mpp-eval: redhat_gpg_key
disable_dracut: true
exclude:
docs: true
inputs:
packages:
type: org.osbuild.files
origin: org.osbuild.source
mpp-depsolve:
architecture: $arch
ignore-weak-deps: true
module-platform-id: $distro_module_id
baseurl: $distro_baseurl/BaseOS/$arch/os/
repos:
mpp-join:
- mpp-eval: distro_repos
- mpp-eval: target_repos
- mpp-eval: extra_repos
- - id: copr-neptune
baseurl: https://download.copr.fedorainfracloud.org/results/pingou/qtappmanager-fedora/centos-stream-9-$arch/
packages:
mpp-join:
- mpp-eval: base_rpms
- mpp-eval: image_rpms
- mpp-eval: extra_rpms
- - dnf
- firewalld
- gdm
- gnome-control-center
- gnome-session-xsession
- gnome-shell
- gnome-terminal
- langpacks-en
- neptune3-ui
- openssh-clients
- openssh-server
- plymouth
- polkit
- sudo
- xorg-x11-drv-fbdev
excludes:
- dracut-config-rescue
- gnome-tour
- type: org.osbuild.locale
options:
language: en_US.UTF-8
- type: org.osbuild.users
options:
users:
guest:
password:
mpp-eval: guest_password
neptune:
password: ''
- type: org.osbuild.copy
inputs:
inlinefile:
type: org.osbuild.files
origin: org.osbuild.source
mpp-embed:
id: custom.conf
path: ../files/etc/gdm/custom-$display_server.conf
options:
paths:
- from:
mpp-format-string: input://inlinefile/{embedded['custom.conf']}
to: tree:///etc/gdm/custom.conf
- type: org.osbuild.copy
inputs:
inlinefile:
type: org.osbuild.files
origin: org.osbuild.source
mpp-embed:
id: init-neptune-session@.service
path: ../files/etc/systemd/system/init-neptune-session@.service
options:
paths:
- from:
mpp-format-string: input://inlinefile/{embedded['init-neptune-session@.service']}
to: tree:///etc/systemd/system/init-neptune-session@.service
- type: org.osbuild.copy
inputs:
inlinefile:
type: org.osbuild.files
origin: org.osbuild.source
mpp-embed:
id: neptune-wayland.desktop
path: ../files/usr/share/wayland-sessions/neptune-wayland.desktop
options:
paths:
- from:
mpp-format-string: input://inlinefile/{embedded['neptune-wayland.desktop']}
to: tree:///usr/share/wayland-sessions/neptune-wayland.desktop
- type: org.osbuild.copy
inputs:
inlinefile:
type: org.osbuild.files
origin: org.osbuild.source
mpp-embed:
id: neptune-xorg.desktop
path: ../files/usr/share/xsessions/neptune-xorg.desktop
options:
paths:
- from:
mpp-format-string: input://inlinefile/{embedded['neptune-xorg.desktop']}
to: tree:///usr/share/xsessions/neptune-xorg.desktop
- type: org.osbuild.copy
inputs:
inlinefile:
type: org.osbuild.files
origin: org.osbuild.source
mpp-embed:
id: neptune.session
path: ../files/usr/share/gnome-session/sessions/neptune.session
options:
paths:
- from:
mpp-format-string: input://inlinefile/{embedded['neptune.session']}
to: tree:///usr/share/gnome-session/sessions/neptune.session
- type: org.osbuild.copy
inputs:
inlinefile:
type: org.osbuild.files
origin: org.osbuild.source
mpp-embed:
id: neptune-xorg.session
path: ../files/usr/share/gnome-session/sessions/neptune-xorg.session
options:
paths:
- from:
mpp-format-string: input://inlinefile/{embedded['neptune-xorg.session']}
to: tree:///usr/share/gnome-session/sessions/neptune-xorg.session
- type: org.osbuild.copy
inputs:
inlinefile:
type: org.osbuild.files
origin: org.osbuild.source
mpp-embed:
id: am-config-neptune.yaml
path: ../files/usr/lib64/neptune3/am-config-neptune.yaml
options:
paths:
- from:
mpp-format-string: input://inlinefile/{embedded['am-config-neptune.yaml']}
to: tree:///usr/lib64/neptune3/am-config-neptune.yaml
- type: org.osbuild.copy
inputs:
inlinefile:
type: org.osbuild.files
origin: org.osbuild.source
mpp-embed:
id: neptune3-ui.desktop
path: ../files/usr/share/applications/neptune3-ui.desktop
options:
paths:
- from:
mpp-format-string: input://inlinefile/{embedded['neptune3-ui.desktop']}
to: tree:///usr/share/applications/neptune3-ui.desktop
- type: org.osbuild.copy
inputs:
inlinefile:
type: org.osbuild.files
origin: org.osbuild.source
mpp-embed:
id: neptune3-ui-xorg.desktop
path: ../files/usr/share/applications/neptune3-ui-xorg.desktop
options:
paths:
- from:
mpp-format-string: input://inlinefile/{embedded['neptune3-ui-xorg.desktop']}
to: tree:///usr/share/applications/neptune3-ui-xorg.desktop
- type: org.osbuild.sshd.config
options:
config:
PermitRootLogin:
mpp-eval: ssh_permit_root_login
- type: org.osbuild.systemd
options:
enabled_services:
- NetworkManager.service
- firewalld.service
- rngd.service
- sshd.service
- mpp-eval: "'init-neptune-session@wayland.service' if display_server == 'wayland' else 'init-neptune-session@xorg.service'"
- mpp-import-pipelines:
path: include/image.ipp.yml

View File

@ -1,46 +0,0 @@
version: '2'
mpp-vars:
name: soafee
pipelines:
- mpp-import-pipelines:
path: include/build.ipp.yml
- name: rootfs
build: name:build
stages:
- type: org.osbuild.kernel-cmdline
options:
root_fs_uuid:
mpp-eval: rootfs_uuid
kernel_opts:
mpp-eval: ''' '' .join(kernel_opts)'
- type: org.osbuild.rpm
options:
gpgkeys:
- mpp-eval: centos_gpg_key
- mpp-eval: redhat_gpg_key
disable_dracut: true
inputs:
packages:
type: org.osbuild.files
origin: org.osbuild.source
mpp-depsolve:
architecture: $arch
ignore-weak-deps: true
module-platform-id: $distro_module_id
baseurl: $distro_baseurl/BaseOS/$arch/os/
repos:
mpp-join:
- mpp-eval: distro_repos
- mpp-eval: target_repos
- mpp-eval: extra_repos
packages:
mpp-join:
- mpp-eval: base_rpms
- mpp-eval: image_rpms
- mpp-eval: extra_rpms
- - podman
- curl
excludes:
- dracut-config-rescue
- mpp-import-pipelines:
path: include/image.ipp.yml

View File

@ -1,79 +0,0 @@
version: '2'
mpp-vars:
name: upgrade-demo
pipelines:
- mpp-import-pipelines:
path: include/build.ipp.yml
- name: rootfs
build: name:build
stages:
- type: org.osbuild.kernel-cmdline
options:
root_fs_uuid:
mpp-eval: rootfs_uuid
kernel_opts:
mpp-eval: ''' '' .join(kernel_opts)'
- type: org.osbuild.rpm
options:
gpgkeys:
- mpp-eval: centos_gpg_key
- mpp-eval: redhat_gpg_key
disable_dracut: true
exclude:
docs: true
inputs:
packages:
type: org.osbuild.files
origin: org.osbuild.source
mpp-depsolve:
architecture: $arch
ignore-weak-deps: true
module-platform-id: $distro_module_id
baseurl: $distro_baseurl/BaseOS/$arch/os/
repos:
mpp-join:
- mpp-eval: distro_repos
- mpp-eval: target_repos
- mpp-eval: extra_repos
packages:
mpp-join:
- mpp-eval: base_rpms
- mpp-eval: image_rpms
- mpp-eval: extra_rpms
# Install the watchdog tools and service files
- - autosig-sample-watchdog
- autosig-sample-staticdelta
excludes:
- dracut-config-rescue
# Make sure we only try a failed boot once before rollback (default is 3)
- type: org.osbuild.copy
inputs:
inlinefile:
type: org.osbuild.files
origin: org.osbuild.source
mpp-embed:
id: greenboot.conf
text: "GREENBOOT_MAX_BOOT_ATTEMPTS=1\n"
options:
paths:
- from:
mpp-format-string: input://inlinefile/{embedded['greenboot.conf']}
to: tree:///etc/greenboot/greenboot.conf
- type: org.osbuild.locale
options:
language: en_US.UTF-8
- type: org.osbuild.systemd
options:
enabled_services:
- NetworkManager.service
- rngd.service
# Enable the watchdog ostree/greenboot integration
- watchdog-ostree-start.service
- watchdog-ostree-stop.service
# Work around bug for now (https://github.com/coreos/rpm-ostree/issues/3554)
- type: org.osbuild.mkdir
options:
paths:
- path: /var/lib/containers
- mpp-import-pipelines:
path: include/image.ipp.yml

View File

@ -1,76 +0,0 @@
version: '2'
mpp-vars:
extra_image_rpms:
- openssh-server
- sudo
- tuned
- cloud-init
- cloud-utils-growpart
- gdisk
- NetworkManager-cloud-setup
- rsync
- qemu-guest-agent
extra_build_rpms:
- python3-pyyaml
target_stages:
- type: org.osbuild.sshd.config
options:
config:
PermitRootLogin:
mpp-eval: ssh_permit_root_login
- type: org.osbuild.systemd
options:
enabled_services:
- sshd
- NetworkManager
- nm-cloud-setup.service
- nm-cloud-setup.timer
- cloud-init
- cloud-init-local
- cloud-config
- cloud-final
- reboot.target
- tuned
default_target: multi-user.target
- type: org.osbuild.systemd-logind
options:
filename: 00-getty-fixes.conf
config:
Login:
NAutoVTs: 0
- type: org.osbuild.cloud-init
options:
filename: 00-cs-default-user.cfg
config:
system_info:
default_user:
name: ec2-user
- type: org.osbuild.systemd.unit
options:
unit: nm-cloud-setup.service
dropin: 10-enable-for-ec2.conf
config:
Service:
Environment: NM_CLOUD_SETUP_EC2=yes
- type: org.osbuild.locale
options:
language: en_US.UTF-8
- type: org.osbuild.timezone
options:
zone: UTC
- type: org.osbuild.chrony
options:
servers:
- hostname: 169.254.169.123
prefer: true
iburst: true
minpoll: 4
maxpoll: 4
leapsectz: ""
- type: org.osbuild.keymap
options:
keymap: us
x11-keymap:
layouts:
- us
pipelines: []

View File

@ -1,88 +0,0 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: MIT-0
set -e
[ "$DEBUG" == 'true' ] && set -x
ARGC=$#
if [ $ARGC -ne 3 ]; then
echo "USAGE: $(basename $0) <Image Path> <S3 Bucket Name> <AMI Image Size in GB>"
exit 1
fi
IMAGE_FILE_PATH=$1
IMPORT_BUCKET_NAME=$2
AMI_DISK_SIZE_GB=$3
declare -A ARCHS_MAP=( ["x86_64"]="x86_64" ["aarch64"]="arm64")
IMAGE_NAME="$(basename -- ${IMAGE_FILE_PATH})"
AMI_NAME="${IMAGE_NAME%.*}"
IMAGE_ARCH="${AMI_NAME##*.}"
TMPDIR=$(mktemp -d)
IMAGE_IMPORT_JSON_FILE="${TMPDIR}/image-import.json"
AMI_REGISTER_JSON_FILE="${TMPDIR}/register-ami.json"
aws s3 cp "${IMAGE_FILE_PATH}" "s3://${IMPORT_BUCKET_NAME}"
cat <<EOF > "${IMAGE_IMPORT_JSON_FILE}"
{
"Description": "CentOS Stream 9 with Container support",
"Format": "RAW",
"UserBucket": {
"S3Bucket": "${IMPORT_BUCKET_NAME}",
"S3Key": "${IMAGE_NAME}"
}
}
EOF
echo "Importing image file into snapshot "
IMPORT_TASK_ID=$(aws ec2 import-snapshot --disk-container "file://${IMAGE_IMPORT_JSON_FILE}" | jq -r '.ImportTaskId')
IMPORT_STATUS=$(aws ec2 describe-import-snapshot-tasks --import-task-ids $IMPORT_TASK_ID | jq -r '.ImportSnapshotTasks[].SnapshotTaskDetail.Status')
x=0
while [ "$IMPORT_STATUS" = "active" ] && [ $x -lt 120 ]
do
IMPORT_STATUS=$(aws ec2 describe-import-snapshot-tasks --import-task-ids $IMPORT_TASK_ID | jq -r '.ImportSnapshotTasks[].SnapshotTaskDetail.Status')
IMPORT_STATUS_MSG=$(aws ec2 describe-import-snapshot-tasks --import-task-ids $IMPORT_TASK_ID | jq -r '.ImportSnapshotTasks[].SnapshotTaskDetail.StatusMessage')
echo "Import Status: ${IMPORT_STATUS} / ${IMPORT_STATUS_MSG}"
x=$(( $x + 1 ))
sleep 15
done
if [ $x -eq 120 ]; then
echo "ERROR: Import task taking too long, exiting..."; exit 1;
elif [ "$IMPORT_STATUS" = "completed" ]; then
echo "Import completed Successfully"
else
echo "Import Failed, exiting"; exit 2;
fi
SNAPSHOT_ID=$(aws ec2 describe-import-snapshot-tasks --import-task-ids $IMPORT_TASK_ID | jq -r '.ImportSnapshotTasks[].SnapshotTaskDetail.SnapshotId')
aws ec2 wait snapshot-completed --snapshot-ids $SNAPSHOT_ID
echo "Registering AMI with Snapshot $SNAPSHOT_ID"
cat <<EOF > "${AMI_REGISTER_JSON_FILE}"
{
"Architecture": "${ARCHS_MAP[$IMAGE_ARCH]}",
"BlockDeviceMappings": [
{
"DeviceName": "/dev/sda1",
"Ebs": {
"DeleteOnTermination": true,
"SnapshotId": "${SNAPSHOT_ID}",
"VolumeSize": ${AMI_DISK_SIZE_GB},
"VolumeType": "gp2"
}
}
],
"Description": "CS9 image with container support for ${IMAGE_ARCH}",
"RootDeviceName": "/dev/sda1",
"BootMode": "uefi",
"VirtualizationType": "hvm",
"EnaSupport": true
}
EOF
aws ec2 register-image --name ${AMI_NAME} --cli-input-json="file://${AMI_REGISTER_JSON_FILE}"
echo "AMI name: "${AMI_NAME}

View File

@ -1,602 +0,0 @@
{
"cs9": {
"common": [
"acl-2.3.1-3.el9",
"alsa-lib-1.2.7.2-1.el9",
"alternatives-1.20-2.el9",
"annobin-10.73-3.el9",
"audit-3.0.7-103.el9",
"audit-libs-3.0.7-103.el9",
"autoconf-2.69-38.el9",
"automake-1.16.2-6.el9",
"basesystem-11-13.el9",
"bash-5.1.8-4.el9",
"bc-1.07.1-14.el9",
"binutils-2.35.2-24.el9",
"binutils-gold-2.35.2-24.el9",
"bison-3.7.4-5.el9",
"boost-1.75.0-8.el9",
"boost-atomic-1.75.0-8.el9",
"boost-chrono-1.75.0-8.el9",
"boost-container-1.75.0-8.el9",
"boost-context-1.75.0-8.el9",
"boost-contract-1.75.0-8.el9",
"boost-coroutine-1.75.0-8.el9",
"boost-date-time-1.75.0-8.el9",
"boost-devel-1.75.0-8.el9",
"boost-fiber-1.75.0-8.el9",
"boost-filesystem-1.75.0-8.el9",
"boost-graph-1.75.0-8.el9",
"boost-iostreams-1.75.0-8.el9",
"boost-locale-1.75.0-8.el9",
"boost-log-1.75.0-8.el9",
"boost-math-1.75.0-8.el9",
"boost-nowide-1.75.0-8.el9",
"boost-numpy3-1.75.0-8.el9",
"boost-program-options-1.75.0-8.el9",
"boost-python3-1.75.0-8.el9",
"boost-random-1.75.0-8.el9",
"boost-regex-1.75.0-8.el9",
"boost-serialization-1.75.0-8.el9",
"boost-stacktrace-1.75.0-8.el9",
"boost-system-1.75.0-8.el9",
"boost-test-1.75.0-8.el9",
"boost-thread-1.75.0-8.el9",
"boost-timer-1.75.0-8.el9",
"boost-type_erasure-1.75.0-8.el9",
"boost-wave-1.75.0-8.el9",
"brotli-1.0.9-6.el9",
"brotli-devel-1.0.9-6.el9",
"bubblewrap-0.4.1-6.el9",
"bzip2-1.0.8-8.el9",
"bzip2-devel-1.0.8-8.el9",
"bzip2-libs-1.0.8-8.el9",
"ca-certificates-2022.2.54-90.0.el9",
"cairo-1.17.4-7.el9",
"centos-gpg-keys-9.0-12.el9",
"centos-stream-release-9.0-12.el9",
"centos-stream-repos-9.0-12.el9",
"checkpolicy-3.4-1.el9",
"chrony-4.2-1.el9",
"clevis-18-102.el9",
"cmake-3.20.2-7.el9",
"cmake-data-3.20.2-7.el9",
"cmake-filesystem-3.20.2-7.el9",
"cmake-rpm-macros-3.20.2-7.el9",
"conmon-2.1.2-2.el9",
"container-selinux-2.189.0-1.el9",
"containers-common-1-39.el9",
"coreutils-8.32-32.el9",
"coreutils-common-8.32-32.el9",
"cpio-2.13-16.el9",
"cpp-11.3.1-2.1.el9",
"cracklib-2.9.6-27.el9",
"cracklib-dicts-2.9.6-27.el9",
"criu-3.17-2.el9",
"criu-libs-3.17-2.el9",
"crun-1.4.5-2.el9",
"crypto-policies-20220427-1.gitb2323a1.el9",
"cryptsetup-2.4.3-4.el9",
"cryptsetup-libs-2.4.3-4.el9",
"curl-7.76.1-18.el9",
"cyrus-sasl-lib-2.1.27-20.el9",
"dbus-1.12.20-5.el9",
"dbus-broker-28-5.el9",
"dbus-common-1.12.20-5.el9",
"dbus-libs-1.12.20-5.el9",
"dejavu-sans-fonts-2.37-18.el9",
"device-mapper-1.02.185-1.el9",
"device-mapper-event-1.02.185-1.el9",
"device-mapper-event-libs-1.02.185-1.el9",
"device-mapper-libs-1.02.185-1.el9",
"device-mapper-persistent-data-0.9.0-13.el9",
"dhcp-client-4.4.2-17.b1.el9",
"dhcp-common-4.4.2-17.b1.el9",
"diffutils-3.7-12.el9",
"dnf-4.12.0-2.el9",
"dnf-data-4.12.0-2.el9",
"dosfstools-4.2-3.el9",
"dracut-057-10.git20220721.el9",
"dracut-config-generic-057-10.git20220721.el9",
"dwarves-1.22-1.el9",
"dwz-0.14-3.el9",
"e2fsprogs-1.46.5-3.el9",
"e2fsprogs-libs-1.46.5-3.el9",
"ed-1.14.2-12.el9",
"efi-filesystem-4-8.el9",
"efi-srpm-macros-4-8.el9",
"efibootmgr-16-12.el9",
"efivar-libs-38-2.el9",
"elfutils-0.187-5.el9",
"elfutils-debuginfod-client-0.187-5.el9",
"elfutils-default-yama-scope-0.187-5.el9",
"elfutils-devel-0.187-5.el9",
"elfutils-libelf-0.187-5.el9",
"elfutils-libelf-devel-0.187-5.el9",
"elfutils-libs-0.187-5.el9",
"emacs-common-27.1-3.el9",
"emacs-filesystem-27.1-3.el9",
"emacs-nox-27.1-3.el9",
"expat-2.4.7-1.el9",
"file-5.39-8.el9",
"file-libs-5.39-8.el9",
"filesystem-3.16-2.el9",
"findutils-4.8.0-5.el9",
"flex-2.6.4-9.el9",
"flexiblas-3.0.4-8.el9",
"flexiblas-netlib-3.0.4-8.el9",
"flexiblas-openblas-openmp-3.0.4-8.el9",
"fontconfig-2.14.0-1.el9",
"fonts-filesystem-2.0.5-7.el9.1",
"fonts-srpm-macros-2.0.5-7.el9.1",
"freetype-2.10.4-9.el9",
"freetype-devel-2.10.4-9.el9",
"fuse-2.9.9-15.el9",
"fuse-common-3.10.2-5.el9",
"fuse-libs-2.9.9-15.el9",
"fuse-overlayfs-1.9-1.el9",
"fuse3-3.10.2-5.el9",
"fuse3-libs-3.10.2-5.el9",
"fwupd-1.5.9-3.el9",
"gawk-5.1.0-6.el9",
"gawk-all-langpacks-5.1.0-6.el9",
"gcc-11.3.1-2.1.el9",
"gcc-c++-11.3.1-2.1.el9",
"gcc-plugin-annobin-11.3.1-2.1.el9",
"gcc-plugin-devel-11.3.1-2.1.el9",
"gdb-10.2-10.el9",
"gdb-headless-10.2-10.el9",
"gdbm-libs-1.19-4.el9",
"gettext-0.21-7.el9",
"gettext-libs-0.21-7.el9",
"ghc-srpm-macros-1.5.0-6.el9",
"git-2.31.1-2.el9.2",
"git-core-2.31.1-2.el9.2",
"git-core-doc-2.31.1-2.el9.2",
"glib2-2.68.4-5.el9",
"glib2-devel-2.68.4-5.el9",
"glibc-2.34-39.el9",
"glibc-common-2.34-39.el9",
"glibc-devel-2.34-39.el9",
"glibc-gconv-extra-2.34-39.el9",
"glibc-langpack-en-2.34-39.el9",
"gmp-6.2.0-10.el9",
"gmp-c++-6.2.0-10.el9",
"gmp-devel-6.2.0-10.el9",
"gnupg2-2.3.3-1.el9",
"gnutls-3.7.3-10.el9",
"go-srpm-macros-3.0.9-9.el9",
"gpgme-1.15.1-6.el9",
"gpm-libs-1.20.7-29.el9",
"graphite2-1.3.14-9.el9",
"graphite2-devel-1.3.14-9.el9",
"greenboot-0.14.0-3.el9",
"grep-3.6-5.el9",
"groff-base-1.22.4-10.el9",
"grub2-common-2.06-38.el9",
"grub2-tools-2.06-38.el9",
"grub2-tools-minimal-2.06-38.el9",
"gzip-1.12-1.el9",
"harfbuzz-2.7.4-8.el9",
"harfbuzz-devel-2.7.4-8.el9",
"harfbuzz-icu-2.7.4-8.el9",
"hostapd-2.10-1.el9",
"hostname-3.23-6.el9",
"ima-evm-utils-1.4-4.el9",
"info-6.7-15.el9",
"inih-49-6.el9",
"initscripts-service-10.11.4-1.el9",
"ipcalc-1.0.0-5.el9",
"iproute-5.18.0-1.el9",
"iptables-libs-1.8.8-2.el9",
"iptables-nft-1.8.8-2.el9",
"iputils-20210202-7.el9",
"jansson-2.14-1.el9",
"jbigkit-libs-2.1-23.el9",
"jitterentropy-3.4.0-1.el9",
"jose-11-3.el9",
"jq-1.6-9.el9",
"json-c-0.14-11.el9",
"json-glib-1.6.6-1.el9",
"kbd-2.4.0-8.el9",
"kbd-misc-2.4.0-8.el9",
"kernel-automotive-5.14.0-133.95.el9s",
"kernel-automotive-core-5.14.0-133.95.el9s",
"kernel-automotive-modules-5.14.0-133.95.el9s",
"kernel-headers-5.14.0-134.el9",
"kernel-srpm-macros-1.0-11.el9",
"keyutils-libs-1.6.1-4.el9",
"kmod-28-7.el9",
"kmod-libs-28-7.el9",
"kpartx-0.8.7-10.el9",
"krb5-libs-1.19.1-22.el9",
"langpacks-core-font-en-3.0-16.el9",
"less-590-1.el9",
"libacl-2.3.1-3.el9",
"libaio-0.3.111-13.el9",
"libarchive-3.5.3-3.el9",
"libassuan-2.5.5-3.el9",
"libattr-2.5.1-3.el9",
"libbabeltrace-1.5.8-10.el9",
"libblkid-2.37.4-3.el9",
"libblkid-devel-2.37.4-3.el9",
"libbpf-0.6.0-1.el9",
"libbrotli-1.0.9-6.el9",
"libcap-2.48-8.el9",
"libcap-ng-0.8.2-7.el9",
"libcbor-0.7.0-5.el9",
"libcom_err-1.46.5-3.el9",
"libcomps-0.1.18-1.el9",
"libcurl-7.76.1-18.el9",
"libcurl-devel-7.76.1-18.el9",
"libdb-5.3.28-53.el9",
"libdnf-0.67.0-1.el9",
"libdwarves1-1.22-1.el9",
"libeconf-0.4.1-2.el9",
"libedit-3.1-37.20210216cvs.el9",
"libestr-0.1.11-4.el9",
"libevent-2.1.12-6.el9",
"libfastjson-0.99.9-3.el9",
"libfdisk-2.37.4-3.el9",
"libffi-3.4.2-7.el9",
"libffi-devel-3.4.2-7.el9",
"libfido2-1.6.0-7.el9",
"libgcab1-1.4-6.el9",
"libgcc-11.3.1-2.1.el9",
"libgcrypt-1.10.0-4.el9",
"libgfortran-11.3.1-2.1.el9",
"libgomp-11.3.1-2.1.el9",
"libgpg-error-1.42-5.el9",
"libgudev-237-1.el9",
"libgusb-0.3.6-3.el9",
"libibverbs-37.2-1.el9",
"libicu-67.1-9.el9",
"libicu-devel-67.1-9.el9",
"libidn2-2.3.0-7.el9",
"libjcat-0.1.6-3.el9",
"libjose-11-3.el9",
"libjpeg-turbo-2.0.90-5.el9",
"libjpeg-turbo-devel-2.0.90-5.el9",
"libkcapi-1.3.1-3.el9",
"libkcapi-hmaccalc-1.3.1-3.el9",
"libksba-1.5.1-4.el9",
"liblockfile-1.14-9.el9",
"libluksmeta-9-12.el9",
"libmnl-1.0.4-15.el9",
"libmodulemd-2.13.0-2.el9",
"libmount-2.37.4-3.el9",
"libmount-devel-2.37.4-3.el9",
"libmpc-1.2.1-4.el9",
"libmpc-devel-1.2.1-4.el9",
"libndp-1.8-4.el9",
"libnet-1.2-6.el9",
"libnetfilter_conntrack-1.0.8-4.el9",
"libnfnetlink-1.0.1-21.el9",
"libnftnl-1.2.2-1.el9",
"libnghttp2-1.43.0-5.el9",
"libnl3-3.7.0-1.el9",
"libogg-1.3.4-6.el9",
"libogg-devel-1.3.4-6.el9",
"libpcap-1.10.0-4.el9",
"libpkgconf-1.7.3-9.el9",
"libpng-1.6.37-12.el9",
"libpng-devel-1.6.37-12.el9",
"libpsl-0.21.1-5.el9",
"libpwquality-1.4.4-8.el9",
"libqb-2.0.6-1.el9",
"librepo-1.14.2-2.el9",
"libreport-filesystem-2.15.2-6.el9",
"libseccomp-2.5.2-2.el9",
"libselinux-3.4-3.el9",
"libselinux-devel-3.4-3.el9",
"libselinux-utils-3.4-3.el9",
"libsemanage-3.4-1.el9",
"libsepol-3.4-1.1.el9",
"libsepol-devel-3.4-1.1.el9",
"libsigsegv-2.13-4.el9",
"libslirp-4.4.0-4.el9",
"libsmartcols-2.37.4-3.el9",
"libsolv-0.7.22-1.el9",
"libss-1.46.5-3.el9",
"libssh-0.9.6-3.el9",
"libssh-config-0.9.6-3.el9",
"libstdc++-11.3.1-2.1.el9",
"libstdc++-devel-11.3.1-2.1.el9",
"libtasn1-4.16.0-7.el9",
"libtiff-4.4.0-2.el9",
"libtiff-devel-4.4.0-2.el9",
"libtool-2.4.6-45.el9",
"libunistring-0.9.10-15.el9",
"libusbx-1.0.26-1.el9",
"libuser-0.63-7.el9",
"libutempter-1.2.1-6.el9",
"libuuid-2.37.4-3.el9",
"libuv-1.42.0-1.el9",
"libverto-0.3.2-3.el9",
"libvorbis-1.3.7-5.el9",
"libvorbis-devel-1.3.7-5.el9",
"libwebp-1.2.0-3.el9",
"libwebp-devel-1.2.0-3.el9",
"libX11-1.7.0-7.el9",
"libX11-common-1.7.0-7.el9",
"libXau-1.0.9-8.el9",
"libxcb-1.13.1-9.el9",
"libxcrypt-4.4.18-3.el9",
"libxcrypt-compat-4.4.18-3.el9",
"libxcrypt-devel-4.4.18-3.el9",
"libXext-1.3.4-8.el9",
"libxml2-2.9.13-2.el9",
"libxmlb-0.3.3-1.el9",
"libXrender-0.9.10-16.el9",
"libyaml-0.2.5-7.el9",
"libzstd-1.5.1-2.el9",
"libzstd-devel-1.5.1-2.el9",
"linux-firmware-automotive-20220310-132.el9s",
"linux-firmware-whence-20220509-126.el9",
"llvm-libs-14.0.5-1.el9",
"lua-libs-5.4.2-4.el9",
"lua-srpm-macros-1-6.el9",
"luksmeta-9-12.el9",
"lvm2-2.03.16-1.el9",
"lvm2-libs-2.03.16-1.el9",
"lz4-libs-1.9.3-5.el9",
"m4-1.4.19-1.el9",
"make-4.3-7.el9",
"memstrack-0.2.4-1.el9",
"mokutil-0.4.0-9.el9",
"mpfr-4.1.0-7.el9",
"mpfr-devel-4.1.0-7.el9",
"mtools-4.0.26-4.el9",
"nano-5.6.1-5.el9",
"ncurses-6.2-8.20210508.el9",
"ncurses-base-6.2-8.20210508.el9",
"ncurses-c++-libs-6.2-8.20210508.el9",
"ncurses-devel-6.2-8.20210508.el9",
"ncurses-libs-6.2-8.20210508.el9",
"net-tools-2.0-0.62.20160912git.el9",
"netavark-1.0.1-39.el9",
"nettle-3.7.3-2.el9",
"NetworkManager-1.39.10-1.el9",
"NetworkManager-libnm-1.39.10-1.el9",
"nftables-1.0.4-2.el9",
"npth-1.6-8.el9",
"nss-altfiles-2.18.1-20.el9",
"ocaml-srpm-macros-6-6.el9",
"oniguruma-6.9.6-1.el9.5",
"openblas-0.3.15-3.el9",
"openblas-openmp-0.3.15-3.el9",
"openblas-srpm-macros-2-11.el9",
"openldap-2.6.2-2.el9",
"openldap-compat-2.6.2-2.el9",
"openssh-8.7p1-19.el9",
"openssh-clients-8.7p1-19.el9",
"openssh-server-8.7p1-19.el9",
"openssl-3.0.1-38.el9",
"openssl-devel-3.0.1-38.el9",
"openssl-libs-3.0.1-38.el9",
"openssl-pkcs11-0.4.11-7.el9",
"opus-1.3.1-10.el9",
"opus-devel-1.3.1-10.el9",
"os-prober-1.77-9.el9",
"ostree-2022.3-2.el9",
"ostree-libs-2022.3-2.el9",
"p11-kit-0.24.1-2.el9",
"p11-kit-trust-0.24.1-2.el9",
"pam-1.5.1-12.el9",
"passwd-0.80-12.el9",
"patch-2.7.6-16.el9",
"pcre-8.44-3.el9.3",
"pcre-cpp-8.44-3.el9.3",
"pcre-devel-8.44-3.el9.3",
"pcre-utf16-8.44-3.el9.3",
"pcre-utf32-8.44-3.el9.3",
"pcre2-10.40-2.el9",
"pcre2-devel-10.40-2.el9",
"pcre2-syntax-10.40-2.el9",
"pcre2-utf16-10.40-2.el9",
"pcre2-utf32-10.40-2.el9",
"perl-AutoSplit-5.74-479.el9",
"perl-B-1.80-479.el9",
"perl-base-2.27-479.el9",
"perl-Benchmark-1.23-479.el9",
"perl-Carp-1.50-460.el9",
"perl-Class-Struct-0.66-479.el9",
"perl-constant-1.33-461.el9",
"perl-Data-Dumper-2.174-462.el9",
"perl-devel-5.32.1-479.el9",
"perl-Devel-PPPort-3.62-4.el9",
"perl-DynaLoader-1.47-479.el9",
"perl-Encode-3.08-462.el9",
"perl-Errno-1.30-479.el9",
"perl-Error-0.17029-7.el9",
"perl-Exporter-5.74-461.el9",
"perl-ExtUtils-Command-7.60-3.el9",
"perl-ExtUtils-Constant-0.25-479.el9",
"perl-ExtUtils-Install-2.20-4.el9",
"perl-ExtUtils-MakeMaker-7.60-3.el9",
"perl-ExtUtils-Manifest-1.73-4.el9",
"perl-ExtUtils-ParseXS-3.40-460.el9",
"perl-Fcntl-1.13-479.el9",
"perl-File-Basename-2.85-479.el9",
"perl-File-Compare-1.100.600-479.el9",
"perl-File-Copy-2.34-479.el9",
"perl-File-Find-1.37-479.el9",
"perl-File-Path-2.18-4.el9",
"perl-File-stat-1.09-479.el9",
"perl-File-Temp-0.231.100-4.el9",
"perl-Getopt-Long-2.52-4.el9",
"perl-Getopt-Std-1.12-479.el9",
"perl-Git-2.31.1-2.el9.2",
"perl-HTTP-Tiny-0.076-460.el9",
"perl-if-0.60.800-479.el9",
"perl-interpreter-5.32.1-479.el9",
"perl-IO-1.43-479.el9",
"perl-IPC-Open3-1.21-479.el9",
"perl-lib-0.65-479.el9",
"perl-libs-5.32.1-479.el9",
"perl-locale-1.09-479.el9",
"perl-MIME-Base64-3.16-4.el9",
"perl-mro-1.23-479.el9",
"perl-overload-1.31-479.el9",
"perl-overloading-0.02-479.el9",
"perl-parent-0.238-460.el9",
"perl-PathTools-3.78-461.el9",
"perl-Pod-Escapes-1.07-460.el9",
"perl-Pod-Perldoc-3.28.01-461.el9",
"perl-Pod-Simple-3.42-4.el9",
"perl-Pod-Usage-2.01-4.el9",
"perl-podlators-4.14-460.el9",
"perl-POSIX-1.94-479.el9",
"perl-Scalar-List-Utils-1.56-461.el9",
"perl-SelectSaver-1.02-479.el9",
"perl-Socket-2.031-4.el9",
"perl-srpm-macros-1-41.el9",
"perl-Storable-3.21-460.el9",
"perl-subs-1.03-479.el9",
"perl-Symbol-1.08-479.el9",
"perl-Term-ANSIColor-5.01-461.el9",
"perl-Term-Cap-1.17-460.el9",
"perl-TermReadKey-2.38-11.el9",
"perl-Test-Harness-3.42-461.el9",
"perl-Text-ParseWords-3.30-460.el9",
"perl-Text-Tabs+Wrap-2013.0523-460.el9",
"perl-Thread-Queue-3.14-460.el9",
"perl-threads-2.25-460.el9",
"perl-threads-shared-1.61-460.el9",
"perl-Time-Local-1.300-7.el9",
"perl-vars-1.05-479.el9",
"perl-version-0.99.28-4.el9",
"pigz-2.5-4.el9",
"pixman-0.40.0-5.el9",
"pkgconf-1.7.3-9.el9",
"pkgconf-m4-1.7.3-9.el9",
"pkgconf-pkg-config-1.7.3-9.el9",
"podman-4.1.1-3.el9",
"podman-catatonit-4.1.1-3.el9",
"policycoreutils-3.4-1.el9",
"policycoreutils-python-utils-3.4-1.el9",
"polkit-0.117-10.el9",
"polkit-libs-0.117-10.el9",
"polkit-pkla-compat-0.1-21.el9",
"popt-1.18-8.el9",
"procps-ng-3.3.17-5.el9",
"protobuf-3.14.0-13.el9",
"protobuf-c-1.3.3-12.el9",
"psmisc-23.4-3.el9",
"publicsuffix-list-dafsa-20210518-3.el9",
"python-rpm-macros-3.9-52.el9",
"python-srpm-macros-3.9-52.el9",
"python-unversioned-command-3.9.13-2.el9",
"python3-3.9.13-2.el9",
"python3-audit-3.0.7-103.el9",
"python3-devel-3.9.13-2.el9",
"python3-dnf-4.12.0-2.el9",
"python3-gpg-1.15.1-6.el9",
"python3-hawkey-0.67.0-1.el9",
"python3-iniparse-0.4-45.el9",
"python3-libcomps-0.1.18-1.el9",
"python3-libdnf-0.67.0-1.el9",
"python3-libs-3.9.13-2.el9",
"python3-libselinux-3.4-3.el9",
"python3-libsemanage-3.4-1.el9",
"python3-numpy-1.20.1-5.el9",
"python3-packaging-20.9-5.el9",
"python3-pip-wheel-21.2.3-6.el9",
"python3-policycoreutils-3.4-1.el9",
"python3-pyparsing-2.4.7-9.el9",
"python3-rpm-4.16.1.3-15.el9",
"python3-rpm-generators-12-8.el9",
"python3-rpm-macros-3.9-52.el9",
"python3-setools-4.4.0-5.el9",
"python3-setuptools-53.0.0-10.el9",
"python3-setuptools-wheel-53.0.0-10.el9",
"python3-six-1.15.0-9.el9",
"qemu-img-7.0.0-8.el9",
"qt5-srpm-macros-5.15.3-1.el9",
"readline-8.1-4.el9",
"redhat-rpm-config-196-1.el9",
"rng-tools-6.15-1.el9",
"rootfiles-8.1-31.el9",
"rpm-4.16.1.3-15.el9",
"rpm-build-4.16.1.3-15.el9",
"rpm-build-libs-4.16.1.3-15.el9",
"rpm-libs-4.16.1.3-15.el9",
"rpm-ostree-2022.8-3.el9",
"rpm-ostree-libs-2022.8-3.el9",
"rpm-plugin-selinux-4.16.1.3-15.el9",
"rpm-sign-libs-4.16.1.3-15.el9",
"rsyslog-8.2102.0-105.el9",
"rust-srpm-macros-17-4.el9",
"sed-4.8-9.el9",
"selinux-policy-34.1.38-1.el9",
"selinux-policy-targeted-34.1.38-1.el9",
"setup-2.13.7-7.el9",
"shadow-utils-4.9-4.el9",
"shadow-utils-subid-4.9-4.el9",
"shared-mime-info-2.1-4.el9",
"skopeo-1.9.0-1.el9",
"slirp4netns-1.2.0-2.el9",
"source-highlight-3.1.9-11.el9",
"sqlite-3.34.1-5.el9",
"sqlite-devel-3.34.1-5.el9",
"sqlite-libs-3.34.1-5.el9",
"strace-5.18-2.el9",
"sudo-1.9.5p2-7.el9",
"sysprof-capture-devel-3.40.1-3.el9",
"systemd-250-7.el9",
"systemd-libs-250-7.el9",
"systemd-pam-250-7.el9",
"systemd-rpm-macros-250-7.el9",
"systemd-udev-250-7.el9",
"systemtap-sdt-devel-4.7-2.el9",
"tar-1.34-5.el9",
"tpm2-tools-5.2-1.el9",
"tpm2-tss-3.0.3-7.el9",
"tzdata-2022a-1.el9",
"unzip-6.0-56.el9",
"usbguard-1.0.0-10.el9",
"userspace-rcu-0.12.1-6.el9",
"util-linux-2.37.4-3.el9",
"util-linux-core-2.37.4-3.el9",
"vim-common-8.2.2637-16.el9",
"vim-enhanced-8.2.2637-16.el9",
"vim-filesystem-8.2.2637-16.el9",
"wget-1.21.1-7.el9",
"which-2.21-28.el9",
"wpa_supplicant-2.10-4.el9",
"xfsprogs-5.14.2-1.el9",
"xml-common-0.6.3-58.el9",
"xz-5.2.5-8.el9",
"xz-devel-5.2.5-8.el9",
"xz-libs-5.2.5-8.el9",
"yajl-2.1.0-20.el9",
"yum-4.12.0-2.el9",
"zip-3.0-33.el9",
"zlib-1.2.11-33.el9",
"zlib-devel-1.2.11-33.el9",
"zstd-1.5.1-2.el9"
],
"arch": {
"aarch64": [
"grub2-efi-aa64-2.06-38.el9",
"grub2-efi-aa64-cdboot-2.06-38.el9",
"libasan-11.3.1-2.1.el9",
"libatomic-11.3.1-2.1.el9",
"libubsan-11.3.1-2.1.el9",
"shim-aa64-15-15.el8_2"
],
"x86_64": [
"glibc-headers-2.34-39.el9",
"grub2-efi-x64-2.06-38.el9",
"grub2-efi-x64-cdboot-2.06-38.el9",
"grub2-tools-efi-2.06-38.el9",
"libipt-2.0.4-3.el9",
"libquadmath-11.3.1-2.1.el9",
"libquadmath-devel-11.3.1-2.1.el9",
"libsmbios-2.4.3-4.el9",
"microcode_ctl-20220510-1.el9",
"shim-x64-15-15.el8_2"
]
}
}
}

View File

@ -1,11 +0,0 @@
*.src.rpm
*~
CMakeCache.txt
CMakeFiles/
cmake_install.cmake
radio-client
radio-service
engine-service
auto-apps-*.tar.gz
auto-apps.spec
Makefile

View File

@ -1,35 +0,0 @@
project(auto-apps)
cmake_minimum_required (VERSION 2.10)
include(GNUInstallDirs)
find_package (vsomeip3 2.6.0 REQUIRED)
find_package( Boost 1.55 COMPONENTS system thread log REQUIRED )
set (INSTALL_LIB_DIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH "Installation directory for libraries")
set (INSTALL_BIN_DIR ${CMAKE_INSTALL_BINDIR} CACHE PATH "Installation directory for executables")
set (INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH "Installation directory for header files")
include_directories (
${Boost_INCLUDE_DIR}
${VSOMEIP_INCLUDE_DIRS}
)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
add_executable(radio-service radio-service.cpp services.hpp radio-stations.cpp)
target_link_libraries(radio-service vsomeip3 ${Boost_LIBRARIES})
add_executable(radio-client radio-client.cpp services.hpp)
target_link_libraries(radio-client vsomeip3 ${Boost_LIBRARIES})
add_executable(engine-service engine-service.cpp services.hpp)
target_link_libraries(engine-service vsomeip3 ${Boost_LIBRARIES})
install (
TARGETS radio-service radio-client engine-service
RUNTIME DESTINATION "${INSTALL_BIN_DIR}" COMPONENT bin
)

View File

@ -1,17 +0,0 @@
Permission is hereby granted, without written agreement and without
license or royalty fees, to use, copy, modify, and distribute this
software and its documentation for any purpose, provided that the
above copyright notice and the following two paragraphs appear in
all copies of this software.
IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

View File

@ -1,14 +0,0 @@
FROM centos:stream9-development AS installroot
RUN dnf update -y
# Enable copr
RUN dnf install -y 'dnf-command(copr)'
RUN dnf copr -y enable alexl/cs9-sample-images
RUN dnf install --installroot /installroot -y --nogpgcheck vsomeip3 bash \
boost-system boost-thread boost-log boost-chrono boost-date-time boost-atomic \
boost-log boost-filesystem boost-regex auto-apps
FROM scratch
COPY --from=installroot /installroot ./

View File

@ -1,17 +0,0 @@
PREFIX=registry.gitlab.com/centos/automotive/sample-images
IMAGE=${PREFIX}/demo/auto-apps
build:
podman build -f Containerfile.auto-apps -t ${IMAGE}:latest-$$(arch) .
push:
podman push ${IMAGE}:latest-$$(arch)
multiarch:
podman pull ${IMAGE}:latest-aarch64
podman pull ${IMAGE}:latest-x86_64
podman manifest rm ${IMAGE}:latest || true
podman manifest create ${IMAGE}:latest ${IMAGE}:latest-x86_64 ${IMAGE}:latest-aarch64
push-multiarch:
podman manifest push --all --format v2s2 ${IMAGE}:latest docker://${IMAGE}:latest

View File

@ -1,15 +0,0 @@
VERSION=0.1
TOPDIR=$(shell pwd)
auto-apps-$(VERSION).tar.gz:
git archive HEAD . --prefix=auto-apps-$(VERSION)/ --output=auto-apps-$(VERSION).tar.gz
srpm: auto-apps-$(VERSION).tar.gz auto-apps.spec.in
sed s/@@VERSION@@/$(VERSION)/g auto-apps.spec.in > auto-apps.spec
rpmbuild -bs --define "_srcrpmdir $(TOPDIR)" --define "_sourcedir $(TOPDIR)" auto-apps.spec
rpm: auto-apps-$(VERSION).tar.gz auto-apps.spec.in
sed s/@@VERSION@@/$(VERSION)/g auto-apps.spec.in > auto-apps.spec
rpmbuild -ba --define "_srcrpmdir $(TOPDIR)" --define "_sourcedir $(TOPDIR)" auto-apps.spec

View File

@ -1,67 +0,0 @@
# Sample automotive applications
This directory contains a set of applications that demonstrate how
typical automotive applications use SOME/IP to talk to each
other. These apps work both natively and in a container, as
demonstated by the container sample image [described
here](https://sigs.centos.org/automotive/building/containers/).
## The apps
### engine-service
This is a very simple service with a single event that signals that
the car is reversing, which is regularly emitted.
### radio-service
This is a service that emulates a radio, regularly publishing
information about the current song, radio station and volume. It
accepts requests to turn on/off, switch channel, and change volume.
If the engine service is available it will listen for events from it
and temporarily lower the volume while reversing.
### radio-client
This is a command line program that displays the current state of the
radio service, as well as allow you to control it. The keyboard controls
are displayed on the screen.
## Building
The apps depend on boost and vsomeip3, and can be build with cmake like this:
```
$ cmake .
$ make
```
There is also a makefile that allows building rpms and srpms:
```
$ make -f Makefile.rpm srpm
$ make -f Makefile.rpm rpm
```
These rpms, in addition to required dependencies (dlt-daemon,
vsomeip3) are pre-build for cs9 it in [this copr
repo](https://copr.fedorainfracloud.org/coprs/alexl/cs9-sample-images/packages/).
Additionally, there is a
[Containerfile.auto-apps](Containerfile.auto-apps) file that allows
installing these apps into a container, using the above rpms. You can
build it like this:
```
$ podman build -f Containerfile.auto-apps
```
Or use the Makefile.container helpers:
```
$ make -f Makefile.container build
```
A pre-built version of these containers for aarch64 and x86-64 is
available in the [automotive sig container
repo](https://gitlab.com/CentOS/automotive/sample-images/container_registry/2944592).

View File

@ -1,32 +0,0 @@
Name: auto-apps
Version: @@VERSION@@
Release: 1%{?dist}
Summary: Sample auto apps
License: MIT
Source0: auto-apps-%{version}.tar.gz
BuildRequires: cmake make gcc-c++ boost-devel vsomeip3-devel
%description
Sample auto applications
%prep
%autosetup
%build
%cmake
%cmake_build
%install
%cmake_install
%files
%{_bindir}/engine-service
%{_bindir}/radio-client
%{_bindir}/radio-service
%changelog
* Mon Mar 14 2022 Alexander Larsson <alexl@redhat.com>
- Initial version

View File

@ -1,181 +0,0 @@
#include <csignal>
#include <iostream>
#include <condition_variable>
#include <thread>
#include <chrono>
using namespace std::literals::chrono_literals;
#include <vsomeip/vsomeip.hpp>
#include "services.hpp"
class engine_service {
public:
engine_service() :
app(vsomeip::runtime::get()->create_application("Engine")),
is_registered(false),
main_blocked(false),
main_running(true),
in_reverse(false),
is_offered(false),
main_thread(std::bind(&engine_service::run, this)) {
}
bool init() {
std::lock_guard<std::mutex> its_lock(main_mutex);
if (!app->init()) {
std::cerr << "Couldn't initialize application" << std::endl;
return false;
}
app->register_state_handler(
std::bind(&engine_service::on_state, this,
std::placeholders::_1));
app->register_message_handler(
ENGINE_SERVICE_ID,
ENGINE_INSTANCE_ID,
ENGINE_GET_REVERSE_METHOD_ID,
std::bind(&engine_service::on_get_reverse, this,
std::placeholders::_1));
std::set<vsomeip::eventgroup_t> its_groups;
its_groups.insert(ENGINE_EVENTGROUP_ID);
app->offer_event(
ENGINE_SERVICE_ID,
ENGINE_INSTANCE_ID,
ENGINE_REVERSE_EVENT_ID,
its_groups,
vsomeip::event_type_e::ET_FIELD, std::chrono::milliseconds::zero(),
false, true, nullptr, vsomeip::reliability_type_e::RT_UNKNOWN);
main_blocked = true;
main_condition.notify_one();
return true;
}
void start() {
app->start();
}
void stop() {
main_running = false;
main_blocked = true;
main_condition.notify_one();
app->clear_all_handler();
stop_offer();
main_thread.join();
app->stop();
}
void offer() {
app->offer_service(ENGINE_SERVICE_ID, ENGINE_INSTANCE_ID);
is_offered = true;
}
void stop_offer() {
app->stop_offer_service(ENGINE_SERVICE_ID, ENGINE_INSTANCE_ID);
}
void on_state(vsomeip::state_type_e _state) {
std::cout << "Application " << app->get_name() << " is "
<< (_state == vsomeip::state_type_e::ST_REGISTERED ?
"registered." : "deregistered.") << std::endl;
if (_state == vsomeip::state_type_e::ST_REGISTERED) {
if (!is_registered) {
is_registered = true;
}
} else {
is_registered = false;
}
}
// Call with lock held
std::shared_ptr<vsomeip::payload> get_reverse_payload() {
return payload_with_arg (in_reverse ? 1 : 0);
}
void on_get_reverse(const std::shared_ptr<vsomeip::message> &_message) {
std::cout << "ENGINE: Received get_reverse" << std::endl;
std::shared_ptr<vsomeip::message> its_response = vsomeip::runtime::get()->create_response(_message);
{
std::lock_guard<std::mutex> its_lock(main_mutex);
its_response->set_payload(get_reverse_payload());
}
app->send(its_response);
}
void run() {
std::unique_lock<std::mutex> its_lock(main_mutex);
while (!main_blocked)
main_condition.wait(its_lock);
offer();
while (main_running) {
auto timeout = 10s;
if (in_reverse) {
timeout = 4s;
std::cout << "ENGINE: Reversing..." << std::endl;
} else {
std::cout << "ENGINE: Driving..." << std::endl;
}
// Sleep a bit
bool timed_out = main_condition.wait_for(its_lock, timeout) == std::cv_status::timeout;
if (timed_out) {
// Change direction
in_reverse = !in_reverse;
std::shared_ptr<vsomeip::payload> payload = get_reverse_payload();
app->notify(ENGINE_SERVICE_ID, ENGINE_INSTANCE_ID, ENGINE_REVERSE_EVENT_ID, payload);
}
}
}
private:
std::shared_ptr<vsomeip::application> app;
bool is_registered;
// main_blocked / is_offered must be initialized before starting the threads!
std::thread main_thread;
std::mutex main_mutex;
std::condition_variable main_condition;
bool main_blocked;
bool main_running;
bool is_offered;
// Engine state:
bool in_reverse;
};
engine_service *its_engine_ptr(nullptr);
static void handle_signal(int _signal) {
if (its_engine_ptr != nullptr &&
(_signal == SIGINT || _signal == SIGTERM))
its_engine_ptr->stop();
}
int main() {
engine_service its_engine;
its_engine_ptr = &its_engine;
signal(SIGINT, handle_signal);
signal(SIGTERM, handle_signal);
if (!its_engine.init()) {
return 1;
}
its_engine.start();
// Work around dlt-daemon timeout on exit
_exit(0);
}

View File

@ -1,266 +0,0 @@
#include <iomanip>
#include <iostream>
#include <condition_variable>
#include <thread>
#include <stdio.h>
#include <unistd.h>
#include <termios.h>
#include <vsomeip/vsomeip.hpp>
using namespace std::literals::chrono_literals;
#include "services.hpp"
std::shared_ptr< vsomeip::application > app;
std::mutex mutex;
std::condition_variable condition;
bool running = true;
bool data_changed = false;
bool service_available = false;
bool in_reverse = false;
std::string radio_station = "";
std::string song = "";
std::string artist = "";
uint32_t volume = 0;
bool sent_off = false;
static std::string volume_meter(uint32_t volume)
{
std::string vol_str = "";
for (uint32_t i = 0; i <= 20; i++) {
if (volume > i * 5 || volume == 100)
vol_str += "#";
else
vol_str += " ";
}
return vol_str;
}
void on_volume_message(const std::shared_ptr<vsomeip::message> &_event) {
std::unique_lock<std::mutex> its_lock(mutex);
volume = get_arg0(_event);
data_changed = true;
condition.notify_one();
}
void on_song_message(const std::shared_ptr<vsomeip::message> &_event) {
std::unique_lock<std::mutex> its_lock(mutex);
song = get_arg0_string(_event);
data_changed = true;
condition.notify_one();
}
void on_artist_message(const std::shared_ptr<vsomeip::message> &_event) {
std::unique_lock<std::mutex> its_lock(mutex);
artist = get_arg0_string(_event);
data_changed = true;
condition.notify_one();
}
void on_station_message(const std::shared_ptr<vsomeip::message> &_event) {
radio_station = get_arg0_string(_event);
data_changed = true;
condition.notify_one();
}
void input_thread() {
while (true) {
int c = getchar();
switch (c) {
case 'q':
{
std::unique_lock<std::mutex> its_lock(mutex);
running = false;
condition.notify_one();
app->stop();
}
return; /* End thread */
break;
case '+':
{
std::shared_ptr< vsomeip::message > request = new_request (RADIO_CHANGE_VOLUME_METHOD_ID, 10);
app->send(request);
}
break;
case '-':
{
std::shared_ptr< vsomeip::message > request = new_request (RADIO_CHANGE_VOLUME_METHOD_ID, (uint32_t)(int32_t)-10);
app->send(request);
}
break;
case ' ':
{
std::shared_ptr< vsomeip::message > request = new_request (RADIO_SWITCH_STATION_METHOD_ID, 0);
app->send(request);
}
break;
case '\e':
{
std::shared_ptr< vsomeip::message > request = new_request (RADIO_SET_PLAYING_METHOD_ID, sent_off ? 1 : 0);
sent_off = !sent_off;
app->send(request);
}
break;
default:
// pass
break;
}
}
}
void run() {
std::unique_lock<std::mutex> its_lock(mutex);
app->register_message_handler(
RADIO_SERVICE_ID, RADIO_INSTANCE_ID, RADIO_VOLUME_EVENT_ID,
on_volume_message);
app->register_message_handler(
RADIO_SERVICE_ID, RADIO_INSTANCE_ID, RADIO_STATION_EVENT_ID,
on_station_message);
app->register_message_handler(
RADIO_SERVICE_ID, RADIO_INSTANCE_ID, RADIO_SONG_EVENT_ID,
on_song_message);
app->register_message_handler(
RADIO_SERVICE_ID, RADIO_INSTANCE_ID, RADIO_ARTIST_EVENT_ID,
on_artist_message);
std::set<vsomeip::eventgroup_t> its_groups;
its_groups.insert(RADIO_EVENTGROUP_ID);
app->request_event(RADIO_SERVICE_ID,
RADIO_INSTANCE_ID,
RADIO_SONG_EVENT_ID,
its_groups,
vsomeip::event_type_e::ET_FIELD);
app->request_event(RADIO_SERVICE_ID,
RADIO_INSTANCE_ID,
RADIO_ARTIST_EVENT_ID,
its_groups,
vsomeip::event_type_e::ET_FIELD);
app->request_event(RADIO_SERVICE_ID,
RADIO_INSTANCE_ID,
RADIO_VOLUME_EVENT_ID,
its_groups,
vsomeip::event_type_e::ET_FIELD);
app->request_event(RADIO_SERVICE_ID,
RADIO_INSTANCE_ID,
RADIO_STATION_EVENT_ID,
its_groups,
vsomeip::event_type_e::ET_FIELD);
app->subscribe(RADIO_SERVICE_ID, RADIO_INSTANCE_ID, RADIO_EVENTGROUP_ID);
while (running) {
if (data_changed) {
std::cout
<< "\e[s" // Save cursor
<< "\e[6;1H" // Goto row 6
<< "\e[1J" // Clear to start of screen
<< "\e[1;1H" // Goto row 1;
;
if (service_available) {
std::cout
<< "Station: " << radio_station << std::endl
<< "Song: " << song << std::endl
<< "Artist: " << artist << std::endl
<< "Volume: [" << volume_meter(volume) << "] " << std::endl
<< (in_reverse ?
"------------------------------[REVERSING]-" :
"------------------------------------------")
<< std::endl;
} else {
std::cout
<< "Connecting to radio service";
}
std::cout
<< "\e[u" // Restore cursor
<< std::flush;
data_changed = false;
}
condition.wait_for(its_lock, 5s);
}
}
void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) {
std::unique_lock<std::mutex> its_lock(mutex);
service_available = _is_available;
data_changed = true;
condition.notify_one();
}
void on_engine_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) {
std::unique_lock<std::mutex> its_lock(mutex);
if (!_is_available)
{
in_reverse = false;
data_changed = true;
condition.notify_one();
}
}
void on_engine_reverse_event(const std::shared_ptr<vsomeip::message> &_event) {
std::unique_lock<std::mutex> its_lock(mutex);
bool reversed = get_arg0(_event) != 0;
in_reverse = reversed;
data_changed = true;
condition.notify_one();
}
int main(int argc, const char *argv[]) {
struct termios old_tio, new_tio;
unsigned char c;
tcgetattr(STDIN_FILENO,&old_tio);
new_tio=old_tio;
/* disable canonical mode (buffered i/o) and local echo */
new_tio.c_lflag &=(~ICANON & ~ECHO);
tcsetattr(STDIN_FILENO,TCSANOW,&new_tio);
std::cout
<< "\e[2J" // Clear screen
<< "\e[1;1H" // Goto row 1
<< "\e[6;1H" // Goto row 6
<< " Usage: volume: +/-, station: SPACE on/off: ESC, quit: Q" << std::endl;
app = vsomeip::runtime::get()->create_application("Radio client");
app->init();
app->register_availability_handler(RADIO_SERVICE_ID, RADIO_INSTANCE_ID, on_availability);
app->request_service(RADIO_SERVICE_ID, RADIO_INSTANCE_ID);
app->register_availability_handler(ENGINE_SERVICE_ID, ENGINE_INSTANCE_ID, on_engine_availability);
app->request_service(ENGINE_SERVICE_ID, ENGINE_INSTANCE_ID);
std::set<vsomeip::eventgroup_t> its_groups;
its_groups.insert(ENGINE_EVENTGROUP_ID);
app->request_event(ENGINE_SERVICE_ID,
ENGINE_INSTANCE_ID,
ENGINE_REVERSE_EVENT_ID,
its_groups,
vsomeip::event_type_e::ET_FIELD);
app->subscribe(ENGINE_SERVICE_ID, ENGINE_INSTANCE_ID, ENGINE_EVENTGROUP_ID);
app->register_message_handler(ENGINE_SERVICE_ID, ENGINE_INSTANCE_ID, ENGINE_REVERSE_EVENT_ID,
on_engine_reverse_event);
std::thread input(input_thread);
std::thread sender(run);
app->start();
sender.join();
input.join();
app->clear_all_handler();
app->release_service(RADIO_SERVICE_ID, RADIO_INSTANCE_ID);
app->release_service(ENGINE_SERVICE_ID, ENGINE_INSTANCE_ID);
tcsetattr(STDIN_FILENO,TCSANOW,&old_tio);
// Work around dlt-daemon timeout on exit
_exit(0);
return 0;
}

View File

@ -1,437 +0,0 @@
#include <csignal>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <cstdlib>
#include <condition_variable>
#include <thread>
#include <chrono>
using namespace std::literals::chrono_literals;
#include <vsomeip/vsomeip.hpp>
#include "services.hpp"
#include "radio-stations.hpp"
class radio_service {
public:
radio_service() :
app(vsomeip::runtime::get()->create_application("Radio")),
verbose(false),
main_blocked(false),
main_running(true),
is_offered(false),
engine_available(false),
next_volume(50),
next_radio_station(0),
next_playing(false),
next_reversed(false),
main_thread(std::bind(&radio_service::run, this)) {
}
bool init() {
std::lock_guard<std::mutex> its_lock(main_mutex);
if (!app->init()) {
std::cerr << "Couldn't initialize application" << std::endl;
return false;
}
app->register_message_handler(
RADIO_SERVICE_ID,
RADIO_INSTANCE_ID,
RADIO_SET_PLAYING_METHOD_ID,
std::bind(&radio_service::on_message_set_playing, this,
std::placeholders::_1));
app->register_message_handler(
RADIO_SERVICE_ID,
RADIO_INSTANCE_ID,
RADIO_IS_PLAYING_METHOD_ID,
std::bind(&radio_service::on_message_is_playing, this,
std::placeholders::_1));
app->register_message_handler(
RADIO_SERVICE_ID,
RADIO_INSTANCE_ID,
RADIO_GET_VOLUME_METHOD_ID,
std::bind(&radio_service::on_message_get_volume, this,
std::placeholders::_1));
app->register_message_handler(
RADIO_SERVICE_ID,
RADIO_INSTANCE_ID,
RADIO_CHANGE_VOLUME_METHOD_ID,
std::bind(&radio_service::on_message_change_volume, this,
std::placeholders::_1));
app->register_message_handler(
RADIO_SERVICE_ID,
RADIO_INSTANCE_ID,
RADIO_SWITCH_STATION_METHOD_ID,
std::bind(&radio_service::on_message_switch_station, this,
std::placeholders::_1));
std::set<vsomeip::eventgroup_t> its_groups_radio;
its_groups_radio.insert(RADIO_EVENTGROUP_ID);
app->offer_event(
RADIO_SERVICE_ID,
RADIO_INSTANCE_ID,
RADIO_VOLUME_EVENT_ID,
its_groups_radio,
vsomeip::event_type_e::ET_FIELD, std::chrono::milliseconds::zero(),
false, true, nullptr, vsomeip::reliability_type_e::RT_UNKNOWN);
app->offer_event(
RADIO_SERVICE_ID,
RADIO_INSTANCE_ID,
RADIO_STATION_EVENT_ID,
its_groups_radio,
vsomeip::event_type_e::ET_FIELD, std::chrono::milliseconds::zero(),
false, true, nullptr, vsomeip::reliability_type_e::RT_UNKNOWN);
app->offer_event(
RADIO_SERVICE_ID,
RADIO_INSTANCE_ID,
RADIO_SONG_EVENT_ID,
its_groups_radio,
vsomeip::event_type_e::ET_FIELD, std::chrono::milliseconds::zero(),
false, true, nullptr, vsomeip::reliability_type_e::RT_UNKNOWN);
app->offer_event(
RADIO_SERVICE_ID,
RADIO_INSTANCE_ID,
RADIO_ARTIST_EVENT_ID,
its_groups_radio,
vsomeip::event_type_e::ET_FIELD, std::chrono::milliseconds::zero(),
false, true, nullptr, vsomeip::reliability_type_e::RT_UNKNOWN);
app->register_availability_handler(ENGINE_SERVICE_ID, ENGINE_INSTANCE_ID,
std::bind(&radio_service::on_engine_availability, this,
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
app->request_service(ENGINE_SERVICE_ID, ENGINE_INSTANCE_ID);
std::set<vsomeip::eventgroup_t> its_groups;
its_groups.insert(ENGINE_EVENTGROUP_ID);
app->request_event(
ENGINE_SERVICE_ID,
ENGINE_INSTANCE_ID,
ENGINE_REVERSE_EVENT_ID,
its_groups,
vsomeip::event_type_e::ET_FIELD);
app->subscribe(ENGINE_SERVICE_ID, ENGINE_INSTANCE_ID, ENGINE_EVENTGROUP_ID);
app->register_message_handler(
ENGINE_SERVICE_ID, ENGINE_INSTANCE_ID, ENGINE_REVERSE_EVENT_ID,
std::bind(&radio_service::on_engine_reverse_event, this,
std::placeholders::_1));
main_blocked = true;
main_condition.notify_one();
return true;
}
void start() {
set_playing(true);
app->start();
}
void stop() {
main_running = false;
main_blocked = true;
main_condition.notify_one();
app->clear_all_handler();
app->unsubscribe(ENGINE_SERVICE_ID, ENGINE_INSTANCE_ID, ENGINE_EVENTGROUP_ID);
app->release_event(ENGINE_SERVICE_ID, ENGINE_INSTANCE_ID, ENGINE_REVERSE_EVENT_ID);
app->release_service(ENGINE_SERVICE_ID, ENGINE_INSTANCE_ID);
stop_offer();
main_thread.join();
app->stop();
}
void offer() {
app->offer_service(RADIO_SERVICE_ID, RADIO_INSTANCE_ID);
is_offered = true;
}
void stop_offer() {
app->stop_offer_service(RADIO_SERVICE_ID, RADIO_INSTANCE_ID);
}
void run() {
uint32_t current_volume = next_volume;
bool currently_playing = false;
bool current_reversed = false;
uint32_t saved_volume;
bool next_volume_is_auto = false;
bool volume_is_auto = false;
uint32_t current_station = 0xffffffff;
const radio_station_info_t *station_info = NULL;
uint32_t current_song = 0;
bool goto_next_song = true;
std::chrono::time_point<std::chrono::system_clock> next_song_at;
std::unique_lock<std::mutex> its_lock(main_mutex);
std::cout << "RADIO: Started main thread" << std::endl;
offer();
while (main_running) {
bool display = false;
if (next_reversed != current_reversed) {
if (next_reversed) {
saved_volume = current_volume;
next_volume = 30;
next_volume_is_auto = true;
std::cout << "RADIO: Lowering volume due to reverse" << std::endl;
} else {
if (volume_is_auto) {
next_volume = saved_volume;
std::cout << "RADIO: Restoring volume due to cancelled reverse" << std::endl;
}
}
current_reversed = next_reversed;
}
if (next_volume != current_volume) {
current_volume = next_volume;
volume_is_auto = next_volume_is_auto;
next_volume_is_auto = false;
display = true;
app->notify(RADIO_SERVICE_ID, RADIO_INSTANCE_ID, RADIO_VOLUME_EVENT_ID, payload_with_arg (current_volume));
}
if (next_radio_station != current_station) {
current_station = next_radio_station;
goto_next_song = true;
station_info = get_radio_stations(current_station);
display = true;
app->notify(RADIO_SERVICE_ID, RADIO_INSTANCE_ID, RADIO_STATION_EVENT_ID, payload_with_string (station_info->name));
}
if (next_playing) {
if (!currently_playing) {
std::cout << "RADIO: Started playing" << std::endl;
goto_next_song = true;
}
currently_playing = true;
if (goto_next_song) {
auto old = current_song;
do {
current_song = rand() % station_info->n_songs;
} while (old == current_song);
goto_next_song = false;
next_song_at = std::chrono::system_clock::now() + 3s + (rand() % 3000) * 1ms;
display = true;
}
if (display) {
struct song_info_t *song = &station_info->songs[current_song];
app->notify(RADIO_SERVICE_ID, RADIO_INSTANCE_ID, RADIO_SONG_EVENT_ID, payload_with_string (song->name));
app->notify(RADIO_SERVICE_ID, RADIO_INSTANCE_ID, RADIO_ARTIST_EVENT_ID, payload_with_string (song->artist));
std::cout << "RADIO: Playing song \""
<< song->name << "\" by " << song->artist
<< " (on " << station_info->name << ") "
<< std::dec << current_volume << "% volume"
<< std::endl;
}
} else {
if (currently_playing)
std::cout << "RADIO: Paused playing" << std::endl;
app->notify(RADIO_SERVICE_ID, RADIO_INSTANCE_ID, RADIO_SONG_EVENT_ID, payload_with_string ("-off-"));
app->notify(RADIO_SERVICE_ID, RADIO_INSTANCE_ID, RADIO_ARTIST_EVENT_ID, payload_with_string (""));
currently_playing = false;
}
if (main_condition.wait_until(its_lock, next_song_at) == std::cv_status::timeout) {
goto_next_song = true;
}
}
}
void on_message_set_playing(const std::shared_ptr<vsomeip::message> &_request) {
bool arg = get_arg0(_request) != 0;
bool was_playing;
if (verbose)
std::cout << "RADIO: Received set_playing "
<< arg
<< " from Client/Session ["
<< std::setw(4) << std::setfill('0') << std::hex << _request->get_client() << "/"
<< std::setw(4) << std::setfill('0') << std::hex << _request->get_session() << "] "
<< std::endl;
was_playing = set_playing (arg);
std::shared_ptr<vsomeip::message> its_response = response (_request, was_playing ? 1 : 0);
app->send(its_response);
}
void on_message_is_playing(const std::shared_ptr<vsomeip::message> &_request) {
if (verbose)
std::cout << "RADIO: Received is_playing "
<< "from Client/Session ["
<< std::setw(4) << std::setfill('0') << std::hex << _request->get_client() << "/"
<< std::setw(4) << std::setfill('0') << std::hex << _request->get_session() << "] "
<< std::endl;
std::shared_ptr<vsomeip::message> its_response = response (_request, get_playing () ? 1 : 0);
app->send(its_response);
}
void on_message_change_volume(const std::shared_ptr<vsomeip::message> &_request) {
int32_t arg = (int32_t)get_arg0(_request);
uint32_t result;
if (verbose)
std::cout << "RADIO: Received change_volume "
<< arg
<< " from Client/Session ["
<< std::setw(4) << std::setfill('0') << std::hex << _request->get_client() << "/"
<< std::setw(4) << std::setfill('0') << std::hex << _request->get_session() << "] "
<< std::endl;
result = change_volume (arg);
std::shared_ptr<vsomeip::message> its_response = response (_request, result);
app->send(its_response);
}
void on_message_get_volume(const std::shared_ptr<vsomeip::message> &_request) {
if (verbose)
std::cout << "RADIO: Received get_volume "
<< "from Client/Session ["
<< std::setw(4) << std::setfill('0') << std::hex << _request->get_client() << "/"
<< std::setw(4) << std::setfill('0') << std::hex << _request->get_session() << "] "
<< std::endl;
uint32_t volume = get_volume();
std::shared_ptr<vsomeip::message> its_response = response (_request, volume);
app->send(its_response);
}
void on_message_switch_station(const std::shared_ptr<vsomeip::message> &_request) {
if (verbose)
std::cout << "RADIO: Received switch_station "
<< "from Client/Session ["
<< std::setw(4) << std::setfill('0') << std::hex << _request->get_client() << "/"
<< std::setw(4) << std::setfill('0') << std::hex << _request->get_session() << "] "
<< std::endl;
switch_station();
std::shared_ptr<vsomeip::message> its_response = response (_request, 0);
app->send(its_response);
}
void on_engine_reverse_event(const std::shared_ptr<vsomeip::message> &_event) {
bool reversed = get_arg0(_event) != 0;
if (verbose)
std::cout << "RADIO: Received event: "
<< (reversed ? "engine reversed" : "engine forward")
<< std::endl;
set_reversed(reversed);
}
void on_engine_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) {
std::cout << "Engine Service is "
<< (_is_available ? "available." : "NOT available.")
<< std::endl;
std::lock_guard<std::mutex> its_lock(main_mutex);
engine_available = _is_available;
}
private:
bool set_playing (bool new_playing) {
std::unique_lock<std::mutex> its_lock(main_mutex);
bool old = new_playing;
if (next_playing != new_playing) {
next_playing = new_playing;
main_condition.notify_one();
}
return old;
}
bool get_playing (void) {
std::unique_lock<std::mutex> its_lock(main_mutex);
return next_playing;
}
uint32_t change_volume (int32_t delta_volume) {
std::unique_lock<std::mutex> its_lock(main_mutex);
int32_t new_volume;
new_volume = (int32_t)next_volume + delta_volume;
if (new_volume < 0)
new_volume = 0;
else {
if (new_volume > 100)
new_volume = 100;
}
if (next_volume != new_volume) {
next_volume = new_volume;
main_condition.notify_one();
}
return new_volume;
}
uint32_t get_volume (void) {
std::unique_lock<std::mutex> its_lock(main_mutex);
return next_volume;
}
void switch_station (void) {
std::unique_lock<std::mutex> its_lock(main_mutex);
next_radio_station = (next_radio_station + 1) % n_radio_stations();
main_condition.notify_one();
}
void set_reversed (bool new_reversed) {
std::unique_lock<std::mutex> its_lock(main_mutex);
next_reversed = new_reversed;
main_condition.notify_one();
}
std::shared_ptr< vsomeip::application > app;
std::thread main_thread;
std::mutex main_mutex;
std::condition_variable main_condition;
bool main_blocked;
bool main_running;
bool is_offered;
bool engine_available;
bool verbose;
uint32_t next_volume;
uint32_t next_radio_station;
bool next_playing;
bool next_reversed;
};
radio_service *its_radio_ptr(nullptr);
static void handle_signal(int _signal) {
if (its_radio_ptr != nullptr &&
(_signal == SIGINT || _signal == SIGTERM))
its_radio_ptr->stop();
}
int main() {
radio_service its_radio;
its_radio_ptr = &its_radio;
signal(SIGINT, handle_signal);
signal(SIGTERM, handle_signal);
if (!its_radio.init()) {
return 1;
}
its_radio.start();
// Work around dlt-daemon timeout on exit
_exit(0);
}

View File

@ -1,508 +0,0 @@
#include "radio-stations.hpp"
#define SONGS(_station) (_station ## _songs), sizeof(_station ## _songs)/sizeof(struct song_info_t)
static struct song_info_t radio_los_santos_songs[] = {
{ "YG", "I'm A Real 1", 2013 },
{ "100s", "Life of a Mack", 2013 },
{ "Ab-Soul feat. Kendrick Lamar", "ILLuminate", 2012 },
{ "A$AP Rocky feat. Aston Matthews & Joey Fatts", "R-Cali", 2013 },
{ "Marion Band$ feat. Nipsey Hussle", "Hold Up", 2013 },
{ "BJ the Chicago Kid feat. Freddie Gibbs & Problem", "Smokin' and Ridin'", 2013 },
{ "Kendrick Lamar", "A.D.H.D", 2011 },
{ "Jay Rock feat. Kendrick Lamar", "Hood Gone Love It", 2011 },
{ "The Game feat. 2 Chainz & Rick Ross", "Ali Bomaye", 2012 },
{ "Freddie Gibbs", "Still Livin'", 2012 },
{ "DJ Esco feat. Future", "How It Was", 2013 },
{ "Problem feat. Glasses Malone", "Say That Then", 2013 },
{ "Clyde Carson feat. The Team", "Slow Down", 2012 },
{ "Gucci Mane feat. Ciara", "Too Hood", 2011 },
{ "Gangrene", "Bassheads", 2013 },
{ "Danny Brown & Action Bronson", "Bad News", 2013 },
{ "G-Side feat. G-Mane", "Relaxin'", 2010 },
{ "A$AP Ferg", "Work", 2013 },
{ "Trouble feat. Gucci Mane", "Everyday", 2012 },
{ "Kendrick Lamar", "Swimming Pools, Drank", 2012 },
{ "Travi$ Scott feat. 2 Chainz & T.I.", "Upper Echelon", 2013 },
{ "Danny Brown feat. A$AP Rocky & Zelooperz", "Kush Coma", 2013 },
{ "Ace Hood feat. Future & Rick Ross", "Bugatti", 2013 },
{ "Schoolboy Q feat. Kendrick Lamar", "Collard Greens", 2013 },
{ "Chuck Inglish feat. Ab-Soul & Mac Miller", "Came Thru/Easily", 2013 },
{ "Young Scooter feat. Gucci Mane", "Work", 2013 },
{ "Problem & IamSu feat. Bad Lucc & Sage The Gemini", "Do It Big", 2013 },
{ "Skeme", "Millions", 2013 },
{ "Ab-Soul feat. Schoolboy Q", "Hunnid Stax", 2014 },
{ "Freddie Gibbs & Mike Dean", "Sellin' Dope", 2014 },
{ "Young Scooter feat. Trinidad James", "I Can't Wait", 2013 },
};
static struct song_info_t space_103_2_songs[] = {
{ "Bootsy's Rubber Band", "I'd Rather Be With You", 1976 },
{ "D-Train", "You're the One for Me", 1981 },
{ "Eddie Murphy", "Party All the Time", 1985 },
{ "Evelyn \"Champagne\" King", "I'm in Love, 12\" Version", 1981 },
{ "Kano", "Can't Hold Back, Your Loving", 1981 },
{ "Kleeer", "Tonight", 1984 },
{ "Bernard Wright", "Haboglabotribin", 1981 },
{ "One Way", "Cutie Pie", 1982 },
{ "Rick James", "Give It to Me Baby", 1981 },
{ "Sho Nuff", "Funkasize You", 1978 },
{ "Stevie Wonder", "Skeletons", 1987 },
{ "Taana Gardner", "Heartbeat, Club Version", 1981 },
{ "Zapp", "Heartbreaker, Pts. 1-2", 1983 },
{ "Dazz Band", "Joystick", 1983 },
{ "Roger", "Do It Roger", 1981 },
{ "Imagination", "Flashback", 1981 },
{ "Parliament", "Mothership Connection, Star Child", 1975 },
{ "The Fatback Band", "Gotta Get My Hands On Some, Money", 1979 },
{ "Billy Ocean", "Nights, Feel Like Gettin' Down", 1981 },
{ "Parliament", "Flash Light", 1977 },
{ "Cameo", "Back and Forth", 1986 },
{ "Central Line", "Walking Into Sunshine", 1981 },
};
static struct song_info_t west_cost_classics_songs[] = {
{ "2Pac", "Ambitionz Az a Ridah", 1996 },
{ "Compton's Most Wanted", "Late Night Hype", 1990 },
{ "DJ Quik", "Dollaz + Sense", 1995 },
{ "Dr. Dre feat. Snoop Dogg", "Still D.R.E", 1999 },
{ "King Tee", "Played Like a Piano", 1990 },
{ "Dr. Dre feat. Snoop Dogg, Kurupt & Nate Dogg", "The Next Episode", 1999 },
{ "Ice Cube", "You Know How We Do It", 1994 },
{ "Kausion feat. Ice Cube", "What You Wanna Do?", 1995 },
{ "Kurupt", "C-Walk", 1998 },
{ "Mack 10 & Tha Dogg Pound", "Nothin' But the Cavi Hit", 1996 },
{ "MC Eiht", "Streiht Up Menace", 1993 },
{ "N.W.A", "Appetite for Destruction", 1991 },
{ "N.W.A", "Gangsta Gangsta", 1988 },
{ "Tha Dogg Pound", "What Would U Do?", 1995 },
{ "Snoop Dogg", "Gin and Juice", 1993 },
{ "Geto Boys", "Mind Playing Tricks on Me", 1991 },
{ "Too $hort", "So You Want to Be a Gangster", 1992 },
{ "Jayo Felony", "Sherm Stick", 1995 },
{ "Warren G", "This D.J.", 1994 },
{ "CPO feat. MC Ren", "Ballad Of A Menace", 1990 },
{ "E-40 feat. The Click", "Captain Save a Hoe", 1994 },
{ "The Conscious Daughters", "We Roll Deep", 1993 },
{ "Eazy-E feat. Ice Cube", "No More ?'s", 1988 },
{ "South Central Cartel", "Servin' 'Em Heat", 1993 },
{ "The Lady of Rage feat. Snoop Dogg", "Afro Puffs", 1994 },
{ "Westside Connection", "Bow Down", 1996 },
{ "Spice 1 feat. MC Eiht", "The Murda Show", 1993 },
{ "Bone Thugs-N-Harmony", "1st of Tha Month", 1995 },
{ "Luniz feat. Michael Marshall", "I Got 5 On It", 1995 },
};
static struct song_info_t rebel_radio_songs[] = {
{ "Charlie Feathers", "Can't Hardly Stand It", 1956 },
{ "Hank Thompson", "It Don't Hurt Anymore", 1957 },
{ "Hasil Adkins", "Get Outta My Car", 1966 },
{ "Jerry Reed", "You Took All the Ramblin' Out of Me", 1972 },
{ "Johnny Cash", "The General Lee", 1981 },
{ "Johnny Paycheck", "(It Won't Be Long And I'll Be Hating You", 1968 },
{ "Ozark Mountain Daredevils", "If You Wanna Get to Heaven", 1973 },
{ "Waylon Jennings", "Are You Sure Hank Done It This Way", 1975 },
{ "Waylon Jennings", "I Ain't Living Long Like This", 1979 },
{ "Willie Nelson", "Whiskey River", 1973 },
{ "C.W. McCall", "Convoy", 1975 },
{ "Homer & Jethro", "She Made Toothpicks Of The Timber Of My Heart", 1963 },
{ "The Highwaymen", "Highwayman", 1985 },
{ "Tammy Wynette", "D-I-V-O-R-C-E", 1968 },
{ "Ray Price", "Crazy Arms", 1956 },
{ "Marvin Jackson", "Dippin' Snuff", 1957 },
{ "Charlie Feathers", "Get With It", 1956 },
};
static struct song_info_t los_santos_rock_radio_songs[] = {
{ "Billy Squier", "Lonely Is the Night", 1981 },
{ "Bob Seger & The Silver Bullet Band", "Hollywood Nights", 1978 },
{ "Bob Seger & The Silver Bullet Band", "Night Moves", 1976 },
{ "Chicago", "If You Leave Me Now", 1976 },
{ "Def Leppard", "Photograph", 1983 },
{ "Don Johnson", "Heartbeat", 1986 },
{ "Elton John", "Saturday Night's Alright for Fighting", 1973 },
{ "Foreigner", "Dirty White Boy", 1979 },
{ "Gerry Rafferty", "Baker Street", 1978 },
{ "The Greg Kihn Band", "The Breakup Song, They Don't Write 'Em", 1981 },
{ "Julian Lennon", "Too Late for Goodbyes", 1984 },
{ "Kenny Loggins", "I'm Free, Heaven Helps the Man", 1984 },
{ "Phil Collins", "I Don't Care Anymore", 1982 },
{ "Queen", "Radio Ga Ga", 1984 },
{ "Robert Plant", "Big Log", 1983 },
{ "Simple Minds", "All the Things She Said", 1985 },
{ "The Small Faces", "Ogdens' Nut Gone Flake", 1968 },
{ "Steve Winwood", "Higher Love", 1986 },
{ "Stevie Nicks", "I Can't Wait", 1985 },
{ "The Alan Parsons Project", "I Wouldn't Want To Be Like You", 1977 },
{ "The Doobie Brothers", "What a Fool Believes", 1979 },
{ "The Cult", "Rain", 1985 },
{ "Steve Miller Band", "Rock'n Me", 1976 },
{ "Creedence Clearwater Revival", "Fortunate Son", 1969 },
{ "Starship", "We Built This City", 1985 },
{ "Mountain", "Mississippi Queen", 1970 },
{ "Kenny Loggins", "Danger Zone", 1986 },
{ "Alannah Myles", "Black Velvet", 1989 },
{ "Pat Benatar", "Shadows of the Night", 1982 },
{ "Belinda Carlisle", "Circle in the Sand", 1987 },
{ "Kansas", "Carry On Wayward Son", 1976 },
{ "Boston", "Peace Of Mind", 1976 },
{ "Harry Chapin", "Cat's In the Cradle", 1974 },
{ "Survivor", "Burning Heart", 1986 },
{ "Humble Pie", "30 Days In the Hole", 1972 },
{ "ZZ Top", "Gimme All Your Lovin'", 1983 },
{ "Yes", "Roundabout", 1972 },
{ "Broken English", "Comin' On Strong", 1987 },
};
static struct song_info_t the_lowdown_songs[] = {
{ "Aaron Neville", "Hercules", 1973 },
{ "B.T. Express", "Do It, 'Til You're Satisfied", 1974 },
{ "El Chicano", "Viva Tirado", 1970 },
{ "George McCrae", "I Get Lifted", 1974 },
{ "Marlena Shaw", "California Soul", 1969 },
{ "Smokey Robinson", "Cruisin'", 1979 },
{ "The Delfonics", "Ready or Not Here I Come, Can't Hide from Love", 1968 },
{ "The Five Stairsteps", "O-O-H Child", 1970 },
{ "The Soul Searchers", "Ashley's Roachclip", 1974 },
{ "The Trammps", "Rubber Band", 1972 },
{ "The Undisputed Truth", "Smiling Faces Sometimes", 1971 },
{ "War", "The Cisco Kid", 1973 },
{ "Pleasure", "Bouncy Lady", 1975 },
{ "The Delfonics", "Funny Feeling", 1970 },
{ "Ohio Players", "Climax", 1974 },
{ "The Chakachas", "Stories", 1972 },
{ "Eric Burdon & War", "Magic Mountain", 1976 },
{ "Johnny \"Guitar\" Watson", "Superman Lover", 1976 },
{ "The Jackson Sisters", "I Believe In Miracles", 1973 },
{ "Brass Construction", "Changin'", 1975 },
};
static struct song_info_t the_blue_ark_songs[] = {
{ "Chronixx", "Odd Ras", 2012 },
{ "Dennis Brown", "Money In My Pocket", 1972 },
{ "Gregory Isaacs", "Night Nurse", 1982 },
{ "Half Pint", "Crazy Girl", 1997 },
{ "Joe Gibbs & The Professionals", "Chapter Three", 1978 },
{ "Junior Delgado", "Sons Of Slaves", 1977 },
{ "Konshens", "Gun Shot A Fire", 2012 },
{ "Lee \"Scratch\" Perry & The Upsetters", "I Am A Madman", 1986 },
{ "Lee \"Scratch\" Perry & The Full Experience", "Disco Devil", 1977 },
{ "The Upsetters", "Grumblin' Dub", 1977 },
{ "Tommy Lee Sparta", "Psycho", 2012 },
{ "Vybz Kartel feat. Popcaan", "We Never Fear Dem", 2011 },
{ "Yellowman", "Nobody Move, Nobody Get Hurt", 1984 },
{ "Protoje", "Kingston Be Wise", 2012 },
{ "Demarco", "Loyal, Royals Remix", 2014 },
{ "Busy Signal feat. Damian \"Jr. Gong\" Marley", "Kingston Town, Remix", 2012 },
{ "I-Octane", "Topic of the Day", 2011 },
{ "Vybz Kartel", "Addi Truth", 2014 },
{ "Lee \"Scratch\" Perry", "Money Come and Money Go", 2010 },
{ "Lee \"Scratch\" Perry", "Roast Fish & Cornbread", 1978 },
{ "Danny Hensworth", "Mr. Money Man", 1978 },
};
static struct song_info_t non_stop_pop_songs[] = {
{ "All Saints", "Pure Shores", 1999 },
{ "Britney Spears", "Gimme More", 2007 },
{ "Corona", "The Rhythm of the Night, Rapino Bros. 7'' Single", 1993 },
{ "Fergie feat. Ludacris", "Glamorous", 2006 },
{ "Hall & Oates", "Adult Education", 1983 },
{ "Jane Child", "Don't Wanna Fall In Love", 1990 },
{ "Kelly Rowland", "Work, Freemasons Remix", 2007 },
{ "Mis-Teeq", "Scandalous", 2003 },
{ "Modjo", "Lady, Hear Me Tonight", 2000 },
{ "N-Joi", "Anthem", 1990 },
{ "Pet Shop Boys", "West End Girls", 1985 },
{ "Rihanna", "Only Girl, In The World", 2010 },
{ "Robyn feat. Kleerup", "With Every Heartbeat", 2007 },
{ "Stardust", "Music Sounds Better With You", 1998 },
{ "Wham!", "Everything She Wants", 1984 },
{ "Amerie", "1 Thing", 2005 },
{ "Robert Howard & Kym Mazelle", "Wait", 1989 },
{ "Sly Fox", "Let's Go All the Way", 1985 },
{ "Taylor Dayne", "Tell It to My Heart", 1987 },
{ "Living In A Box", "Living In A Box", 1987 },
{ "INXS", "New Sensation", 1988 },
{ "Bobby Brown", "On Our Own", 1989 },
{ "Bronski Beat", "Smalltown Boy", 1984 },
{ "Naked Eyes", "Promises, Promises", 1983 },
{ "Simply Red", "Something Got Me Started, Hurley's House Mix", 1991 },
{ "Sneaker Pimps", "6 Underground", 1996 },
{ "Backstreet Boys", "I Want It That Way", 1999 },
{ "Jamiroquai", "Alright", 1996 },
{ "Morcheeba", "Tape Loop, Shortcheeba Mix", 1996 },
{ "Moloko", "The Time Is Now", 2000 },
{ "Gorillaz feat. De La Soul", "Feel Good Inc.", 2005 },
{ "Robbie Williams & Kylie Minogue", "Kids", 2000 },
{ "Dirty Vegas", "Days Go By", 2001 },
{ "Cassie", "Me & U", 2006 },
{ "Maroon 5 feat. Christina Aguilera", "Moves Like Jagger", 2011 },
{ "M.I.A.", "Bad Girls", 2012 },
{ "M83", "Midnight City", 2011 },
{ "Lady Gaga", "Applause", 2013 },
{ "Mike Posner", "Cooler Than Me", 2010 },
{ "Lorde", "Tennis Court", 2013 },
{ "The Black Eyed Peas", "Meet Me Halfway", 2009 },
{ "Real Life", "Send Me An Angel '89", 1989 },
};
static struct song_info_t east_los_songs[] = {
{ "Hechizeros Band", "El Sonidito", 2008 },
{ "Los Buitres de Culiacan", "El Cocaino", 2012 },
{ "Mexican Institute of Sound", "Es-Toy", 2012 },
{ "Niña Dioz", "Criminal Sound, El Hijo De La Cumbia Remix", 2010 },
{ "La Vida Bohème", "Radio Capital", 2011 },
{ "Fandango", "Autos, Moda y Rock and Roll", 1987 },
{ "Don Cheto", "El Tatuado", 2007 },
{ "La Sonora Dinamita", "Se Me Perdió La Cadenita", 1978 },
{ "Fiebre de Jack", "She's A Tease", 2010 },
{ "Maldita Vecindad", "Pachuco", 1991 },
{ "Jessy Bulbo", "Maldito", 2007 },
{ "Milkman", "Fresco", 2012 },
{ "La Liga ft. Alika", "Tengo El Don", 2012 },
{ "Los Tigres Del Norte", "La Granja", 2009 },
{ "Los Ángeles Negros", "El Rey Y Yo", 1970 },
};
static struct song_info_t worldwide_songs[] = {
{ "Cashmere Cat", "Mirror Maru", 2012 },
{ "The Hics", "Cold Air", 2013 },
{ "inc.", "The Place", 2013 },
{ "Trickski", "Beginning", 2011 },
{ "Mala", "Ghost", 2012 },
{ "Swindle", "Forest Funk", 2012 },
{ "Tom Browne", "Throw Down", 1979 },
{ "Donald Byrd", "You And The Music", 1975 },
{ "Candido", "Thousand Finger Man", 1970 },
{ "Toro Y Moi", "Harm in Change", 2013 },
{ "Kyodai", "Breaking", 2012 },
{ "Django Django", "Waveforms", 2011 },
{ "The Gaslamp Killer", "Nissim", 2012 },
{ "Owiny Sigoma Band", "Harpoon Land", 2013 },
{ "Guts", "Brand New Revolution", 2011 },
{ "Yuna", "Live Your Life, MELO-X MOTHERLAND GOD MIX", 2012 },
{ "Tucillo & Kiko Navarro feat. Amor", "Lovery, Slow Cuban Vibe Mix", 2012 },
{ "Richard Spaven", "1759, Outro", 2010 },
{ "Hackman", "Forgotten Notes", 2012 },
{ "Sinkane feat. Salvatore Principato", "Shark Week", 2014 },
{ "William Onyeabor", "Body & Soul", 1980 },
{ "Four Tet", "Kool FM", 2013 },
{ "Mount Kimbie", "Made To Stray", 2013 },
{ "Anushka", "World in a Room", 2014 },
{ "Smokey Robinson", "Why You Wanna See My Bad Side?", 1978 },
{ "Randy Crawford", "Street Life", 1979 },
{ "Flume", "What You Need", 2012 },
{ "Earl Sweatshirt feat. Vince Staples & Casey Veggies", "Hive", 2013 },
{ "Portishead", "Numb", 1994 },
{ "Jon Wayne", "Black Magic", 2013 },
{ "Roman GianArthur", "I-69", 2013 },
{ "Lion Babe", "Treat Me Like Fire", 2013 },
{ "Dam-Funk", "Killdat", 2009 },
{ "Jamie Lidell", "Runaway", 2014 },
{ "CHVRCHES", "Recover, Cid Rim Remix", 2013 },
{ "Jimmy Edgar", "Let Yrself Be", 2012 },
{ "Clap! Clap!", "Viajero", 2014 },
{ "Maga Bo feat. Rosangela Macedo and Marcelo Yuka", "No Balanço da Canoa", 2012 },
};
static struct song_info_t channel_x_songs[] = {
{ "Agent Orange", "Bored of You", 1980 },
{ "Black Flag", "My War", 1984 },
{ "Circle Jerks", "Rock House", 1985 },
{ "Fear", "The Mouth Don't Stop, The Trouble With Women Is", 1985 },
{ "OFF!", "What's Next", 2013 },
{ "Adolescents", "Amoeba", 1981 },
{ "Descendents", "Pervert", 1985 },
{ "The Germs", "Lexicon Devil", 1978 },
{ "The Weirdos", "Life of Crime", 1977 },
{ "T.S.O.L.", "Abolish Government/Silent Majority", 1981 },
{ "Youth Brigade", "Blown Away", 1983 },
{ "Suicidal Tendencies", "Subliminal", 1983 },
{ "D.O.A.", "The Enemy", 1980 },
{ "MDC", "John Wayne Was a Nazi", 1980 },
{ "The Zeros", "Don't Push Me Around", 1980 },
{ "X", "Los Angeles", 1980 },
{ "D.R.I.", "I Don't Need Society", 1985 },
{ "Redd Kross", "Linda Blair", 1982 },
};
static struct song_info_t radio_mirror_park_songs[] = {
{ "Battle Tapes", "Feel the Same", 2012 },
{ "Dan Croll", "From Nowhere, Baardsen Remix", 2012 },
{ "DJ Mehdi", "Lucky Boy, Outlines Remix", 2006 },
{ "Feathers", "Dark Matter", 2013 },
{ "Jai Paul", "Jasmine, Demo Version", 2012 },
{ "Living Days", "Little White Lie", 2010 },
{ "Miami Horror", "Sometimes", 2009 },
{ "Tony Castles", "Heart In The Pipes, KAUF Remix", 2011 },
{ "Toro Y Moi", "So Many Details", 2012 },
{ "Twin Shadow", "Shooting Holes", 2010 },
{ "Twin Shadow", "Old Love / New Love", 2013 },
{ "Y.A.C.H.T.", "Psychic City, Classixx Remix", 2009 },
{ "Black Strobe", "Boogie in Zero Gravity", 2012 },
{ "Age of Consent", "Colours", 2013 },
{ "Favored Nations", "The Set Up", 2013 },
{ "Neon Indian", "Change Of Coast", 2013 },
{ "Nite Jewel", "Nowhere To Go", 2013 },
{ "Yeasayer", "Don't Come Close", 2013 },
{ "The Chain Gang of 1974", "Sleepwalking", 2013 },
{ "Poolside", "Do You Believe?", 2010 },
{ "The C90s", "Shine A Light, Flight Facilities Remix", 2010 },
{ "HEALTH", "High Pressure Dave", 2013 },
{ "The Ruby Suns", "In Real Life", 2013 },
{ "Neon Indian", "Polish Girl", 2011 },
{ "Mitzi", "Truly Alive", 2013 },
{ "KAUF", "When You're Out", 2013 },
{ "Panama", "Always", 2014 },
{ "Twin Shadow", "Forget", 2010 },
{ "!!!", "One Girl/One Boy", 2013 },
{ "SBTRKT feat. Roses Gabor", "Pharaohs", 2011 },
{ "Yeasayer", "O.N.E.", 2010 },
{ "Toro Y Moi", "New Beat", 2011 },
{ "Niki and the Dove", "The Drummer", 2011 },
{ "Little Dragon", "Crystalfilm", 2011 },
{ "Hot Chip", "Flutes", 2012 },
{ "Dom", "Living In America", 2010 },
{ "Holy Ghost!", "Hold On", 2011 },
{ "Scenic", "Mesmerised", 2013 },
{ "Cut Copy", "Strangers in the Wind", 2008 },
{ "Age of Consent", "Heartbreak", 2012 },
};
static struct song_info_t vinewood_boulevard_songs[] = {
{ "Wavves", "Nine Is God", 2013 },
{ "FIDLAR", "Cocaine", 2013 },
{ "Bass Drum of Death", "Crawling After You", 2013 },
{ "Hot Snakes", "This Mystic Decade", 2004 },
{ "Moon Duo", "Sleepwalker", 2012 },
{ "Sam Flax", "Fire Doesn't Burn Itself", 2012 },
{ "Shark?", "California Grrls", 2013 },
{ "The Black Angels", "Black Grease", 2005 },
{ "METZ", "Wet Blanket", 2012 },
{ "Ceremony", "Hysteria", 2012 },
{ "Ty Segall Band", "Diddy Wah Diddy", 2012 },
{ "Thee Oh Sees", "The Dream", 2011 },
{ "The Men", "Turn It Around", 2012 },
{ "Bleached", "Next Stop", 2013 },
{ "JEFF the Brotherhood", "Sixpack", 2012 },
{ "Coliseum", "Used Blood", 2013 },
{ "The Soft Pack", "Answer to Yourself", 2009 },
{ "The Orwells", "Who Needs You", 2013 },
{ "Nobunny", "Gone For Good", 2010 },
{ "Mind Spiders", "Fall in Line", 2012 },
};
static struct song_info_t soulwax_songs[] = {
{ "Palmbomen", "Stock, Soulwax Remix", 2013 },
{ "Fatal Error", "Fatal Error", 1988 },
{ "Supersempfft", "Let's Beam Him Up", 1979 },
{ "Mim Suleiman", "Mingi", 2010 },
{ "FKClub", "The Strange Art, Inflagranti Remix", 2013 },
{ "Matias Aguayo", "El Sucu Tucu", 2013 },
{ "Daniel Avery", "Naive Response", 2013 },
{ "Joe Goddard feat. Valentina", "Gabriel, Soulwax Remix", 2012 },
{ "Daniel Maloso", "Body Music, Original Mix", 2012 },
{ "Green Velvet & Harvard Bass", "Lazer Beams", 2012 },
{ "Zombie Nation", "Tryouts", 2012 },
{ "Tom Rowlands", "Nothing But Pleasure", 2013 },
{ "Jackson and His Computerband", "Arp #1", 2013 },
{ "Goose", "Synrise, Soulwax Remix", 2013 },
{ "Transistorcake", "Mr. Croissant Taker", 2013 },
{ "Tiga", "Plush, Jacques Lu Cont Remix", 2012 },
{ "The Hacker", "Shockwave, Gesaffelstein Remix", 2012 },
{ "Pulp", "After You, Soulwax Remix", 2013 },
};
static struct song_info_t flylo_songs[] = {
{ "Flying Lotus feat. Niki Randa", "Getting There", 2012 },
{ "Clams Casino", "Crystals", 2013 },
{ "Flying Lotus", "Crosswerved", 2013 },
{ "Flying Lotus", "Be Spin", 2013 },
{ "Flying Lotus feat. Erykah Badu", "See Thru To U", 2013 },
{ "Flying Lotus", "The Diddler", 2013 },
{ "Flying Lotus", "Computer Face Rmx", 2011 },
{ "Hudson Mohawke", "100hm", 2013 },
{ "Flying Lotus feat. Niki Randa", "The Kill", 2013 },
{ "Tyler, the Creator", "Garbage", 2013 },
{ "Outkast", "Elevators, Me & You", 1996 },
{ "Captain Murphy", "Evil Grin", 2013 },
{ "Flying Lotus", "Catapult Man", 2013 },
{ "Dabrye", "Encoded Flow", 2006 },
{ "Machinedrum", "She Died There", 2011 },
{ "DJ Rashad", "It's Wack", 2013 },
{ "Thundercat", "Oh Sheit It's X", 2013 },
{ "Flying Lotus", "Stonecutters", 2013 },
{ "Shadow Child", "23", 2012 },
{ "Kingdom", "Stalker Ha", 2011 },
{ "Aphex Twin", "Windowlicker", 1999 },
{ "Curtis Mayfield", "Eddie You Should Know Better", 1972 },
{ "Doris", "You Never Come Closer", 1970 },
{ "Flying Lotus feat. Krayzie Bone", "Medication Medication", 2014 },
{ "XXYYXX", "Work Title: What We Want", 2014 },
{ "Lapalux", "Make Money", 2014 },
{ "The Gaslamp Killer", "Shred You To Bits", 2014 },
{ "Mono/Poly & Thundercat", "B Adams", 2014 },
{ "Flying Lotus", "Osaka Trade", 2013 },
{ "DOOM", "Masquatch", 2014 },
{ "Flying Lotus", "Early Mountain", 2014 },
{ "Dimlite", "Into Vogon Skulls", 2012 },
{ "KNOWER", "Fuck the Makeup, Skip the Shower", 2010 },
{ "Kaskade", "4 AM, Araabmuzik Remix", 2006 },
};
static struct song_info_t the_lab_songs[] = {
{ "Gangrene feat. Samuel T. Herring & Earl Sweatshirt", "Play It Cool", 2015 },
{ "Ab-Soul feat. Aloe Blacc", "Trouble", 2015 },
{ "Tunde Adebimpe feat. Sal P & Sinkane", "Speedline Miracle Masterpiece", 2015 },
{ "MC Eiht & Freddie Gibbs feat. Kokane", "Welcome to Los Santos", 2015 },
{ "Phantogram", "K.Y.S.A", 2015 },
{ "Vybz Kartel", "Fast Life", 2015 },
{ "King Avriel feat. A$AP Ferg", "20's 50's 100's", 2015 },
{ "MNDR feat. Killer Mike", "Lock & Load", 2015 },
{ "Popcaan feat. Freddie Gibbs", "Born Bad", 2015 },
{ "E-40 feat. Dam-Funk & Ariel Pink", "California", 2015 },
{ "Wavves", "Leave", 2015 },
{ "Curren$y & Freddie Gibbs", "Fetti", 2015 },
{ "Little Dragon", "Wanderer", 2015 },
};
static struct radio_station_info_t radio_stations[] = {
{ "Radio Los Santos", SONGS(radio_los_santos) },
{ "Space 103.2", SONGS(space_103_2) },
{ "West Coast Classics", SONGS(west_cost_classics) },
{ "Rebel Radio", SONGS(rebel_radio) },
{ "Los Santos Rock Radio", SONGS(los_santos_rock_radio) },
{ "The Lowdown 91.1", SONGS(the_lowdown) },
{ "The Blue Ark", SONGS(the_blue_ark) },
{ "Non-Stop-Pop FM", SONGS(non_stop_pop) },
{ "East Los FM", SONGS(east_los) },
{ "WorldWide FM", SONGS(worldwide) },
{ "Channel X", SONGS(channel_x) },
{ "Radio Mirror Park", SONGS(radio_mirror_park) },
{ "Vinewood Boulevard Radio", SONGS(vinewood_boulevard) },
{ "Soulwax FM", SONGS(soulwax) },
{ "FlyLo FM", SONGS(flylo) },
{ "The Lab", SONGS(the_lab) },
};
#define N_STATIONS sizeof(radio_stations)/sizeof(struct radio_station_info_t)
void
radio_stations_init(void)
{
for (uint32_t i = 0; i < N_STATIONS; i++)
radio_stations[i].id = i;
}
uint32_t
n_radio_stations(void)
{
return N_STATIONS;
}
const radio_station_info_t *
get_radio_stations(uint32_t id)
{
return &radio_stations[id];
}

View File

@ -1,18 +0,0 @@
#include <cstdint>
struct song_info_t {
const char *artist;
const char *name;
uint32_t year;
};
struct radio_station_info_t {
const char *name;
song_info_t *songs;
uint32_t n_songs;
uint32_t id;
};
void radio_stations_init(void);
uint32_t n_radio_stations(void);
const radio_station_info_t *get_radio_stations(uint32_t id);

View File

@ -1,119 +0,0 @@
#include <vsomeip/vsomeip.hpp>
#include <sstream>
#define RADIO_SERVICE_ID 0x1000
#define RADIO_INSTANCE_ID 1
#define RADIO_IS_PLAYING_METHOD_ID 1
#define RADIO_SET_PLAYING_METHOD_ID 2
#define RADIO_GET_VOLUME_METHOD_ID 3
#define RADIO_CHANGE_VOLUME_METHOD_ID 4
#define RADIO_SWITCH_STATION_METHOD_ID 5
#define RADIO_EVENTGROUP_ID 0x4001
#define RADIO_VOLUME_EVENT_ID 0x8000 + 1
#define RADIO_STATION_EVENT_ID 0x8000 + 2
#define RADIO_SONG_EVENT_ID 0x8000 + 3
#define RADIO_ARTIST_EVENT_ID 0x8000 + 4
#define ENGINE_SERVICE_ID 0x1001
#define ENGINE_INSTANCE_ID 1
#define ENGINE_GET_REVERSE_METHOD_ID 1
#define ENGINE_EVENTGROUP_ID 0x4002
#define ENGINE_REVERSE_EVENT_ID 0x8000 + 1
static uint32_t inline
payload_get_arg(std::shared_ptr<vsomeip::payload> its_payload)
{
vsomeip::byte_t *data = its_payload->get_data();
vsomeip::length_t l = its_payload->get_length();
if (l < 4)
return 0;
return (uint32_t)data[0]<< 24 | data[1]<< 16 | data[2]<< 8 | data[3];
}
static std::string inline
payload_get_string(std::shared_ptr<vsomeip::payload> its_payload)
{
vsomeip::byte_t *data = its_payload->get_data();
vsomeip::length_t l = its_payload->get_length();
std::stringstream ss;
for (vsomeip::length_t i=0; i<l; i++)
ss << (unsigned char)data[i];
return ss.str();
}
static std::shared_ptr<vsomeip::payload> inline
payload_with_arg(uint32_t arg)
{
std::shared_ptr<vsomeip::payload> its_payload = vsomeip::runtime::get()->create_payload();
std::vector<vsomeip::byte_t> its_payload_data;
its_payload_data.push_back((arg >> 24) & 0xff);
its_payload_data.push_back((arg >> 16) & 0xff);
its_payload_data.push_back((arg >> 8) & 0xff);
its_payload_data.push_back((arg >> 0) & 0xff);
its_payload->set_data(its_payload_data);
return its_payload;
}
static std::shared_ptr<vsomeip::payload> inline
payload_with_string(std::string arg)
{
std::shared_ptr<vsomeip::payload> its_payload = vsomeip::runtime::get()->create_payload();
std::vector<vsomeip::byte_t> its_payload_data;
for (vsomeip::byte_t i=0; i<arg.size(); i++) {
its_payload_data.push_back(arg[i]);
}
its_payload->set_data(its_payload_data);
return its_payload;
}
static std::shared_ptr< vsomeip::message > inline
new_request (uint32_t method, uint32_t arg)
{
std::shared_ptr< vsomeip::message > request;
request = vsomeip::runtime::get()->create_request();
request->set_service(RADIO_SERVICE_ID);
request->set_instance(RADIO_INSTANCE_ID);
request->set_method(method);
std::shared_ptr<vsomeip::payload> its_payload = payload_with_arg (arg);
request->set_payload(its_payload);
return request;
}
static uint32_t inline
get_arg0(const std::shared_ptr<vsomeip::message> _request) {
std::shared_ptr<vsomeip::payload> its_payload = _request->get_payload();
return payload_get_arg(its_payload);
}
static std::string inline
get_arg0_string(const std::shared_ptr<vsomeip::message> _request) {
std::shared_ptr<vsomeip::payload> its_payload = _request->get_payload();
return payload_get_string(its_payload);
}
static std::shared_ptr<vsomeip::message> inline
response (const std::shared_ptr<vsomeip::message> &_request,
uint32_t arg)
{
std::shared_ptr<vsomeip::message> its_response = vsomeip::runtime::get()->create_response(_request);
std::shared_ptr<vsomeip::payload> its_payload = payload_with_arg (arg);
its_response->set_payload(its_payload);
return its_response;
}

View File

@ -1,31 +0,0 @@
Tinyrepo
========
This folder contains some utility scripts that are used to sample images that
can be easily downloaded and used.
## Creating sample images
The sample images are a sub-set of the images one can build using the osbuild
manifest present in this repository.
The creating of the images is handled by the `build_images.sh` shell script
which simply calls sequentially different `make` commands, then compress the
resulting images and places them in a timestamped directory available to apache.
Finally, it creates a symlink between the newest folder and a `latest` folder,
thus giving a stable location where one can find the most recently built images.
## Cron job
The `build_images.sh` shell script present in this folder are ran via the
following cron job configuration:
::
0 2 * * 1 sh /path/to/automotive-sig/tinyrepo/build_images.sh /path/to/clone/of/automotive-sig/osbuild-manifests/ /path/to/root/folder/in/apache
This allows to build new images weekly.

View File

@ -1,46 +0,0 @@
#!/bin/bash
d=`date "+%Y%m%d"`
AUTOSIGREPO=$1
HTMLROOT=$2
pushd $AUTOSIGREPO/osbuild-manifests
# Let's update the git repo
git pull --rebase
# Clean all all cached data
make clean
rm *.log || true
rm *.img || true
rm *.qcow2 || true
rm *.img.xz || true
rm *.qcow2.xz || true
dnf clean all
sudo dnf clean all
# Build all images
sudo make cs9-rpi4-neptune-ostree.aarch64.img > cs9-rpi4-neptune-ostree.aarch64.log
sudo make cs9-rpi4-neptune-regular.aarch64.img > cs9-rpi4-neptune-regular.aarch64.log
sudo make cs9-qemu-developer-regular.aarch64.qcow2 > cs9-qemu-developer-regular.aarch64.log
sudo make cs9-qemu-developer-regular.aarch64.oci.tar > cs9-qemu-developer-regular.aarch64.oci.tar.log
sudo make osbuildvm-images > osbuildvm-images.log
# Compact them
xz cs9-rpi4-neptune-ostree.aarch64.img &
xz cs9-rpi4-neptune-regular.aarch64.img &
xz cs9-qemu-developer-regular.aarch64.qcow2 &
tar cfz osbuildvm-images.tar.gz _build/osbuildvm-aarch64.* &
wait
popd
# Move the images to apache
mkdir -p $HTMLROOT/images/$d
cp $AUTOSIGREPO/osbuild-manifests/*.xz $HTMLROOT/images/$d/
cp $AUTOSIGREPO/osbuild-manifests/*.tar $HTMLROOT/images/$d/
cp $AUTOSIGREPO/osbuild-manifests/*.tar.gz $HTMLROOT/images/$d/
# Update the `latest` symlink
ln -nsf $d $HTMLROOT/images/latest

View File

@ -1,20 +0,0 @@
#!/bin/bash
d=`date "+%Y%m%d"`
AUTOSIGREPO=$1
HTMLROOT=$2
python $AUTOSIGREPO/tinyrepo/initiate_repo.py \
$HTMLROOT/cs9-stream/ \
--pkgslist=$HTMLROOT/cs9-stream/pkgslist_$d
for arch in aarch64 x86_64
do
mkdir -p $HTMLROOT/cs9-stream/$arch/$d
pushd $HTMLROOT/cs9-stream/$arch/$d
createrepo_c ../packages/ -o . -i ../../pkgslist_$d
popd
# Update the `latest` symlink
ln -nsf $d $HTMLROOT/cs9-stream/$arch/latest
done

View File

@ -1,145 +0,0 @@
#!/usr/bin/python3
"""
This script queries content resolver at: https://tiny.distro.builders to retrieve
a list of all the packages of interest for the automotive SIG.
Requirements:
- python-requests
"""
import argparse
import os
import re
import sys
import requests
environments = [
"https://tiny.distro.builders/workload--automotive-c9s-workload-development--automotive-c9s-env-minimum--automotive-c9s-repositories--aarch64.json",
"https://tiny.distro.builders/workload--automotive-c9s-workload-minimum--automotive-c9s-env-minimum--automotive-c9s-repositories--aarch64.json",
"https://tiny.distro.builders/workload--automotive-c9s-workload-neptune--automotive-c9s-env-minimum--automotive-c9s-repositories--aarch64.json",
"https://tiny.distro.builders/workload--automotive-c9s-workload-ostree--automotive-c9s-env-minimum--automotive-c9s-repositories--aarch64.json",
"https://tiny.distro.builders/workload--automotive-c9s-workload-podman--automotive-c9s-env-minimum--automotive-c9s-repositories--aarch64.json",
]
cs_urls = [
"http://mirror.stream.centos.org/9-stream/AppStream/{arch}/os/Packages/{nvr}",
"http://mirror.stream.centos.org/9-stream/BaseOS/{arch}/os/Packages/{nvr}",
"http://mirror.stream.centos.org/9-stream/CRB/{arch}/os/Packages/{nvr}",
"https://composes.stream.centos.org/development/latest-CentOS-Stream/compose/BaseOS/{arch}/os/Packages/{nvr}",
"https://composes.stream.centos.org/development/latest-CentOS-Stream/compose/AppStream/{arch}/os/Packages/{nvr}",
"https://composes.stream.centos.org/development/latest-CentOS-Stream/compose/CRB/{arch}/os/Packages/{nvr}",
]
epoch_re = re.compile("-\d+:")
def get_packages():
""" Queries content resolver and returns a tuple of two set, the first
set contains the name of every package, the second set contains the NVR
of every package.
"""
packages_set = set()
nvr_set = set()
for env in environments:
req = requests.get(env)
if not req.ok:
print(f"Failed to retrieve info from {env}")
continue
data = req.json()
data = data["data"]
for key in ("pkg_env_ids", "pkg_added_ids"):
for pkg in data[key]:
name = pkg.rsplit("-", 2)[0]
# Drop the architecture
nvr = pkg.rsplit(".", 1)[0]
# Drop epoch if there is one
if len(epoch_re.findall(nvr)) == 1:
for mat in epoch_re.findall(nvr):
nvr = nvr.replace(mat, "-")
elif len(epoch_re.findall(nvr)) > 1:
print("More than one -\d: matched in {nvr}")
packages_set.add(name)
nvr_set.add(nvr)
return (packages_set, nvr_set)
def download_nvrs(folder, nvrs):
""" Queries the CentOS-Stream mirror and download the package specified by
the given NVR.
"""
notfound = 0
out_files = []
for nvr in sorted(nvrs):
for arch in ("x86_64", "aarch64"):
out_filename = f"{nvr}.{arch}.rpm"
output_folder = os.path.join(folder, arch, "packages")
out_path = os.path.join(output_folder, out_filename)
if not os.path.exists(output_folder):
os.makedirs(output_folder)
if os.path.exists(out_path):
out_files.append(out_filename)
continue
found = False
for url in cs_urls:
nurl = f"{url}.{arch}.rpm".format(arch=arch, nvr=nvr)
req = requests.head(nurl)
# print(req.status_code, url)
if req.ok:
found = True
out_files.append(out_filename)
req = requests.get(nurl)
with open(out_path, "wb") as stream:
stream.write(req.content)
break
else:
# print(req.status_code, nurl)
# Check if it's a noarch RPM
nurl = f"{url}.noarch.rpm".format(arch=arch, nvr=nvr)
req = requests.head(nurl)
if req.ok:
found = True
out_files.append(f"{nvr}.noarch.rpm")
req = requests.get(nurl)
with open(out_path, "wb") as stream:
stream.write(req.content)
break
# else:
# print(req.status_code, nurl)
if not found:
print(f"Package {nvr}.{arch} not found on the mirrors")
notfound += 1
print(f"{notfound} packages not found on the mirrors")
return out_files
def parse_arguments(args):
"""Parse the CLI arguments and return the corresponding argparse object.
"""
parser = argparse.ArgumentParser(description="Instantiate george")
parser.add_argument("folder", nargs="?", default=".",
help="Folder in which to put the downloaded RPMs")
parser.add_argument("--pkgslist",
help="Name of the file in which to output the list of all the RPMs found")
return parser.parse_args(args)
if __name__ == "__main__":
args = parse_arguments(sys.argv[1:])
pkgs, nvrs = get_packages()
# print("-", "\n- ".join(sorted(pkgs)))
print(len(pkgs), "packages found")
print("Corresponding to", len(nvrs), "nvr")
out_files = download_nvrs(args.folder, nvrs)
if args.pkgslist:
with open(args.pkgslist, "w") as stream:
stream.write("\n".join(out_files))