#! /bin/sh #---------------------------------------------------------------------------- # /var/install/bin/convert-ext2-to-ext3 - convert ext2 filesystems # (called via boot!) # # Copyright (c) 2004 Frank Meyer # # Creation: 24.07.2004 fm # Last Update: $Id$ # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- kernel_version=`uname -r` tab=`/bin/echo -e '\011\c'` case "$kernel_version" in 2.4.*) ;; *) /usr/local/bin/colecho "kernel must be 2.4.x. Exit." br b br /bin/rm -f /tmp/convert-ext2-to-ext3.list exit 1 ;; esac if [ -f /tmp/convert-ext2-to-ext3.list ] then cd / /bin/mount -n -o remount,rw / for j in `cat /tmp/convert-ext2-to-ext3.list` do line=`/bin/grep "^$j[ $tab]" /etc/fstab` set -- $line fs_spec=$1 fs_file=$2 fs_vfstype=$3 fs_mntopts=$4 fs_freq=$5 fs_passno=$6 if [ "$fs_vfstype" = "ext2" ] then if tune2fs -j $fs_spec then /usr/bin/sed "s#\(^$fs_spec[ $tab].*[ $tab]\)ext2\([ $tab]\)#\\1ext3\\2#g" /etc/fstab.$$ /bin/cp /etc/fstab.$$ /etc/fstab # keep permissions /bin/rm -f /etc/fstab.$$ fi fi done /bin/rm -f /var/boot-ext/convert-ext2-to-ext3 /tmp/convert-ext2-to-ext3.list /bin/sync /bin/mount -n -o remount,ro / 2>/dev/null /bin/sync echo /usr/local/bin/colecho "ext3 conversion done, rebooting in 5 seconds ..." sleep 5 init 6 /usr/local/bin/colecho "Please ignore error messages ;-)" gn /bin/sleep 10000 fi exit 0