Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add support to build from copr #310

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .copr/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
srpm:
cd $(spec)
make github
rpmbuild -vv -bs ly.spec --define "_srcrpmdir $(outdir)"
78 changes: 78 additions & 0 deletions ly.spec.rpkg
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
%define relabel_files() \
restorecon -R /usr/bin/ly; \

%define selinux_policyver 3.14.6-34

Name: {{{ git_dir_name }}}
Version: {{{ git_dir_version }}}
Release: 1%{?dist}
Summary: A TUI display manager
License: WTFPL
URL: https://github.com/nullgemm/ly
VCS: {{{ git_dir_vcs }}}
Source: {{{ git_dir_pack }}}
BuildRequires: libxcb-devel
BuildRequires: pam-devel
BuildRequires: make
BuildRequires: git
BuildRequires: gcc
BuildRequires: selinux-policy-devel
Requires: libxcb
Requires: pam

%description
Ly is a lightweight TUI (ncurses-like) display manager for Linux and BSD.

%prep
git clone https://github.com/dhalucario/ly.git ly
cd ly
# git checkout v0.5.2
make github

%build
cd ly
make

%install
cd ly
mkdir -p %{buildroot}/etc/
mkdir -p %{buildroot}/usr/bin/
mkdir -p %{buildroot}/usr/lib/systemd/system/
mkdir -p %{buildroot}/etc/pam.d/
DESTDIR="%{buildroot}" make install
DESTDIR="%{buildroot}" make installselinux
chmod -x %{buildroot}/etc/ly/config.ini
chmod -x %{buildroot}/etc/ly/lang/*

%post
semodule -n -i /usr/share/selinux/packages/ly.pp
if /usr/sbin/selinuxenabled ; then
/usr/sbin/load_policy
%relabel_files

fi;
exit 0

%postun
if [ $1 -eq 0 ]; then
semodule -n -r ly
fi;
exit 0

%files
/usr/bin/ly
/usr/lib/systemd/system/ly.service
/etc/ly/lang/es.ini
/etc/ly/lang/pt.ini
/etc/ly/lang/ru.ini
/etc/ly/lang/en.ini
/etc/ly/lang/fr.ini
/etc/ly/lang/ro.ini
/etc/ly/xsetup.sh
/etc/ly/wsetup.sh
/etc/ly/config.ini
/etc/pam.d/ly
/usr/share/selinux/packages/ly.pp

%changelog
{{{ git_dir_changelog }}}
5 changes: 5 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ installnoconf: $(BIND)/$(NAME)
@install -DZ $(RESD)/ly.service -m 644 -t ${DESTDIR}/usr/lib/systemd/system
@install -DZ $(RESD)/pam.d/ly -m 644 -t ${DESTDIR}/etc/pam.d

installselinux:
@echo "installing selinux modules"
@make -f /usr/share/selinux/devel/Makefile ly.pp
@install -DZ ly.pp ${DESTDIR}/usr/share/selinux/packages/ly.pp

uninstall:
@echo "uninstalling"
@rm -rf ${DESTDIR}/etc/ly
Expand Down
1 change: 1 addition & 0 deletions selinux/ly.fc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/usr/bin/ly -- gen_context(system_u:object_r:ly_exec_t,s0)
41 changes: 41 additions & 0 deletions selinux/ly.if
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

## <summary>policy for ly</summary>

########################################
## <summary>
## Execute ly_exec_t in the ly domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed to transition.
## </summary>
## </param>
#
interface(`ly_domtrans',`
gen_require(`
type ly_t, ly_exec_t;
')

corecmd_search_bin($1)
domtrans_pattern($1, ly_exec_t, ly_t)
')

######################################
## <summary>
## Execute ly in the caller domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`ly_exec',`
gen_require(`
type ly_exec_t;
')

corecmd_search_bin($1)
can_exec($1, ly_exec_t)
')

32 changes: 32 additions & 0 deletions selinux/ly.te
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
policy_module(ly, 1.0.0)

########################################
#
# Declarations
#

type ly_t;
type ly_exec_t;
init_daemon_domain(ly_t, ly_exec_t)

permissive ly_t;

########################################
#
# ly local policy
#
allow ly_t self:capability { setgid setuid };
allow ly_t self:process { fork signal_perms };
allow ly_t self:process transition;
allow ly_t self:fifo_file rw_fifo_file_perms;
allow ly_t self:unix_stream_socket create_stream_socket_perms;

domain_use_interactive_fds(ly_t)

files_read_etc_files(ly_t)

auth_use_nsswitch(ly_t)

logging_send_audit_msgs(ly_t)

miscfiles_read_localization(ly_t)