Skip to content

Instantly share code, notes, and snippets.

@bikerduweb
Created October 10, 2022 11:07
Show Gist options
  • Save bikerduweb/d249f49a60a6f29242b0fc834c756fb1 to your computer and use it in GitHub Desktop.
Save bikerduweb/d249f49a60a6f29242b0fc834c756fb1 to your computer and use it in GitHub Desktop.
Updated scaleway kernel modules / headers script for old VC1S instance

Theses scripts are extracted from a recent scaleway instance, and can be used to replace the very old scripts existing in /usr/local/sbin of a VC1S instance. It will allow you to change kernel in the scaleway client interface, and get the proper modules installed

#!/bin/sh
# description "synchronizes kernel headers"
# author "Scaleway <opensource@scaleway.com>"
set -e
DIR=/usr
mkdir -p $DIR
KVERSION=`uname -r`
MACHINE=`uname -m`
export PATH="${PATH:+$PATH:}/usr/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/sbin"
wget -q -O - http://mirror.scaleway.com/kernel/${MACHINE}/${KVERSION}/include.tar | tar -C ${DIR} -xf -
#!/bin/bash
# description "synchronizes kernel module"
# author "Scaleway <opensource@scaleway.com>"
set -e -o pipefail
DIR=/lib/modules
mkdir -p $DIR
TMP_DIR=`mktemp -d -p $DIR`
KVERSION=`uname -r`
KARCH=`uname -m`
TIMEOUT=10
export PATH="${PATH:+$PATH:}/usr/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/sbin"
clean() {
rm -rf "$TMP_DIR" 2>/dev/null
}
trap 'clean' INT TERM EXIT
if [ ! -d $DIR/${KVERSION} ]; then
curl -fsSL http://mirror.scaleway.com/kernel/${KARCH}/${KVERSION}/modules.tar | tar -C $TMP_DIR -x --strip-component 1
if [ $? -eq 0 ]; then
mkdir -p $DIR/${KVERSION}
mv $TMP_DIR/${KVERSION} $DIR
fi
fi
depmod -a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment