Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
comparison sbin/fjail @ 452:d5591ebc303d
Use "--" for jexec and chroot to accept more unconvenient jail names and/or directories
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Fri, 10 May 2024 13:42:10 +0200 |
| parents | f6f64fd6f17b |
| children | c615279bb797 |
comparison
equal
deleted
inserted
replaced
| 451:e7eba671bd74 | 452:d5591ebc303d |
|---|---|
| 127 ref_version="${2:-}" | 127 ref_version="${2:-}" |
| 128 | 128 |
| 129 if [ -z "${ref_version}" ]; then | 129 if [ -z "${ref_version}" ]; then |
| 130 ref_version=$(/bin/freebsd-version -u) || exit 1 | 130 ref_version=$(/bin/freebsd-version -u) || exit 1 |
| 131 fi | 131 fi |
| 132 _directory_version=$(chroot "${directory}" /bin/freebsd-version -u) || exit 1 | 132 _directory_version=$(chroot -- "${directory}" /bin/freebsd-version -u) || exit 1 |
| 133 if [ "${ref_version%%-*}" = "${_directory_version%%-*}" ]; then | 133 if [ "${ref_version%%-*}" = "${_directory_version%%-*}" ]; then |
| 134 return 0 | 134 return 0 |
| 135 fi | 135 fi |
| 136 return 1 | 136 return 1 |
| 137 } | 137 } |
| 452 echo "WARNING: \"${_mp}/etc/resolv.conf\" exists already -- not changed" | 452 echo "WARNING: \"${_mp}/etc/resolv.conf\" exists already -- not changed" |
| 453 fi | 453 fi |
| 454 | 454 |
| 455 # Call newaliases within the jail | 455 # Call newaliases within the jail |
| 456 echo "Calling \"newaliases\"" | 456 echo "Calling \"newaliases\"" |
| 457 chroot "${_mp}" /usr/bin/newaliases | 457 chroot -- "${_mp}" /usr/bin/newaliases |
| 458 | 458 |
| 459 _pcl="${_mp}/etc/periodic.conf.local" | 459 _pcl="${_mp}/etc/periodic.conf.local" |
| 460 if [ ! -f "${_pcl}" ]; then | 460 if [ ! -f "${_pcl}" ]; then |
| 461 echo "Adjusting periodic.conf.local" | 461 echo "Adjusting periodic.conf.local" |
| 462 echo "Periodic script log into files ..." | 462 echo "Periodic script log into files ..." |
| 488 echo "monthly_statistics_report_devices=\"NO\"" >> "${_pcl}" | 488 echo "monthly_statistics_report_devices=\"NO\"" >> "${_pcl}" |
| 489 # If enabled: report ports | 489 # If enabled: report ports |
| 490 echo "monthly_statistics_report_ports=\"YES\"" >> "${_pcl}" | 490 echo "monthly_statistics_report_ports=\"YES\"" >> "${_pcl}" |
| 491 | 491 |
| 492 echo "Creating system logfiles that are marked for automatic creation ..." | 492 echo "Creating system logfiles that are marked for automatic creation ..." |
| 493 chroot "${_mp}" /usr/sbin/newsyslog -CN | 493 chroot -- "${_mp}" /usr/sbin/newsyslog -CN |
| 494 | 494 |
| 495 else | 495 else |
| 496 echo "WARNING: \"${_pcl}\" exists already -- not changed" | 496 echo "WARNING: \"${_pcl}\" exists already -- not changed" |
| 497 fi | 497 fi |
| 498 | 498 |
