Skip to content

Instantly share code, notes, and snippets.

@alexAubin
Last active January 31, 2018 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexAubin/1040fc9caab250747036ccc7a3814d2b to your computer and use it in GitHub Desktop.
Save alexAubin/1040fc9caab250747036ccc7a3814d2b to your computer and use it in GitHub Desktop.
Draft of YunoHost script to upgrade to stretch
export DEBIAN_FRONTEND=noninteractive
export APT_LISTCHANGES_FRONTEND=none
###############################################################################
# Update current system
#apt-get update
#apt-get --assume-yes \
# --force-yes \
# dist-upgrade
###############################################################################
# Assertions here (probably not true in general case)
# - /etc/apt/sources.list.d/yunohost.list exists
# - no other files to be updated expcet /etc/apt/sources.list and
# /etc/apt/sources.list.d/yunohost.list
sed -i -e 's@jessie@stretch@g' \
-e 's@repo.yunohost@vinaigrette.yunohost@g' \
/etc/apt/sources.list
sed -i -e 's@jessie@stretch@g' \
-e 's@repo.yunohost@vinaigrette.yunohost@g' \
/etc/apt/sources.list.d/yunohost.list
###############################################################################
apt-get update
# Prepare for dist-upgrade
echo 'libc6 libraries/restart-without-asking boolean true' | debconf-set-selections
apt-mark hold moulinette
apt-mark hold ssowat
apt-mark hold yunohost
apt-mark hold yunohost-admin
apt-mark hold fail2ban
# Big dist-upgrade
systemctl stop mysql
apt-get --fix-broken \
--show-upgraded \
--assume-yes \
-o Dpkg::Options::="--force-confold" \
-o Dpkg::Options::="--force-confdef" \
dist-upgrade
systemctl start mysql
# Specific upgrade for fail2ban because it's causing trouble with existing
# conf (backward compatibility broken) ...
apt-mark unhold fail2ban
mv /etc/fail2ban /etc/fail2ban.old
apt-get --fix-broken \
--show-upgraded \
--assume-yes \
-o Dpkg::Options::="--force-confnew" \
-o Dpkg::Options::="--force-confmiss" \
-o Dpkg::Options::="--force-confdef" \
dist-upgrade
service fail2ban restart
# Upgrade YunoHost & co
apt-mark unhold moulinette
apt-mark unhold ssowat
apt-mark unhold yunohost
apt-mark unhold yunohost-admin
apt-get install -y yunohost yunohost-admin moulinette ssowat
yunohost service regen-conf fail2ban --debug --force
yunohost service regen-conf --debug --force # We need this to refresh some conf files modified by upstream packages, e.g. mysql. But this will erase some legit user changes... Gotta think about some UX here :/
# Clean the mess
apt autoremove --assume-yes
apt clean --assume-yes
# Setup a ynh-dev container with test stuff
yunohost tools postinstall -d yolo.test -p yunohost
yunohost user create johndoe -f John -l Doe -m johndoe@yolo.test -p yunohost --admin-password yunohost
yunohost app install wordpress -a "domain=yolo.test&path=/blog&admin=johndoe&language=en_US&multisite=0&is_public=1"
apt-get update
apt-get install -y --force-yes \
ssowat=2.7.2 \
yunohost=2.7.2 \
moulinette=2.7.2 \
yunohost-admin=2.7.2
# Make the damn etckeeper quiet
sed -i 's/GIT_COMMIT_OPTIONS=.*/GIT_COMMIT_OPTIONS="--quiet"/g' /etc/etckeeper/etckeeper.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment