Skip to content

Commit

Permalink
Avoid duplicated fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alanmcanonical committed Jul 27, 2024
1 parent d89b682 commit 84a9e52
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@

TMPFILES_CONF="/usr/lib/tmpfiles.d/systemd.conf"

if grep -qP "^[zZ][+]*\s+\/var\/log\/journal\s+" "$TMPFILES_CONF"; then
sed -i --follow-symlinks -E '/[zZ][+]*\s+\/var\/log\/journal\s*/d' "$TMPFILES_CONF"
if ! grep -q 'Z /var/log/journal ~2750 root systemd-journal - -' "$TMPFILES_CONF"; then
if grep -qP "^[zZ][+]*\s+\/var\/log\/journal" "$TMPFILES_CONF"; then
sed -i --follow-symlinks "s/\(^[zZ][+]*\)\(\s\+\/var\/log\/journal.*\)/# \1\2/" "$TMPFILES_CONF"
fi
echo "Z /var/log/journal ~2750 root systemd-journal - -" >>"$TMPFILES_CONF"
fi
echo "Z /var/log/journal ~2750 root systemd-journal - -" >> "$TMPFILES_CONF"

if grep -qP "^[zZ][+]*\s+\/run\/log\/journal\s+" "$TMPFILES_CONF"; then
sed -i --follow-symlinks -E '/[zZ][+]*\s+\/run\/log\/journal\s*/d' "$TMPFILES_CONF"
if ! grep -q 'Z /run/log/journal ~2750 root systemd-journal - -' "$TMPFILES_CONF"; then
if grep -qP "^[zZ][+]*\s+\/run\/log\/journal" "$TMPFILES_CONF"; then
sed -i --follow-symlinks "s/\(^[zZ][+]*\)\(\s\+\/run\/log\/journal.*\)/# \1\2/" "$TMPFILES_CONF"
fi
echo "Z /run/log/journal ~2750 root systemd-journal - -" >>"$TMPFILES_CONF"
fi
echo "Z /run/log/journal ~2750 root systemd-journal - -" >> "$TMPFILES_CONF"

systemd-tmpfiles --create
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@

TMPFILES_CONF="/usr/lib/tmpfiles.d/systemd.conf"

if grep -qP "^[zZ][+]*\s+\/var\/log\/journal\s+" "$TMPFILES_CONF"; then
sed -i --follow-symlinks -E '/[zZ][+]*\s+\/var\/log\/journal\s*/d' "$TMPFILES_CONF"
if ! grep -q 'Z /var/log/journal ~2750 root systemd-journal - -' "$TMPFILES_CONF"; then
if grep -qP "^[zZ][+]*\s+\/var\/log\/journal" "$TMPFILES_CONF"; then
sed -i --follow-symlinks "s/\(^[zZ][+]*\)\(\s\+\/var\/log\/journal.*\)/# \1\2/" "$TMPFILES_CONF"
fi
echo "Z /var/log/journal ~2750 root systemd-journal - -" >>"$TMPFILES_CONF"
fi
echo "Z /var/log/journal ~2750 root systemd-journal - -" >> "$TMPFILES_CONF"

if grep -qP "^[zZ][+]*\s+\/run\/log\/journal\s+" "$TMPFILES_CONF"; then
sed -i --follow-symlinks -E '/[zZ][+]*\s+\/run\/log\/journal\s*/d' "$TMPFILES_CONF"
if ! grep -q 'Z /run/log/journal ~2750 root systemd-journal - -' "$TMPFILES_CONF"; then
if grep -qP "^[zZ][+]*\s+\/run\/log\/journal" "$TMPFILES_CONF"; then
sed -i --follow-symlinks "s/\(^[zZ][+]*\)\(\s\+\/run\/log\/journal.*\)/# \1\2/" "$TMPFILES_CONF"
fi
echo "Z /run/log/journal ~2750 root systemd-journal - -" >>"$TMPFILES_CONF"
fi
echo "Z /run/log/journal ~2750 root systemd-journal - -" >> "$TMPFILES_CONF"

