Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9446715e1a | |||
| 890206ba80 | |||
| 79567a647b | |||
| 0769169cc6 | |||
| 03b7b4fd18 | |||
| 39f437f0aa |
@@ -412,14 +412,24 @@ if ($use_equo) {
|
|||||||
say "Devkit version:";
|
say "Devkit version:";
|
||||||
system("equo s -vq app-misc/sabayon-devkit");
|
system("equo s -vq app-misc/sabayon-devkit");
|
||||||
|
|
||||||
|
my @installed_enman_repos = split(/\n/, chomp(system("enman list --installed -q")));
|
||||||
|
|
||||||
if ( $enman_repositories and $enman_repositories ne "" ) {
|
if ( $enman_repositories and $enman_repositories ne "" ) {
|
||||||
my @enman_toadd = split( / /, $enman_repositories );
|
my @enman_toadd = split( / /, $enman_repositories );
|
||||||
safe_call("enman add $_") for @enman_toadd;
|
for my $enman_add (@enman_toadd) {
|
||||||
|
if ! grep ($enman_add, @installed_enman_repos) {
|
||||||
|
safe_call("enman add $_");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $remove_enman_repositories and $remove_enman_repositories ne "" ) {
|
if ( $remove_enman_repositories and $remove_enman_repositories ne "" ) {
|
||||||
my @enman_toremove = split( / /, $remove_enman_repositories );
|
my @enman_toremove = split( / /, $remove_enman_repositories );
|
||||||
system("enman remove $_") for @enman_toremove;
|
for my $enman_remove (@enman_toremove) {
|
||||||
|
if grep ($enman_remove, @installed_enman_repos) {
|
||||||
|
safe_call("enman remove $_");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
system("enman add $repository_name")
|
system("enman add $repository_name")
|
||||||
|
|||||||
Executable
+94
@@ -0,0 +1,94 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
. /sbin/sabayondevkit-functions.sh
|
||||||
|
|
||||||
|
help_msg() {
|
||||||
|
|
||||||
|
echo "
|
||||||
|
sabayon-maint-helper:
|
||||||
|
|
||||||
|
Script for builder boxes maintenance.
|
||||||
|
|
||||||
|
-h|--help This message.
|
||||||
|
--installed Upgrades all the packages installed in the box.
|
||||||
|
--obsolete Upgrades ONLY the packages that are listed obsolete in eix-test-obsolete.
|
||||||
|
--all Tries to upgrade all package without any euristics
|
||||||
|
--category Tries to upgrade/install all the packages in the specified category
|
||||||
|
e.g. sabayon-maint-helper 'app-office'
|
||||||
|
|
||||||
|
Some options could be set also as environment variables:
|
||||||
|
EMERGE_DEFAULT_ARGS Default emerge options
|
||||||
|
|
||||||
|
NOTE: This script MUST be execute as root.
|
||||||
|
"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
parse_args() {
|
||||||
|
|
||||||
|
local short_opts="h"
|
||||||
|
local long_opts="help arch: host-arch: unprivileged stagingdir: image-descr: image:"
|
||||||
|
|
||||||
|
$(set -- $(getopt -u -q -a -o "$short_opts" -l "$long_opts" -- "$@"))
|
||||||
|
|
||||||
|
while [ $# -gt 0 ] ; do
|
||||||
|
case "$1" in
|
||||||
|
|
||||||
|
-h|--help)
|
||||||
|
help_msg
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
--installed)
|
||||||
|
echo "Trying to upgrade all the installed packages"
|
||||||
|
rebuild_all
|
||||||
|
;;
|
||||||
|
--obsolete)
|
||||||
|
echo "Upgrading the packages that are marked as obsolete"
|
||||||
|
build_obsolete
|
||||||
|
;;
|
||||||
|
--all)
|
||||||
|
echo "Upgrading/Installing everything available to install"
|
||||||
|
build_all_availables
|
||||||
|
;;
|
||||||
|
--category)
|
||||||
|
echo "Upgrading/Installing everything inside the '$2' category"
|
||||||
|
build_category_installed "$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--)
|
||||||
|
help_msg
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Invalid parameter $1."
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
|
||||||
|
esac
|
||||||
|
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
|
||||||
|
if [ "$(id -u)" != "0" ]; then
|
||||||
|
echo "This script must be run as root" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "$@" ] && help_msg && exit 1
|
||||||
|
|
||||||
|
(
|
||||||
|
echo "Acquiring lock"
|
||||||
|
flock -x -w 10 200 || ( echo "Failed acquiring lock in 10 seconds" && exit 1 )
|
||||||
|
|
||||||
|
parse_args "$@"
|
||||||
|
|
||||||
|
) 200>/var/lock/.repomaint
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
+64
-39
@@ -9,51 +9,76 @@ check_docker_requirements(){
|
|||||||
|
|
||||||
die() { echo "$@" 1>&2 ; exit 1; }
|
die() { echo "$@" 1>&2 ; exit 1; }
|
||||||
|
|
||||||
build() {
|
|
||||||
local SEARCH=$1
|
|
||||||
local EMERGE_DEFAULT_ARGS=${2:---accept-properties=-interactive --verbose --oneshot --nospinner --noreplace --quiet-build=y --quiet-fail --fail-clean=y --complete-graph --buildpkg}
|
|
||||||
for i in $(EIX_LIMIT=0 eix --only-names --pure-packages "$SEARCH/" | xargs echo | uniq);
|
|
||||||
do
|
|
||||||
echo "Building $i"
|
|
||||||
emerge $EMERGE_DEFAULT_ARGS -o $i && \
|
|
||||||
emerge $EMERGE_DEFAULT_ARGS $i
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
build_installed() {
|
|
||||||
local SEARCH=$1
|
|
||||||
local EMERGE_DEFAULT_ARGS=${2:---accept-properties=-interactive --newuse --noreplace --changed-use --update --verbose --oneshot --nospinner --quiet-build=y --quiet-fail --fail-clean=y --complete-graph --buildpkg}
|
|
||||||
|
|
||||||
for i in $(EIX_LIMIT=0 eix -I --only-names --pure-packages "$SEARCH/" | xargs echo | uniq);
|
|
||||||
do
|
|
||||||
echo "Building $i"
|
|
||||||
emerge $EMERGE_DEFAULT_ARGS $i
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
build_all_availables() {
|
|
||||||
for i in $(cat /usr/portage/profiles/categories | xargs echo | uniq);
|
|
||||||
do
|
|
||||||
build "$i/"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
rebuild_all() {
|
|
||||||
for i in $(cat /usr/portage/profiles/categories | xargs echo | uniq);
|
|
||||||
do
|
|
||||||
build_installed "$i/"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
build_sync() {
|
build_sync() {
|
||||||
emerge-webrsync || exit 1
|
|
||||||
emerge --sync
|
|
||||||
layman -S
|
layman -S
|
||||||
|
emerge --sync
|
||||||
eix-update || exit 1
|
eix-update || exit 1
|
||||||
pushd /opt/sabayon-build/
|
pushd /opt/sabayon-build/
|
||||||
git stash
|
git stash
|
||||||
git fetch --all
|
git fetch --all
|
||||||
git checkout master
|
git checkout master
|
||||||
git reset --heard origin/master
|
git reset --hard origin/master
|
||||||
popd
|
popd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
build_category() {
|
||||||
|
local SEARCH=$1
|
||||||
|
build_sync
|
||||||
|
for i in $(EIX_LIMIT=0 eix --only-names --pure-packages "$SEARCH/" | xargs echo | uniq);
|
||||||
|
do
|
||||||
|
echo "Building $i"
|
||||||
|
emerge ${EMERGE_DEFAULT_ARGS:---accept-properties=-interactive --verbose --oneshot --nospinner --noreplace --quiet-build=y --quiet-fail --fail-clean=y --complete-graph --buildpkg} $i
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
build_obsolete() {
|
||||||
|
build_sync
|
||||||
|
for i in $(EIX_LIMIT=0 eix-test-obsolete | grep '\[U\]' | awk '{ print $2 }' | xargs echo | uniq);
|
||||||
|
do
|
||||||
|
echo "Build $i"
|
||||||
|
emerge ${EMERGE_DEFAULT_ARGS:---accept-properties=-interactive -u --verbose --oneshot --nospinner --quiet-build=y --quiet-fail --fail-clean=y --complete-graph --buildpkg --noreplace} $i
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
build_category_installed() {
|
||||||
|
local SEARCH=$1
|
||||||
|
build_sync
|
||||||
|
for i in $(EIX_LIMIT=0 eix -I --only-names --pure-packages "$SEARCH/" | xargs echo | uniq);
|
||||||
|
do
|
||||||
|
echo "Building $i"
|
||||||
|
emerge ${EMERGE_DEFAULT_ARGS:---accept-properties=-interactive -u --newuse --noreplace --changed-use --update --verbose --oneshot --nospinner --quiet-build=y --quiet-fail --fail-clean=y --complete-graph --buildpkg} $i
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
build_all_availables() {
|
||||||
|
for i in $(cat /usr/portage/profiles/categories | xargs echo | uniq);
|
||||||
|
do
|
||||||
|
build_category "$i/"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
rebuild_all() {
|
||||||
|
for i in $(cat /usr/portage/profiles/categories | xargs echo | uniq);
|
||||||
|
do
|
||||||
|
build_category_installed "$i/"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
get_category() {
|
||||||
|
local CATEGORY=$1
|
||||||
|
local PACKS
|
||||||
|
for i in $(EIX_LIMIT=0 eix --only-names --pure-packages "$CATEGORY/" | xargs echo | uniq);
|
||||||
|
do
|
||||||
|
PACKS+="$i "
|
||||||
|
done
|
||||||
|
echo $PACKS
|
||||||
|
}
|
||||||
|
|
||||||
|
get_all_availables() {
|
||||||
|
local RES
|
||||||
|
for i in $(cat /usr/portage/profiles/categories | xargs echo | uniq);
|
||||||
|
do
|
||||||
|
RES+="$(get_category $i) "
|
||||||
|
done
|
||||||
|
echo $RES
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user