dm-vdo/kvdo

Installation steps of kvdo on Debian 11(.3)

tigerblue77 opened this issue · 1 comments

Hello everyone,

I wrote this little script to install kvdo on Debian 11(.3) (tested with 5.10.0-13 Linux kernel)

DEPENDANCIES="git make linux-headers-$(uname -r)"
WORK_DIRECTORY="/tmp/kvdo/"

apt update && \
apt install -y $DEPENDANCIES && \
#git clone https://github.com/dm-vdo/kvdo.git $WORK_DIRECTORY && \
git clone https://github.com/tigerblue77/kvdo.git $WORK_DIRECTORY && \
cd $WORK_DIRECTORY && \
make -j $(nproc) -C /usr/src/linux-headers-`uname -r` M=`pwd` && \
cd - && \
cp ${WORK_DIRECTORY}vdo/kvdo.ko /lib/modules/$(uname -r) && \
cp ${WORK_DIRECTORY}uds/uds.ko /lib/modules/$(uname -r) && \
apt autoremove --purge -y $DEPENDANCIES && \
rm -Rf $WORK_DIRECTORY

depmod
#update-initramfs -u
#echo uds >>/etc/modules && \
#echo kvdo >> /etc/modules
modprobe kvdo
modprobe uds
  • Line 6 is commented while waiting for my pull request #52 to be merged
  • Can anyone tell me if lines 17-19 are needed ?
  • Is there a way to make the 13 and 14 lines run in parallel while keeping line 12 "&&" ? (solved in comments)
  • Don't hesitate to suggest any improvment !
  • Once improved, maybe we could add this script to repository's README.md ?
  • This script is part of my full kvdo + vdo installation script, don't hesitate to check the issue I opened on vdo's github repository

I wrote this script with help of those forum topics :

Script improved (thanks to this topic) :

install_dependencies() {
    (( ${#} > 1 )) && {
        apt update && \
        apt install -y "$@"
    } || echo "No dependency to install"
}

clean_dependencies() {
    (( ${#} > 1 )) && {
        apt autoremove --purge -y "$@"
    } || echo "No dependency to remove"
}

clone_repo() {
    (( ${#} == 1 )) && {
        TEMPDIR=$(mktemp -d "/tmp/${1/*\/}.XXX") && \
        git clone "$1" "${TEMPDIR}" && \
        cd "$TEMPDIR" && \
        pwd -P
    }
}

# Usage: clean $WORK_DIRECTORY $DEPENDENCIES
clean() {
    (( ${#} >= 1 )) && {
        clean_dependencies "${*:2}" > /dev/null 2>&1 &
        rm -Rf "$1" &
        wait
    }
}

# First part : KVDO module
DEPENDENCIES="git make linux-headers-$(uname -r)"
install_dependencies $DEPENDENCIES > /dev/null 2>&1
WORK_DIR="$(clone_repo https://github.com/tigerblue77/kvdo.git)"
(
    cd "${WORK_DIR}" && \
    make -j"$(nproc)" -C "/usr/src/linux-headers-$(uname -r)" M="${WORK_DIR}"
) > kvdo_build.log 2>&1

cp "${WORK_DIR}/vdo/kvdo.ko" "${WORK_DIR}/uds/uds.ko" "/lib/modules/$(uname -r)"
clean "${WORK_DIR}" $DEPENDENCIES

depmod --quick
#update-initramfs -u
#echo uds >>/etc/modules && \
#echo kvdo >> /etc/modules
modprobe kvdo
modprobe uds

It now :

  • creates kvdo_build.log file instead of writing full output to console.
  • runs lines 26 and 27 in parallel 26 and 27 run in parallel