summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuta SATOH <nigoro.dev@gmail.com>2017-12-07 22:14:27 +0900
committerYuta SATOH <nigoro.dev@gmail.com>2017-12-07 22:14:27 +0900
commitb477cae6a1f05eb0f562c8f9294ec3db4c3d1be2 (patch)
tree54ea3c292410f3015ade60821e3e93cd4c6472c3 /scripts
parentclean up freebsd 11.0 related files. (diff)
downloadgentoo-bsd-b477cae6a1f05eb0f562c8f9294ec3db4c3d1be2.tar.gz
gentoo-bsd-b477cae6a1f05eb0f562c8f9294ec3db4c3d1be2.tar.bz2
gentoo-bsd-b477cae6a1f05eb0f562c8f9294ec3db4c3d1be2.zip
automatic_updater.sh: updated. It targets 11.1.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/automatic_updater.sh165
1 files changed, 122 insertions, 43 deletions
diff --git a/scripts/automatic_updater.sh b/scripts/automatic_updater.sh
index 3f1b639..2afa6f6 100755
--- a/scripts/automatic_updater.sh
+++ b/scripts/automatic_updater.sh
@@ -1,9 +1,13 @@
#/bin/bash
set -eu
REMOVEPERL=${REMOVEPERL:-0}
+PORTDIR="/usr/portage"
+DISTDIR="${PORTDIR}/distfiles"
+PORTAGE_TMPDIR="/var/tmp"
if [[ $# -ne 2 ]] ; then
- echo "need 2 argument"
+ echo "Two arguments are required."
+ echo ""
echo "arg 1: TARGETVER"
echo "arg 2: TARGETMODE, Please set kernel, freebsd_userland, world."
exit 1
@@ -13,9 +17,12 @@ else
fi
set_profile(){
- emerge --info | head -n 1 | grep clang && :
+ echo "Setting the ${TARGETVER} profile..."
+
+ emerge --info | head -n 1 | grep clang &>/dev/null && :
if [[ $? -eq 0 ]] ; then
eselect profile set $(eselect profile list | grep "${TARGETVER}" | grep clang | awk '{print $1}' | sed 's:\[::g' | sed 's:\]::g' | tail -n 1)
+ export CXX="clang++ -stdlib=libc++"
else
eselect profile set $(eselect profile list | grep "${TARGETVER}" | grep -v clang | awk '{print $1}' | sed 's:\[::g' | sed 's:\]::g' | tail -n 1)
fi
@@ -24,25 +31,56 @@ set_profile(){
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
+ echo "Moving the /etc/make.conf to /etc/portage..."
+ mv /etc/make.conf /etc/portage
fi
gsed -i '/LDFLAGS=/d' /etc/portage/make.conf
+ if [[ -e /etc/make.profile ]] && [[ ! -e /etc/portage/make.profile ]] ; then
+ echo "Creating the make.profile..."
+ ln -s ../..${PORTDIR}profiles/$(eselect profile list | grep '*' | awk '{print $2}') /etc/portage/make.profile
+ fi
}
update_portage(){
- local dl_portage_ver="2.2.20.1"
+ local dl_portage_ver="2.3.8"
+
+ echo "Updating the sys-apps/portage with a manual method..."
+
cd /tmp
- wget http://dev.gentoo.org/~dolsen/releases/portage/portage-${dl_portage_ver}.tar.bz2
- tar xjf portage-${dl_portage_ver}.tar.bz2
- PYTHON_TARGETS="python2_7" "portage-${dl_portage_ver}"/bin/emerge --nodeps dev-lang/python-exec
+ if [[ -e "${DISTDIR}"/portage-${dl_portage_ver}.tar.bz2 ]] ; then
+ cp -a "${DISTDIR}/portage-${dl_portage_ver}.tar.bz2" .
+ else
+ wget -q "http://dev.gentoo.org/~dolsen/releases/portage/portage-${dl_portage_ver}.tar.bz2"
+ fi
+
+ tar xjf "portage-${dl_portage_ver}.tar.bz2"
+
+ cd "/tmp/portage-${dl_portage_ver}"
+ PYTHON_TARGETS="python2_7" bin/emerge --nodeps dev-lang/python-exec
eselect python set 1
- "portage-${dl_portage_ver}"/bin/emerge sys-apps/portage --exclude sys-freebsd/*
- emerge dev-lang/python-exec --exclude sys-freebsd/*
- emerge app-admin/eselect --exclude sys-freebsd/*
+ PYTHON_TARGETS="python2_7" bin/emerge --nodeps sys-apps/portage --exclude sys-freebsd/*
+
eselect python set 1
}
+update_bmake(){
+ echo "Updating the bmake..."
+
+ [[ -e /usr/local/bin/make ]] && exit 1
+
+ cd "${PORTDIR}/sys-freebsd/freebsd-ubin" && ebuild $(ls -1 freebsd-ubin-${TARGETVER}*.ebuild | tail -n 1) prepare
+ cd "${PORTAGE_TMPDIR}"/portage/sys-freebsd/freebsd-ubin-${TARGETVER}*/work/usr.bin/bmake
+ make
+ cp -a make /usr/local/bin/
+ cd "${PORTDIR}/sys-freebsd/freebsd-ubin" && ebuild $(ls -1 freebsd-ubin-${TARGETVER}*.ebuild | tail -n 1) clean
+}
+
update_minimal(){
+ echo "Updating the minimal packages to upgrade the Gentoo/FreeBSD..."
+
+ emerge -u sys-devel/gcc-config --exclude sys-freebsd/*
+ update_bmake
+
emerge --nodeps sys-freebsd/freebsd-mk-defs
emerge -u '<sys-apps/findutils-4.6' --exclude sys-freebsd/*
emerge sys-devel/libtool --exclude sys-freebsd/*
@@ -51,14 +89,18 @@ update_minimal(){
USE="-*" emerge --nodeps sys-devel/gettext --exclude sys-freebsd/*
emerge sys-devel/gettext --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/*
+ USE="-acl" emerge -u app-arch/libarchive --exclude sys-freebsd/*
+ emerge -u sys-devel/flex sys-devel/patch sys-devel/m4 net-libs/libpcap sys-devel/gettext sys-libs/zlib dev-util/dialog --exclude sys-freebsd/*
emerge sys-devel/libtool --exclude sys-freebsd/*
+
if [[ -e /usr/lib/libc++.so ]] ; then
- if [[ $(uname -p) == "amd64" ]] && [[ ! -e /usr/lib32/librt.so ]] ; then
+ if [[ $(uname -p) == amd64 ]] && [[ ! -e /usr/lib32/librt.so ]] ; then
[[ ! -e /etc/portage/profile ]] && mkdir -p /etc/portage/profile
echo "sys-libs/libcxx abi_x86_32" >> /etc/portage/profile/package.use.mask
echo "sys-libs/libcxxrt abi_x86_32" >> /etc/portage/profile/package.use.mask
- emerge -uN sys-libs/libcxx sys-libs/libcxxrt --exclude sys-freebsd/*
+ USE="internal-glib" emerge -u dev-util/pkgconfig --exclude sys-freebsd/*
+ USE="-nls" emerge -u cmake --exclude sys-freebsd/*
+ emerge --nodeps '<sys-libs/libcxx-3.9' '<sys-libs/libcxxrt-3.9' --exclude sys-freebsd/*
[[ -e /etc/portage/profile/package.use.mask ]] && gsed -i '/sys-libs\/libcxx abi_x86_32/d' /etc/portage/profile/package.use.mask
[[ -e /etc/portage/profile/package.use.mask ]] && gsed -i '/sys-libs\/libcxxrt abi_x86_32/d' /etc/portage/profile/package.use.mask
fi
@@ -66,80 +108,117 @@ update_minimal(){
}
update_toolchain(){
- if [[ $(uname -p) == "amd64" ]] ; then
+ echo "Updating the toolchains..."
+
+ 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/*
+
+ # https://bugs.gentoo.org/629128
+ [[ ! -e /etc/portage/package.unmask ]] && mkdir -p /etc/portage/package.unmask
+ echo "sys-devel/binutils" > /etc/portage/package.unmask/binutils-oldversion
+ emerge -u '<sys-devel/binutils-2.28' --exclude sys-freebsd/*
emerge -u sys-devel/gcc-config --exclude sys-freebsd/*
- emerge -u '<sys-devel/gcc-5.0' --exclude sys-freebsd/*
+ emerge -u '<sys-devel/gcc-5.0' --exclude sys-freebsd/* --exclude sys-devel/binutils
gcc-config $(gcc-config -l | grep "${TARGETVER}" | 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/*
- emerge sys-devel/binutils --exclude sys-freebsd/*
- if type -P clang > /dev/null ; then
- emerge -u '<sys-devel/clang-3.7' --exclude sys-freebsd/*
- fi
}
update_kernel(){
+ echo "Updating the kernel..."
+
emerge -C freebsd-sources sys-freebsd/virtio-kmod sys-fs/fuse4bsd && :
- emerge --nodeps freebsd-sources
+ emerge freebsd-sources
+}
+
+fix_dependence_issue(){
+ echo "" > /var/db/pkg/sys-freebsd/freebsd-lib-*/RDEPEND
+ rm /var/db/pkg/sys-freebsd/freebsd-lib-*/*.ebuild
+ echo "" > /var/db/pkg/dev-libs/glib-*/RDEPEND
+ echo "" > /var/db/pkg/dev-libs/glib-*/DEPEND
+ rm /var/db/pkg/dev-libs/glib-*/*.ebuild
+ rm /var/db/pkg/sys-freebsd/freebsd-libexec-*/*.ebuild
}
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
+ echo "Updating the FreeBSD userland..."
- emerge -C dev-libs/libelf dev-libs/libexecinfo dev-libs/libiconv sys-process/fuser-bsd && :
- CC=gcc CXX=g++ CXXFLAGS="-O2 -pipe" emerge --nodeps sys-freebsd/freebsd-libexec
- CC=gcc CXX=g++ CXXFLAGS="-O2 -pipe" USE=build MAKEOPTS=-j1 emerge --nodeps sys-freebsd/freebsd-lib
- CC=gcc CXX=g++ CXXFLAGS="-O2 -pipe" 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
+ # Fixing the dependence issue:
+ ls -1 /var/db/pkg/sys-freebsd/freebsd-lib-9.* &>/dev/null && :
+ [[ $? -eq 0 ]] && fix_dependence_issue
- CC=gcc CXX=g++ CXXFLAGS="-O2 -pipe" emerge freebsd-bin freebsd-lib freebsd-libexec freebsd-mk-defs freebsd-pam-modules freebsd-sbin freebsd-share freebsd-ubin freebsd-usbin
- if [[ -e /usr/lib/libc++.so ]] ; then
- emerge sys-libs/libcxx sys-libs/libcxxrt --exclude sys-freebsd/*
- emerge -u sys-devel/llvm sys-devel/clang
+ [[ -e /usr/share/misc/windrv_stub.c ]] && rm -rf /usr/share/misc/windrv_stub.c
+
+ CC=gcc CXX=g++ CXXFLAGS="-O2 -pipe" USE=build emerge -u freebsd-bin freebsd-lib freebsd-mk-defs freebsd-pam-modules freebsd-sbin freebsd-share freebsd-sources freebsd-ubin freebsd-usbin
+ emerge freebsd-share
+
+ if type -P clang &> /dev/null ; then
+ emerge dev-util/re2c
+ emerge --nodeps '<sys-libs/libcxxrt-3.9' --exclude sys-freebsd/*
+ emerge --nodeps '<sys-libs/libcxx-3.9' --exclude sys-freebsd/*
+ CMAKE_MAKEFILE_GENERATOR=emake CC=gcc CXX=g++ CXXFLAGS="-O2 -pipe" emerge -u '<sys-devel/llvm-4.0' '<sys-devel/clang-4.0' --exclude sys-freebsd/*
+ CMAKE_MAKEFILE_GENERATOR=emake emerge sys-devel/llvm sys-devel/clang sys-libs/libcxxrt sys-libs/libcxx --exclude sys-freebsd/*
fi
- emerge boot0 freebsd-bin freebsd-lib freebsd-libexec freebsd-mk-defs freebsd-pam-modules freebsd-sbin freebsd-share freebsd-ubin freebsd-usbin
+
+ emerge freebsd-bin freebsd-lib freebsd-mk-defs freebsd-pam-modules freebsd-sbin freebsd-share freebsd-sources freebsd-ubin freebsd-usbin
+
+ [[ -e /usr/local/bin/make ]] && rm /usr/local/bin/make
+ env-update
+ source /etc/profile
}
post_freebsd_userland(){
+ echo "Updating the minimal tools..."
+
emerge sys-devel/libtool app-admin/eselect
emerge sys-apps/portage
}
remove_perl(){
+ echo "Removing and re-installing the dev-lang/perl..."
+
emerge -C dev-lang/perl
emerge -C dev-perl/* perl-core/* virtual/perl*
emerge dev-lang/perl
- emerge dev-perl/Text-Unidecode dev-perl/Unicode-EastAsianWidth dev-perl/XML-Parser dev-perl/libintl-perl
+ emerge dev-perl/Text-Unidecode dev-perl/Unicode-EastAsianWidth dev-perl/XML-Parser
+
+ rm -rf "${PORTAGE_TMPDIR}"/portage/dev-perl/libintl-perl*
+ cd "${PORTDIR}/dev-perl/libintl-perl" && ebuild $(ls -1 libintl-perl-*.ebuild | tail -n 1) clean prepare
+ gsed -i 's:-liconv::g' "${PORTAGE_TMPDIR}"/portage/dev-perl/libintl-perl-*/work/libintl-perl-*/gettext_xs/Makefile.PL
+ ebuild $(ls -1 libintl-perl-*.ebuild | tail -n 1) merge clean
}
emerge_world(){
+ echo "Updating all packages... It takes a lot of time."
+
emerge sys-devel/libtool
- emerge -C dev-lang/python:3.2 && :
+ emerge -C dev-lang/python:3.3 && :
+ gsed -i '/python3.3/d' /etc/python-exec/python-exec.conf
+ USE="internal-glib" emerge -u dev-util/pkgconfig
emerge dev-libs/libxml2
emerge dev-libs/libxslt app-arch/libarchive dev-libs/glib
emerge -u sys-devel/gcc
emerge -C \<$(emerge -pq --nodeps sys-devel/gcc --exclude sys-freebsd/* | grep ebuild | awk '{print $4}') && :
gcc-config $(gcc-config -l | grep "${TARGETVER}" | awk '{print $1}' | sed 's:\[::g' | sed 's:\]::g' | tail -n 1)
source /etc/profile
- emerge -e @world
+ emerge -e @world --exclude dev-perl/libintl-perl
+ emerge -C dev-lang/python:3.2 && :
+ emerge -C '<sys-devel/binutils-2.28.1' && :
+ emerge @preserved-rebuild
+ emerge dev-perl/libintl-perl
+ emerge sys-apps/portage
}
cleanup(){
emerge sys-devel/libtool app-admin/eselect
- emerge @preserved-rebuild
+ echo "done!"
}
-case "$TARGETMODE" in
+case "${TARGETMODE}" in
"kernel" )
set_profile
move_makeconf
@@ -159,8 +238,8 @@ case "$TARGETMODE" in
cleanup
;;
* )
- echo "Please set kernel, freebsd_userland, world."
+ echo "Please set the argument:"
+ echo "kernel, freebsd_userland, world."
exit 1
;;
esac
-