|
@ -11,14 +11,57 @@ if [ -z "$BTRFS_DEVICE" ]; then |
|
|
exit 1 |
|
|
exit 1 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
apt-get install -y btrfs-tools |
|
|
|
|
|
|
|
|
|
|
|
if [ "$FORCE" != "yes" ]; then |
|
|
if [ "$FORCE" != "yes" ]; then |
|
|
echo "the following is dangerous code. Please execute with FORCE=yes." |
|
|
echo "the following is dangerous code. Please execute with FORCE=yes." |
|
|
echo "it DELETES directory /var/lib/docker if you have one." |
|
|
echo "it DELETES directory /var/lib/docker if you have one." |
|
|
exit 1 |
|
|
exit 1 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
## Install latest kernel |
|
|
|
|
|
if [ "$UPDATE_KERNEL" ]; then |
|
|
|
|
|
case "$UPDATE_KERNEL" in |
|
|
|
|
|
ovh) |
|
|
|
|
|
apt-get install -y lftp </dev/null |
|
|
|
|
|
( |
|
|
|
|
|
OVH_KERNELS_FTP=ftp://ftp.ovh.net/made-in-ovh/bzImage/${OVH_KERNEL_VERSION:-latest-experimental} |
|
|
|
|
|
OVH_KERNEL_REGEX='.*-xxxx-grs-ipv6-64$' |
|
|
|
|
|
lftp -e "lcd /boot/; mirror --only-newer -i '$OVH_KERNEL_REGEX'; bye" "$OVH_KERNELS_FTP" && |
|
|
|
|
|
cd /boot && update-grub |
|
|
|
|
|
) || exit 1 |
|
|
|
|
|
;; |
|
|
|
|
|
ubuntu) |
|
|
|
|
|
## check: http://askubuntu.com/a/257624/21888 |
|
|
|
|
|
#http://kernel.ubuntu.com/~kernel-ppa/mainline/ |
|
|
|
|
|
echo "ubuntu not supported yet" >&2 |
|
|
|
|
|
exit 1 |
|
|
|
|
|
;; |
|
|
|
|
|
*) |
|
|
|
|
|
echo "Unknown \$UPDATE_KERNEL method '$UPDATE_KERNEL'." >&2 |
|
|
|
|
|
exit 1 |
|
|
|
|
|
esac |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
if [ "$UPDATE_BTRFS_TOOLS" ]; then |
|
|
|
|
|
## Install latests ``btrfs-tools``: |
|
|
|
|
|
( |
|
|
|
|
|
apt-get remove -y btrfs-tools </dev/null || true |
|
|
|
|
|
mkdir /root/dev/c -p && |
|
|
|
|
|
cd /root/dev/c && |
|
|
|
|
|
git clone git://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git && |
|
|
|
|
|
cd btrfs-progs && |
|
|
|
|
|
apt-get install -y asciidoc xmlto --no-install-recommends </dev/null && |
|
|
|
|
|
apt-get install -y build-essential autoconf pkg-config uuid-dev libattr1-dev \ |
|
|
|
|
|
zlib1g-dev libacl1-dev e2fslibs-dev libblkid-dev liblzo2-dev </dev/null && |
|
|
|
|
|
./autogen.sh && |
|
|
|
|
|
./configure --prefix=/opt/apps/btrfs-tools && |
|
|
|
|
|
make && |
|
|
|
|
|
make install && |
|
|
|
|
|
ln -sf /opt/apps/btrfs-tools/bin/* /usr/local/bin/ |
|
|
|
|
|
) || exit 1 |
|
|
|
|
|
else |
|
|
|
|
|
apt-get install -y btrfs-tools </dev/null |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
## "$BTRFS_DEVICE" device should not be mounted |
|
|
## "$BTRFS_DEVICE" device should not be mounted |
|
|
if mount | egrep ^"$BTRFS_DEVICE\s+" >/dev/null 2>&1; then |
|
|
if mount | egrep ^"$BTRFS_DEVICE\s+" >/dev/null 2>&1; then |
|
|
umount "$BTRFS_DEVICE" || { |
|
|
umount "$BTRFS_DEVICE" || { |
|
|