summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcommon.sh24
-rwxr-xr-xkernel44
-rwxr-xr-xportage51
3 files changed, 119 insertions, 0 deletions
diff --git a/common.sh b/common.sh
new file mode 100755
index 0000000..315a6a0
--- /dev/null
+++ b/common.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+renice 15 $$
+ionice -c 3 -p $$
+
+cmd() {
+ while :; do
+ printf '[*] '
+ printf '%s ' "$@"
+ echo
+ if "$@"; then
+ break
+ else
+ printf "\"%s\" exited $?, dropping to shell... Exit 0 to retry, 2 to ignore, 3 to abort.\n" "$*"
+ $SHELL
+ case $? in
+ 2) break ;;
+ 3) exit 3 ;;
+ esac
+ fi
+ done
+}
+
+trap : INT
diff --git a/kernel b/kernel
new file mode 100755
index 0000000..0f0ab57
--- /dev/null
+++ b/kernel
@@ -0,0 +1,44 @@
+#!/bin/sh
+. "${0%/*}/common.sh" "$@"
+cmd cd "$HOME/linux"
+[ "$1" = -p ] || cmd git pull --rebase=merges
+cmd mkdir -p /tmp/linux-build
+cmd cp "$HOME/kernel-configs/current" /tmp/linux-build/.config
+export PATH="/usr/lib/ccache/bin:$PATH"
+export CCACHE_BASEDIR=/tmp/linux-build
+export CCACHE_DIR=${XDG_CACHE_HOME:-$HOME/.cache}/kernel-ccache
+cmd make O=/tmp/linux-build oldconfig
+KCFLAGS=${KCFLAGS-'-pipe -fgraphite-identity -floop-nest-optimize -fipa-pta -fno-ipa-cp-clone -fno-align-jumps -fno-align-functions -fno-align-loops -fno-align-labels -fno-prefetch-loop-arrays'}
+cmd make O=/tmp/linux-build KCFLAGS="${KCFLAGS}"
+cd /tmp/linux-build
+kernelrelease=$(make -s kernelrelease)
+bas=/boot/vmlinuz
+new=$bas.new
+ins=$bas-${kernelrelease}
+cmd sudo cp arch/x86/boot/bzImage "$new"
+cmd sudo mv "$new" "$ins"
+loader_entry=linux-${kernelrelease}
+cmd sudo sh -c "cat > /boot/loader/entries/$loader_entry.conf << EOF
+title Linux
+version ${kernelrelease}
+linux /vmlinuz-${kernelrelease}
+options libahci.ignore_sss=1 vfio-pci.ids=1002:aaf0 amdgpu.ppfeaturemask=0xffffffff amdgpu.dcfeaturemask=0xb quiet
+initrd /amd-uc.img
+initrd /initramfs.img
+EOF"
+cmd sudo bootctl set-default $loader_entry.conf
+
+cmd sudo rm -rf /lib/modules/$kernelrelease
+cmd sudo make modules_install
+builddir=/lib/modules/$kernelrelease/build
+cmd sudo rm -rf "$builddir"
+cmd sudo install -Dt "$builddir" -m644 .config
+cmd sudo install -Dt "$builddir" -m644 $HOME/linux/Makefile
+cmd sudo sh -c "xz -9c vmlinux > '$builddir/vmlinux.xz'"
+cmd sudo sh -c "xz -9c System.map > '$builddir/System.map.xz'"
+cmd sudo rm -f /usr/src/linux
+cmd sudo ln -sr "$builddir" /usr/src/linux
+
+cd /
+cmd rm -rf /tmp/linux-build
+#sudo emerge -1 --ask=n --usepkg=n @module-rebuild
diff --git a/portage b/portage
new file mode 100755
index 0000000..5464937
--- /dev/null
+++ b/portage
@@ -0,0 +1,51 @@
+#!/bin/sh
+. "${0%/*}/common.sh"
+if [ "$1" != -p ]; then
+ cmd cd /usr/portage
+ cmd git fetch
+ chks=
+ d=/home/alex/gentoo-overlay
+ for chk in $d/*/*; do
+ f=${chk#$d/}
+ case "$f" in
+ metadata/layout.conf|profiles/repo_name) continue
+ esac
+ case "$f" in
+ profiles/*) f=profiles/base/${f#profiles/}
+ esac
+ if [ -e "$f" ]; then
+ chks="$chks $f"
+ fi
+ done
+ cmd git --no-pager log --oneline ..@{u} -- $chks dev-java/openjdk dev-java/openjdk-bin dev-java/openjdk-jre-bin virtual/jdk virtual/jre profiles/base/package.use.mask
+ stashed=
+ if [ "$(git status --porcelain | head -c1)" != "" ]; then
+ cmd git stash
+ stashed=1
+ fi
+ cmd git rebase @{u}
+ if [ -n "$stashed" ]; then
+ cmd git stash pop
+ fi
+ cmd sudo emerge --sync
+ for f in /etc/portage/repo.postsync.d/*; do
+ if [ -x "$f" ]; then
+ cmd "$f" gentoo "" /usr/portage
+ fi
+ done
+ cmd mv /var/cache/eix/portage.eix /var/cache/eix/previous.eix
+ cmd sudo eix-update
+ cmd sudo eix-diff
+fi
+if [ "$(eselect news count)" != 0 ]; then
+ cmd sudo eselect news read
+ printf 'Press enter to continue...\n'
+ read REPLY
+fi
+cmd sudo emerge -uD --changed-use @world
+cmd sudo smart-live-rebuild -- --usepkg=n
+# needs --usepkg-exclude
+#cmd sudo emerge @preserved-rebuild
+cmd sudo dispatch-conf
+cmd sudo emerge --depclean --deep --verbose=n
+cmd sudo revdep-rebuild --ignore --verbose -- --usepkg=n