Page MenuHomeFreeBSD

D56381.diff
No OneTemporary

D56381.diff

diff --git a/sysutils/firstboot-pkg-upgrade/Makefile b/sysutils/firstboot-pkg-upgrade/Makefile
new file mode 100644
--- /dev/null
+++ b/sysutils/firstboot-pkg-upgrade/Makefile
@@ -0,0 +1,20 @@
+PORTNAME= firstboot-pkg-upgrade
+PORTVERSION= 1.0
+CATEGORIES= sysutils
+MASTER_SITES= # none
+DISTFILES= # none
+EXTRACT_ONLY= # none
+
+MAINTAINER= ziaee@FreeBSD.org
+COMMENT= Update the system using pkg when it first boots
+
+LICENSE= BSD2CLAUSE
+
+NO_WRKSUBDIR= yes
+NO_BUILD= yes
+NO_INSTALL= yes
+NO_ARCH= yes
+
+USE_RC_SUBR= firstboot_pkg_upgrade
+
+.include <bsd.port.mk>
diff --git a/sysutils/firstboot-pkg-upgrade/files/firstboot_pkg_upgrade.in b/sysutils/firstboot-pkg-upgrade/files/firstboot_pkg_upgrade.in
new file mode 100644
--- /dev/null
+++ b/sysutils/firstboot-pkg-upgrade/files/firstboot_pkg_upgrade.in
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+# KEYWORD: firstboot
+# PROVIDE: firstboot_pkg_upgrade
+# REQUIRE: syslogd NETWORKING
+# BEFORE: LOGIN
+
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf (in the
+# disk image, since this only runs on the first boot) to enable this:
+#
+# firstboot_pkg_upgrade_enable="YES"
+#
+# By default this upgrades all packages, to limit this to a specific repo,
+# write it in firstboot_pkg_upgrade_repos, e.g.,
+#
+# firstboot_pkg_upgrade_repos="FreeBSD-Base FreeBSD-Ports"
+#
+# By default this script will only run on *-BETA*, *-RC*, and *-RELEASE*
+# systems, since those are the only ones for which updates are provided
+# by the FreeBSD project; to run pkg upgrade anyway (e.g., on a custom
+# release for which you are providing your own pkg repo), set:
+#
+# firstboot_pkg_upgrade_nonstandard="YES"
+
+. /etc/rc.subr
+
+: ${firstboot_pkg_upgrade_enable:="NO"}
+: ${firstboot_pkg_upgrade_nonstandard:="NO"}
+
+name="firstboot_pkg_upgrade"
+rcvar=firstboot_pkg_upgrade_enable
+start_cmd="firstboot_pkg_upgrade_run | logger -s -t pkg"
+stop_cmd=":"
+
+firstboot_pkg_upgrade_run()
+{
+
+ if ! checkyesno firstboot_pkg_upgrade_nonstandard; then
+ case "`uname -r`" in
+ *-BETA* | *-RC* | *-RELEASE*)
+ ;;
+ *)
+ echo "Firstboot pkg upgrade disabled on `uname -r`"
+ return 0
+ ;;
+ esac
+ fi
+
+ repo_args=""
+
+ for repo in ${firstboot_pkg_upgrade_repos}; do
+ repo_args="${repo_args} -r ${repo}"
+ done
+
+ env AUTOCLEAN=ON pkg upgrade ${repo_args} -y
+ echo "Requesting reboot after installing updates."
+ touch ${firstboot_sentinel}-reboot
+}
+
+load_rc_config $name
+run_rc_command "$1"
+
diff --git a/sysutils/firstboot-pkg-upgrade/pkg-descr b/sysutils/firstboot-pkg-upgrade/pkg-descr
new file mode 100644
--- /dev/null
+++ b/sysutils/firstboot-pkg-upgrade/pkg-descr
@@ -0,0 +1,6 @@
+Run 'pkg upgrade' when the system first boots to check for any software
+updates, apply them, and request a reboot.
+
+Obviously, this port is not useful after a system is already running; it is
+intended to be included as part of the installation or disk image building
+process.

File Metadata

Mime Type
text/plain
Expires
Sun, Apr 19, 6:32 PM (2 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31676929
Default Alt Text
D56381.diff (2 KB)

Event Timeline