Skip to content

Instantly share code, notes, and snippets.

@naota
Created January 4, 2018 11:19
Show Gist options
  • Save naota/04d7d6bcf09c13cdfbe55dbf8e9cdf83 to your computer and use it in GitHub Desktop.
Save naota/04d7d6bcf09c13cdfbe55dbf8e9cdf83 to your computer and use it in GitHub Desktop.
#!/bin/bash
CPUQuota=300
CPUWeight=50
MemoryMax=
EMERGE=$HOME/bin/autoemerge
props=
if [ -n "${CPUQuota}" ]; then
props+="-p CPUQuota=${CPUQuota}% "
fi
if [ -n "${CPUQuota}" ]; then
props+="-p CPUWeight=${CPUWeight} "
fi
if [ -n "${MemoryMax}" ]; then
props+="-p MemoryMax=${MemoryMax} "
fi
if [ -z "$1" ]; then
sudo eix-sync || exit
fi
#pkgs=$(eix -u --selected --compact | egrep '^\[U' | peco | awk '{print $2}')
selected=$(mktemp)
allpkgs=$(mktemp)
export X='<category>/<name>:<slot>{!overlayname=}::<overlayname>{} <version>\t<description>\n'
EIX="eix -u --pure-packages --format <bestslotupgradeversions*:X>"
${EIX} --selected > ${selected}
${EIX} > ${allpkgs}
pkgs=$( ( cat ${selected}; echo =====;
cat ${selected} ${allpkgs} | sort | uniq -u) | peco | awk '{print $1}')
#pkgs=$(eix -u --compact | egrep '^\[U' | peco | awk '{print $2}')
[ -z "${pkgs}" ] && exit
echo Install ${pkgs}
echo ${pkgs} | tr ' ' '\n' > ~/.last-pkgs
sudo systemd-run --scope ${props} ${EMERGE} -1avt -j2 --keep-going ${pkgs}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment