public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Yuta SATOH" <nigoro@gentoo.gr.jp>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoo-bsd:master commit in: scripts/
Date: Sat, 11 Jul 2015 11:17:41 +0000 (UTC)	[thread overview]
Message-ID: <1436613437.e88134b0d8b010d1d268c477a4bc504fb785eefb.yuta_satoh@gentoo> (raw)

commit:     e88134b0d8b010d1d268c477a4bc504fb785eefb
Author:     Yuta SATOH <nigoro <AT> gentoo <DOT> gr <DOT> jp>
AuthorDate: Sat Jul 11 11:17:17 2015 +0000
Commit:     Yuta SATOH <nigoro <AT> gentoo <DOT> gr <DOT> jp>
CommitDate: Sat Jul 11 11:17:17 2015 +0000
URL:        https://gitweb.gentoo.org/proj/gentoo-bsd.git/commit/?id=e88134b0

added sample script to automatic update.

 scripts/automatic_updater.sh | 136 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 136 insertions(+)

diff --git a/scripts/automatic_updater.sh b/scripts/automatic_updater.sh
new file mode 100644
index 0000000..0fd381b
--- /dev/null
+++ b/scripts/automatic_updater.sh
@@ -0,0 +1,136 @@
+#/bin/bash
+set -eu
+
+if [[ $# -ne 2 ]] ; then
+	echo "need 2 argument"
+	echo "arg 1: TARGETVER"
+	echo "arg 2: TARGETMODE, Please set kernel, freebsd_userland, world."
+	exit 1
+else
+	TARGETVER=$1
+	TARGETMODE=$2
+fi
+
+set_profile(){
+	emerge --info | head -n 1 | grep clang && :
+	if [[ $? -eq 0 ]] ; then
+		eselect profile set $(eselect profile list | awk '{print $1}' | sed 's:\[::g' | sed 's:\]::g' | tail -n 1)
+	else
+		eselect profile set $(eselect profile list | grep -v clang | awk '{print $1}' | sed 's:\[::g' | sed 's:\]::g' | tail -n 1)
+	fi
+}
+
+move_makeconf(){
+	[[ ! -e /etc/portage ]] && mkdir -p /etc/portage
+	if [[ -e /etc/make.conf ]] && [[ ! -e /etc/portage/make.conf ]] ; then
+		mv /etc/make.conf /etc/portage/make.conf
+	fi
+	gsed -i '/LDFLAGS=/d' /etc/portage/make.conf
+}
+
+update_portage(){
+	emerge -p --nodeps dev-lang/python-exec && :
+	if [[ $? -eq 0 ]] ; then
+		emerge --nodeps dev-lang/python-exec
+	fi
+	if [[ ! -e /usr/lib/python-exec ]] ; then
+		cd /tmp
+		wget http://dev.gentoo.org/~dolsen/releases/portage/portage-2.2.20.tar.bz2
+		tar xjf portage-2.2.20.tar.bz2
+		PYTHON_TARGETS="python2_7" portage-2.2.20/bin/emerge --nodeps dev-lang/python-exec
+		PYTHON_TARGETS="python2_7" portage-2.2.20/bin/emerge --nodeps sys-apps/portage
+		emerge -u sys-apps/portage --exclude sys-freebsd/*
+	else
+		emerge -u sys-apps/portage --exclude sys-freebsd/*
+	fi
+}
+
+update_minimal(){
+	emerge sys-freebsd/freebsd-mk-defs
+	emerge -u sys-apps/findutils --exclude sys-freebsd/*
+	emerge sys-devel/libtool --exclude sys-freebsd/*
+	emerge -u sys-devel/flex sys-devel/patch sys-devel/m4 net-libs/libpcap sys-devel/gettext app-arch/libarchive sys-libs/zlib dev-util/dialog --exclude sys-freebsd/*
+	emerge sys-devel/libtool --exclude sys-freebsd/*
+	if [[ -e /usr/lib/libc++.so ]] ; then
+		emerge -uN sys-libs/libcxx sys-libs/libcxxrt --exclude sys-freebsd/*
+	fi
+}
+
+update_gcc(){
+	if [[ $(uname -p) == "amd64" ]] ; then
+		gsed -i "s:CHOST=.*:CHOST=\"x86_64-gentoo-freebsd${TARGETVER}\":g" /etc/portage/make.conf
+	else
+		gsed -i "s:CHOST=.*:CHOST=\"i686-gentoo-freebsd${TARGETVER}\":g" /etc/portage/make.conf
+	fi
+	emerge -u sys-devel/binutils --exclude sys-freebsd/*
+	emerge -u sys-devel/gcc-config --exclude sys-freebsd/*
+	emerge -u sys-devel/gcc --exclude sys-freebsd/*
+#	gcc-config $(gcc-config -l | awk '{print $1}' | sed 's:\[::g' | sed 's:\]::g' | tail -n 1)
+	emerge -C \<$(emerge -pq --nodeps sys-devel/gcc --exclude sys-freebsd/* | grep ebuild | awk '{print $4}') && :
+	env-update
+	source /etc/profile
+	emerge sys-devel/libtool --exclude sys-freebsd/*
+}
+
+update_kernel(){
+	emerge -C freebsd-sources sys-freebsd/virtio-kmod sys-fs/fuse4bsd && :
+	emerge --nodeps freebsd-sources
+	echo "Don't have a problem? Now we restart. "
+	echo "shutdown -r now"
+}
+
+update_freebsd_userland(){
+	if [[ $(uname -p) == "amd64" ]] && [[ ! -e /libexec/ld-elf32.so.1 ]] ; then
+		[[ ! -e /etc/portage/profile ]] && mkdir -p /etc/portage/profile
+		echo "sys-freebsd/freebsd-libexec abi_x86_32" >> /etc/portage/profile/package.use.mask
+	fi
+
+	emerge -C dev-libs/libelf dev-libs/libexecinfo dev-libs/libiconv sys-process/fuser-bsd && :
+	emerge --nodeps sys-freebsd/freebsd-libexec
+	USE=build emerge --nodeps sys-freebsd/freebsd-lib
+	USE=build emerge --nodeps sys-freebsd/freebsd-share
+	[[ -e /etc/portage/profile/package.use.mask ]] && gsed -i '/sys-freebsd\/freebsd-libexec abi_x86_32/d' /etc/portage/profile/package.use.mask
+
+	emerge boot0 freebsd-bin freebsd-lib freebsd-libexec freebsd-mk-defs freebsd-pam-modules freebsd-sbin freebsd-share freebsd-ubin freebsd-usbin
+	emerge boot0 freebsd-bin freebsd-lib freebsd-libexec freebsd-mk-defs freebsd-pam-modules freebsd-sbin freebsd-share freebsd-ubin freebsd-usbin
+}
+
+post_freebsd_userland(){
+	emerge sys-devel/libtool app-admin/eselect
+	emerge sys-apps/portage
+}
+
+emerge_world(){
+	emerge sys-devel/libtool
+	emerge -e @world --exclude sys-apps/portage
+	emerge sys-apps/portage
+}
+
+cleanup(){
+	emerge sys-devel/libtool app-admin/eselect
+	emerge @preserved-rebuild
+}
+
+case "$TARGETMODE" in
+	"kernel" )
+		set_profile
+		move_makeconf
+		update_portage
+		update_minimal
+		update_gcc
+		update_kernel
+	;;
+	"freebsd_userland" )
+		update_freebsd_userland
+		post_freebsd_userland
+	;;
+	"world" )
+		emerge_world
+		cleanup
+	;;
+	* )
+		echo "Please set kernel, freebsd_userland, world."
+		exit 1
+	;;
+esac
+


             reply	other threads:[~2015-07-11 11:17 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-11 11:17 Yuta SATOH [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-01-03 11:18 [gentoo-commits] proj/gentoo-bsd:master commit in: scripts/ Yuta SATOH
2018-01-02 13:39 Yuta SATOH
2017-12-07 13:39 Yuta SATOH
2016-08-17 12:16 Yuta SATOH
2015-08-22 22:57 Yuta SATOH
2015-08-22 12:18 Yuta SATOH
2015-08-21 12:43 Yuta SATOH
2015-08-15  0:47 Yuta SATOH
2015-07-13 12:40 Yuta SATOH
2015-07-13 12:38 Yuta SATOH
2015-07-12 15:58 Yuta SATOH
2015-07-12 14:08 Yuta SATOH
2015-07-12 12:09 Yuta SATOH
2015-07-12 10:52 Yuta SATOH
2015-07-12  7:35 Yuta SATOH
2015-07-12  4:43 Yuta SATOH
2015-07-12  0:09 Yuta SATOH
2014-10-28 12:03 Yuta SATOH
2013-10-09 11:15 Yuta SATOH
2012-10-14  6:08 Yuta SATOH
2011-11-07 12:07 Alexis Ballier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1436613437.e88134b0d8b010d1d268c477a4bc504fb785eefb.yuta_satoh@gentoo \
    --to=nigoro@gentoo.gr.jp \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox