Skip to content

Commit

Permalink
Cleanup and remove systemd use in the setup scripts
Browse files Browse the repository at this point in the history
Remove unused code in the setup scripts in order to ease refactoring
them. This commit removes the need for systemd running as PID1 to run
the setup script.

This also means that mgr-setup has to be called before running the real
container and starting everything.

Note that some of the cleanup removing non-SUSE distributions handling,
which shouldn't be a problem as Uyuni is now only shipped as a container
built on a single openSUSE distro.
  • Loading branch information
cbosdo committed Nov 25, 2024
1 parent 1ca5341 commit 98b2fde
Show file tree
Hide file tree
Showing 26 changed files with 105 additions and 2,090 deletions.
2 changes: 0 additions & 2 deletions projects/perl-Satcon/bin/satcon-deploy-tree.pl
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ sub process_file {
my $apache_group = getgrnam(`grep -hsoP "(?<=Group ).*" /etc/httpd/conf/*.conf /etc/apache2/*.conf | tr -d '\n'`);
chown 0, $apache_group, "$destdir/$relative_path";

system '/sbin/restorecon', '-vv', "$destdir/$relative_path";

while (<IF>) {
my $out = $engine->perform_substitutions($_);
print OF $out;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Remove useless selinux-related code
1 change: 0 additions & 1 deletion rel-eng/packages/spacewalk-setup-postgresql

This file was deleted.

24 changes: 5 additions & 19 deletions spacewalk/admin/rhn-config-schema.pl
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@
die $usage;
}

my $backend = 'oracle';
if ($source =~ m!/postgres(ql)?/!) {
$backend = 'postgresql';
}

open(SOURCE, "< $source") or die "Could not open $source: $OS_ERROR";
open(TARGET, "> $target") or die "Could not open $target for writing: $OS_ERROR";

Expand Down Expand Up @@ -85,13 +80,13 @@
$filename =~ s!^.+/([^/]+/[^/]+)$!$1!;
}
my $full_file = undef;
if (exists $exception_files{"$filename.$backend"}) {
$full_file = "$exception_dir/$filename.$backend";
if (exists $exception_files{"$filename.postgresql"}) {
$full_file = "$exception_dir/$filename.postgresql";
} elsif (exists $exception_files{$filename}) {
$full_file = "$exception_dir/$filename";
}
if (defined $full_file) {
for my $e ( '', '.oracle', '.postgresql' ) {
for my $e ( '', '.postgresql' ) {
$exception_seen{"$filename$e"}++ if exists $exception_files{"$filename$e"};
}
open OVERRIDE, $full_file or die "Error reading file [$full_file]: $!\n";
Expand Down Expand Up @@ -134,15 +129,6 @@
}
}

system('/usr/sbin/selinuxenabled');
if ($? >> 8 == 0) {
if (-x '/usr/sbin/restorecon') {
system('/usr/sbin/restorecon', '-F', $target);
} elsif (-x '/sbin/restorecon') {
system('/sbin/restorecon', '-F', $target);
}
}

exit $error;

=pod
Expand All @@ -168,11 +154,11 @@ =head1 OPTIONS
=item B<--source=SOURCE>
Full path to main.sql file. Usually /usr/share/susemanager/db/I<backend>/main.sql
Full path to main.sql file. Usually /usr/share/susemanager/db/postgresql/main.sql
=item B<--target=TARGET>
Full path to deploy.sql. Usually /usr/share/susemanager/db/I<backend>/deploy.sql
Full path to deploy.sql. Usually /usr/share/susemanager/db/postgresql/deploy.sql
=item B<--tablespace-name=TABLESPACE>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Remove useless selinux and oracle related code
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Remove unused configuration defaults files
15 changes: 0 additions & 15 deletions spacewalk/package/spacewalk.spec
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,7 @@ Version for PostgreSQL database backend.
#nothing to do here

%install
RDBMS="postgresql"
install -d %{buildroot}%{_sysconfdir}
install -d %{buildroot}%{_datadir}/spacewalk/setup/defaults.d
for i in ${RDBMS} ; do
cat <<EOF >%{buildroot}%{_datadir}/spacewalk/setup/defaults.d/$i-backend.conf
# database backend to be used by spacewalk
db-backend = $i
EOF
done
install -d %{buildroot}%{_bindir}
%if 0%{?rhel}
ln -s %{_prefix}/pgsql-14/bin/initdb %{buildroot}%{_bindir}/initdb
Expand All @@ -155,13 +147,6 @@ ln -s %{_prefix}/pgsql-14/bin/initdb %{buildroot}%{_bindir}/initdb
%if 0%{?suse_version}
%dir %{_datadir}/spacewalk
%dir %{_datadir}/spacewalk/setup
%dir %{_datadir}/spacewalk/setup/defaults.d
%endif

%files postgresql
%{_datadir}/spacewalk/setup/defaults.d/postgresql-backend.conf
%if 0%{?rhel}
%{_bindir}/initdb
%endif

%changelog
92 changes: 0 additions & 92 deletions spacewalk/setup/bin/spacewalk-make-mount-points

This file was deleted.

Loading

0 comments on commit 98b2fde

Please sign in to comment.