systemd-tmpfiles --create
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@

TMPFILES_CONF="/usr/lib/tmpfiles.d/systemd.conf"

if grep -qP "^[zZ][+]*\s+\/var\/log\/journal\s+" "$TMPFILES_CONF"; then
sed -i --follow-symlinks -E '/[zZ][+]*\s+\/var\/log\/journal\s*/d' "$TMPFILES_CONF"
if ! grep -q 'Z /var/log/journal ~2750 root systemd-journal - -' "$TMPFILES_CONF"; then
if grep -qP "^[zZ][+]*\s+\/var\/log\/journal" "$TMPFILES_CONF"; then
sed -i --follow-symlinks "s/\(^[zZ][+]*\)\(\s\+\/var\/log\/journal.*\)/# \1\2/" "$TMPFILES_CONF"
fi
echo "Z /var/log/journal ~2750 root systemd-journal - -" >>"$TMPFILES_CONF"
fi
echo "Z /var/log/journal ~2750 root systemd-journal - -" >> "$TMPFILES_CONF"

if grep -qP "^[zZ][+]*\s+\/run\/log\/journal\s+" "$TMPFILES_CONF"; then
sed -i --follow-symlinks -E '/[zZ][+]*\s+\/run\/log\/journal\s*/d' "$TMPFILES_CONF"
if ! grep -q 'Z /run/log/journal ~2750 root systemd-journal - -' "$TMPFILES_CONF"; then
if grep -qP "^[zZ][+]*\s+\/run\/log\/journal" "$TMPFILES_CONF"; then
sed -i --follow-symlinks "s/\(^[zZ][+]*\)\(\s\+\/run\/log\/journal.*\)/# \1\2/" "$TMPFILES_CONF"
fi
echo "Z /run/log/journal ~2750 root systemd-journal - -" >>"$TMPFILES_CONF"
fi
echo "Z /run/log/journal ~2750 root systemd-journal - -" >> "$TMPFILES_CONF"

systemd-tmpfiles --create
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@

TMPFILES_CONF="/usr/lib/tmpfiles.d/systemd.conf"

if grep -qP "^[zZ][+]*\s+\/var\/log\/journal\s+" "$TMPFILES_CONF"; then
sed -i --follow-symlinks -E '/[zZ][+]*\s+\/var\/log\/journal\s*/d' "$TMPFILES_CONF"
if ! grep -q 'Z /var/log/journal ~2750 root systemd-journal - -' "$TMPFILES_CONF"; then
if grep -qP "^[zZ][+]*\s+\/var\/log\/journal" "$TMPFILES_CONF"; then
sed -i --follow-symlinks "s/\(^[zZ][+]*\)\(\s\+\/var\/log\/journal.*\)/# \1\2/" "$TMPFILES_CONF"
fi
echo "Z /var/log/journal ~2750 root systemd-journal - -" >>"$TMPFILES_CONF"
fi
echo "Z /var/log/journal ~2750 root systemd-journal - -" >> "$TMPFILES_CONF"

if grep -qP "^[zZ][+]*\s+\/run\/log\/journal\s+" "$TMPFILES_CONF"; then
sed -i --follow-symlinks -E '/[zZ][+]*\s+\/run\/log\/journal\s*/d' "$TMPFILES_CONF"
if ! grep -q 'Z /run/log/journal ~2750 root systemd-journal - -' "$TMPFILES_CONF"; then
if grep -qP "^[zZ][+]*\s+\/run\/log\/journal" "$TMPFILES_CONF"; then
sed -i --follow-symlinks "s/\(^[zZ][+]*\)\(\s\+\/run\/log\/journal.*\)/# \1\2/" "$TMPFILES_CONF"
fi
echo "Z /run/log/journal ~2750 root systemd-journal - -" >>"$TMPFILES_CONF"
fi
echo "Z /run/log/journal ~2750 root systemd-journal - -" >> "$TMPFILES_CONF"

