File rpi-ds3231.spec of Package rpi-ds3231

# spec file for package rpi-ds3231
# Copyright (c) 2020 SUSE LLC
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

Name:           rpi-ds3231
Version:        2020.08.22
Release:        0
Summary:        Enable RTC DS3231 for Raspberry Pi
License:        GPL-3.0-or-later
BuildArch:      noarch
Source1:        hwclock-start.service

%define uboot_dir /boot

Activates the DS3231 module with a Device Tree (DT) overlay and creates a systemd service to compare the time.


mkdir -p %{buildroot}%{uboot_dir}/vc/
cat > %{buildroot}%{uboot_dir}/vc/extraconfig.txt <<-'EOF'

install -m 644 -D %{SOURCE1} %{buildroot}/%{_unitdir}/hwclock-start.service

if mountpoint -q /boot/efi; then
  if ! [[ "$(readlink -f /boot/efi)" -ef "$(readlink -f %{uboot_dir})" ]]; then
    [ -f %{uboot_dir}/vc/extraconfig.txt ] && cp %{uboot_dir}/vc/extraconfig.txt /boot/efi
%service_add_post hwclock-start.service

%dir %{uboot_dir}/vc
%dir %{_unitdir}

openSUSE Build Service is sponsored by