systemd-tmpfiles --create
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@

TMPFILES_CONF="/usr/lib/tmpfiles.d/systemd.conf"

if grep -qP "^[zZ][+]*\s+\/var\/log\/journal\s+" "$TMPFILES_CONF"; then
sed -i --follow-symlinks -E '/[zZ][+]*\s+\/var\/log\/journal\s*/d' "$TMPFILES_CONF"
if ! grep -q 'Z /var/log/journal ~2750 root systemd-journal - -' "$TMPFILES_CONF"; then
if grep -qP "^[zZ][+]*\s+\/var\/log\/journal" "$TMPFILES_CONF"; then
sed -i --follow-symlinks "s/\(^[zZ][+]*\)\(\s\+\/var\/log\/journal.*\)/# \1\2/" "$TMPFILES_CONF"
fi
echo "Z /var/log/journal ~2750 root systemd-journal - -" >>"$TMPFILES_CONF"
fi
echo "Z /var/log/journal ~2750 root systemd-journal - -" >> "$TMPFILES_CONF"

if grep -qP "^[zZ][+]*\s+\/run\/log\/journal\s+" "$TMPFILES_CONF"; then
sed -i --follow-symlinks -E '/[zZ][+]*\s+\/run\/log\/journal\s*/d' "$TMPFILES_CONF"
if ! grep -q 'Z /run/log/journal ~2750 root systemd-journal - -' "$TMPFILES_CONF"; then
if grep -qP "^[zZ][+]*\s+\/run\/log\/journal" "$TMPFILES_CONF"; then
sed -i --follow-symlinks "s/\(^[zZ][+]*\)\(\s\+\/run\/log\/journal.*\)/# \1\2/" "$TMPFILES_CONF"
fi
echo "Z /run/log/journal ~2750 root systemd-journal - -" >>"$TMPFILES_CONF"
fi
echo "Z /run/log/journal ~2750 root systemd-journal - -" >> "$TMPFILES_CONF"

systemd-tmpfiles --create
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@

TMPFILES_CONF="/usr/lib/tmpfiles.d/systemd.conf"

if grep -qP "^[zZ][+]*\s+\/var\/log\/journal\s+" "$TMPFILES_CONF"; then
sed -i --follow-symlinks -E '/[zZ][+]*\s+\/var\/log\/journal\s*/d' "$TMPFILES_CONF"
if ! grep -q 'Z /var/log/journal ~2750 root systemd-journal - -' "$TMPFILES_CONF"; then
if grep -qP "^[zZ][+]*\s+\/var\/log\/journal" "$TMPFILES_CONF"; then
sed -i --follow-symlinks "s/\(^[zZ][+]*\)\(\s\+\/var\/log\/journal.*\)/# \1\2/" "$TMPFILES_CONF"
fi
echo "Z /var/log/journal ~2750 root systemd-journal - -" >>"$TMPFILES_CONF"
fi
echo "Z /var/log/journal ~2750 root systemd-journal - -" >> "$TMPFILES_CONF"

if grep -qP "^[zZ][+]*\s+\/run\/log\/journal\s+" "$TMPFILES_CONF"; then
sed -i --follow-symlinks -E '/[zZ][+]*\s+\/run\/log\/journal\s*/d' "$TMPFILES_CONF"
if ! grep -q 'Z /run/log/journal ~2750 root systemd-journal - -' "$TMPFILES_CONF"; then
if grep -qP "^[zZ][+]*\s+\/run\/log\/journal" "$TMPFILES_CONF"; then
sed -i --follow-symlinks "s/\(^[zZ][+]*\)\(\s\+\/run\/log\/journal.*\)/# \1\2/" "$TMPFILES_CONF"
fi
echo "Z /run/log/journal ~2750 root systemd-journal - -" >>"$TMPFILES_CONF"
fi
echo "Z /run/log/journal ~2750 root systemd-journal - -" >> "$TMPFILES_CONF"

systemd-tmpfiles --create

0 comments on commit 84a9e52

Please sign in to comment.