summaryrefslogtreecommitdiffstats
path: root/rescue
diff options
context:
space:
mode:
Diffstat (limited to 'rescue')
-rw-r--r--rescue/.gitignore1
-rw-r--r--rescue/.perl_checker39
-rwxr-xr-xrescue/Flash/scripts/backup_systemloop106
-rwxr-xr-xrescue/Flash/scripts/clear_systemloop89
-rw-r--r--rescue/Flash/scripts/rescue_common194
-rwxr-xr-xrescue/Flash/scripts/reset_rootpass100
-rwxr-xr-xrescue/Flash/scripts/reset_userpass111
-rwxr-xr-xrescue/Flash/scripts/restore_systemloop167
-rwxr-xr-xrescue/Flash/scripts/test_badblocks69
-rwxr-xr-xrescue/Flash/scripts/upgrade250
-rwxr-xr-xrescue/Flash/scripts/upgrade.merge-users52
-rw-r--r--rescue/Makefile15
-rw-r--r--rescue/NEWS323
-rw-r--r--rescue/aliases11
-rwxr-xr-xrescue/bin/drvinst (renamed from rescue/drvinst)17
-rwxr-xr-xrescue/bin/guessmounts168
-rwxr-xr-xrescue/bin/install_bootloader (renamed from rescue/install_bootloader)9
-rwxr-xr-xrescue/bin/lsparts (renamed from rescue/lsparts)5
-rwxr-xr-xrescue/bin/rescue-doc (renamed from rescue/rescue-doc)17
-rwxr-xr-xrescue/bin/restore_ms_boot (renamed from rescue/restore_ms_boot)0
-rw-r--r--rescue/devices.pl55
-rw-r--r--rescue/dirs11
-rwxr-xr-xrescue/guessmounts97
-rw-r--r--rescue/list.xml371
-rwxr-xr-xrescue/make_flash_rescuebin2602 -> 2504 bytes
-rwxr-xr-xrescue/make_partimage_save_rest_all2
-rwxr-xr-xrescue/make_rescue_img38
-rwxr-xr-xrescue/sbin/partimage_whole_disk (renamed from rescue/partimage_whole_disk)0
-rwxr-xr-xrescue/tree/bin/insmod2
-rw-r--r--rescue/tree/etc/hostname1
-rw-r--r--rescue/tree/etc/hosts2
-rw-r--r--rescue/tree/etc/inittab14
-rw-r--r--rescue/tree/etc/issue4
-rw-r--r--rescue/tree/etc/passwd5
-rw-r--r--rescue/tree/etc/profile4
-rwxr-xr-xrescue/tree/etc/rc.reboot8
-rwxr-xr-xrescue/tree/etc/rc.sysinit78
-rwxr-xr-xrescue/tree/sbin/fakeshutdown39
-rwxr-xr-xrescue/tree/sbin/modprobe16
-rwxr-xr-xrescue/tree/usr/bin/login (renamed from rescue/tree/bin/login)0
-rwxr-xr-xrescue/tree/usr/bin/mageia-rescue42
-rw-r--r--rescue/tree/usr/lib/CVS.0
-rw-r--r--rescue/tree/usr/lib/modules-load.d/mageia-rescue.conf8
-rwxr-xr-xrescue/tree/usr/lib/restore-image-lib.sh80
-rw-r--r--rescue/tree/usr/lib/systemd/system/rescue.service20
-rw-r--r--rescue/tree/usr/lib/systemd/system/systemd-udevd.service.d/dracut-rules.conf1
-rwxr-xr-xrescue/tree/usr/sbin/diskdrake-resize29
-rwxr-xr-xrescue/tree/usr/sbin/genpasswd13
-rwxr-xr-xrescue/tree/usr/sbin/grabjournallogs51
-rwxr-xr-xrescue/tree/usr/sbin/restore-image.sh412
-rwxr-xr-xrescue/tree/usr/sbin/startssh27
-rw-r--r--rescue/tree/usr/share/symlinks10
52 files changed, 1512 insertions, 1671 deletions
diff --git a/rescue/.gitignore b/rescue/.gitignore
new file mode 100644
index 000000000..7b75a3e33
--- /dev/null
+++ b/rescue/.gitignore
@@ -0,0 +1 @@
+rescue.sqfs
diff --git a/rescue/.perl_checker b/rescue/.perl_checker
deleted file mode 100644
index 8ad989186..000000000
--- a/rescue/.perl_checker
+++ /dev/null
@@ -1,39 +0,0 @@
-bytes
-constant
-AutoLoader
-Carp::Heavy
-Compress::Zlib
-Config::IniFiles
-Convert::ASN1
-Cwd
-Date::Manip
-Digest::MD5
-Encode
-encoding
-feature
-File::Basename
-File::Find
-File::FnMatch
-File::GlobMapper
-File::Path
-File::Temp
-Gtk2::Gdk::Keysyms
-IO::Compress::Gzip
-IO::Handle
-IO::Socket::SSL
-IO::Socket::UNIX
-IO::Uncompress::Gunzip
-Net::DBus::Binding::Introspector
-Net::DBus::Binding::Iterator
-Net::DBus::Test::MockIterator
-Net::LDAP
-Net::LDAP::Constant
-Net::LDAP::Control
-Net::LDAP::Filter
-Net::LDAP::Schema
-Net::LDAP::Util
-Scalar::Util
-String::ShellQuote
-Term::ReadKey
-Text::ParseWords
-Time::ZoneInfo
diff --git a/rescue/Flash/scripts/backup_systemloop b/rescue/Flash/scripts/backup_systemloop
deleted file mode 100755
index 65c3185e6..000000000
--- a/rescue/Flash/scripts/backup_systemloop
+++ /dev/null
@@ -1,106 +0,0 @@
-#!/bin/bash
-
-# import functions library
-source rescue_common
-
-tmpdir="/tmp/flash-rescue-root"
-rootdir="$tmpdir/pen"
-
-function prepare() {
-
- mkdir -p $rootdir
-
- if ! mount_usbroot $rootdir; then
- return 1
- fi
-
- if [ x"$version" = x"1.0" ]; then
- mkdir -p $tmpdir/shared
- if ! mount_sharedroot $tmpdir/shared; then
- return 1
- fi
- fi
-
- if [ ! -d $dir ]; then
- mkdir $dir
- fi
-
- return 0
-}
-
-function doit() {
-
- clear
- echo
- echo -n 'Creating backup file. This can take some time: '
-
- bzip2 -c $loop > $target 2> /tmp/rescue-backup.err &
-
- sleep 2
-
- while ps | grep -q bzip2; do
- progress
- done
-
- sync
-
- echo
- echo
-
- errsize=$(ls -la /tmp/rescue-backup.err | cut -d' ' -f5)
- if [ $errsize -ne 0 ]; then
- echo "Error compressing user files into $target"
- return 1
- else
- echo 'Backup file created!'
- fi
-
- echo
-
- return 0
-}
-
-function cleanup() {
-
- if [ x"$version" = x"1.0" ]; then
- umount $tmpdir/shared > /dev/null 2>&1
- rmdir $tmpdir/shared
- fi
-
- umount $rootdir > /dev/null 2>&1
- rmdir $rootdir $tmpdir 2> /dev/null
-
- return 0
-}
-
-clear
-trap cleanup SIGINT
-
-version=""
-if ! insert_pendrive; then
- exit 1
-fi
-
-if [ x"$version" = x"1.0" ]; then
- dir="$tmpdir/shared/backup"
- loop="$rootdir/loopbacks/system.loop"
-else
- dir="$rootdir/backup"
- loop="$rootdir/.loopbacks/system.loop"
-fi
-
-file="backup-$(date +%Y%m%d).bz2"
-target="$dir/$file"
-
-if ! prepare; then
- cleanup
- exit 1
-fi
-
-if ! doit; then
- cleanup
- exit 1
-fi
-
-cleanup
-exit 0
diff --git a/rescue/Flash/scripts/clear_systemloop b/rescue/Flash/scripts/clear_systemloop
deleted file mode 100755
index 6d7015c84..000000000
--- a/rescue/Flash/scripts/clear_systemloop
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/bin/bash
-
-# import functions library
-source rescue_common
-
-tmpdir="/tmp/flash-rescue-root"
-rootdir="$tmpdir/pen"
-
-function prepare() {
-
- mkdir -p $rootdir
-
- if ! mount_usbroot $rootdir; then
- return 1
- fi
-
- return 0
-}
-
-function doit() {
-
- clear
- echo
- echo "WARNING!"
- echo
- echo "Mandriva Flash will be reseted to factory defaults!"
- echo -n "All user files, customizations and new packages installed "
- echo "will be removed."
- echo
- echo "This process may take a few minutes."
- echo
- echo -n "Do you want to continue? [N/y] "
- read confirm
-
- if [ x"$confirm" = x"y" -o x"$confirm" = x"Y" ]; then
-
- if [ ! -f $loop ] || [ x"$version" != x"1.0" ]; then
- dd if=/dev/zero of=$loop bs=4000000 count=100
- fi
-
- if [ x"$version" = x"1.0" ]; then
- /sbin/mkfs.ext2 -q -F $loop
- fi
-
- echo
- if [ $? -ne 0 ]; then
- echo 'Error reseting device to factory defaults'
- return 1
- else
- echo 'Mandriva Flash was restored to factory defaults!'
- fi
- fi
-
- echo
-
- return 0
-}
-
-function cleanup() {
-
- umount $rootdir > /dev/null 2>&1
- rmdir $rootdir $tmpdir 2> /dev/null
-}
-
-clear
-trap cleanup SIGINT
-
-version=""
-if ! insert_pendrive; then
- exit 1
-fi
-
-if [ x"$version" = x"1.0" ]; then
- loop="$rootdir/loopbacks/system.loop"
-else
- loop="$rootdir/.loopbacks/system.loop"
-fi
-
-if ! prepare; then
- cleanup
- exit 1
-fi
-
-if ! doit; then
- cleanup
- exit 1
-fi
-
-cleanup
diff --git a/rescue/Flash/scripts/rescue_common b/rescue/Flash/scripts/rescue_common
deleted file mode 100644
index e1402cacc..000000000
--- a/rescue/Flash/scripts/rescue_common
+++ /dev/null
@@ -1,194 +0,0 @@
-#!/bin/bash
-
-function detect_version() {
- version=""
- if has_label Share; then
- version="1.0"
- elif has_label MDVUSBROOT; then
- version="1.05"
- elif has_label Mdv_Flash; then
- version="2.0"
- elif has_label MDV_FLASH; then
- version="2.05"
- fi
- usbroot_device=$_device
- source_version_variables
-
- [ -n "$version" ]
-}
-
-function source_version_variables {
- local _version
- _version=$1
- [ -z "$_version" ] && _version=$version
- if [ "$_version" = "1.0" ]; then
- label=MDVUSBROOT
- boot_rel="/boot"
- loopbacks_rel="/loopbacks"
- elif [ "$_version" = "1.05" ]; then
- label=MDVUSBROOT
- boot_rel="/.boot"
- loopbacks_rel="/.loopbacks"
- elif [ "$_version" = "2.0" ]; then
- label=Mdv_Flash
- boot_rel="/.boot"
- loopbacks_rel="/.loopbacks"
- elif [ "$_version" = "2.05" ]; then
- label=MDV_FLASH
- boot_rel="/.boot"
- loopbacks_rel="/.loopbacks"
- fi
-}
-
-function has_label() {
- local _label _tmpdir
- _label=$1
-
- _tmpdir="/tmp/$$"
-
- mkdir -p $_tmpdir
-
- nash --force > /dev/null 2>&1 <<EOF
-mount -t vfat LABEL=$_label $_tmpdir
-EOF
-
- rc=$?
-
- _device=`perl -ne 'my @l = split; $l[1] eq "'$_tmpdir'" and print "$l[0]\n"' /proc/mounts`
- [ -z "$_device" ] && rc=1
-
- umount $_tmpdir 2> /dev/null
- rmdir $_tmpdir 2> /dev/null
-
- return $rc
-}
-
-function check_vendor() {
-
- # list of supported vendors/models
-
- # mandriva flash 1.0 (france)
- vendors[0]="13fe"
- models[0]="1a00"
- # mandriva flash 1.0 (brazil)
- vendors[1]="0930"
- models[1]="653e"
- # mandriva flash 4GB (france)
- vendors[2]="13fe"
- models[2]="1d00"
-
- rc=1
-
- mount -t usbfs none /proc/bus/usb 2> /dev/null
-
- i=0
- while [ ! -z "${vendors[$i]}" ]; do
-
- grep "P:" /proc/bus/usb/devices | grep -q \
- "Vendor=${vendors[$i]} ProdID=${models[$i]}"
- if [ $? -eq 0 ]; then
- rc=0
- break
- fi
-
- let i++
- done
-
- umount /proc/bus/usb 2> /dev/null
-
- return $rc
-}
-
-function insert_pendrive() {
-
- _tmpdir="/tmp/rescue-temp"
- mkdir -p $_tmpdir
-
- modprobe usb-storage > /dev/null 2>&1
- modprobe vfat > /dev/null 2>&1
-
- echo
- echo -n 'Please insert your Mandriva Flash pen drive and press ENTER when ready: '
- read READY
- echo
- echo -n 'Detecting pen drive: '
-
- for ((i=0; $i <= 15 ; i++)); do
- detect_version && nash --force > /dev/null 2>&1 <<EOF
-mount -t vfat LABEL=$label $_tmpdir
-EOF
- if [ $? -ne 0 ]; then
- echo -n '.'
- sleep 1
- else
- echo -n ' found!'
-
- if ! check_vendor; then
- echo
- echo "This is not an official Mandriva Flash key!"
- echo
- fi
-
- cat /proc/mounts | grep $_tmpdir | cut -d' ' -f1 | \
- sed 's/[0-9]*$//g' > /tmp/rescue-device
- umount $_tmpdir
- rmdir $_tmpdir 2> /dev/null
-
- return 0
- fi
- done
-
- rmdir $_tmpdir 2> /dev/null
-
- echo
- echo
- echo "Couldn't detect Mandriva Flash pen drive!"
- echo
-
- return 1
-}
-
-function mount_usbroot() {
-
- nash --force > /dev/null 2>&1 <<EOF
-mount -t vfat LABEL=$label $1
-EOF
- if [ $? -ne 0 ]; then
- echo "Error mounting device labeled $label"
- return 1
- fi
-
- return 0
-}
-
-function mount_sharedroot() {
-
- nash --force > /dev/null 2>&1 <<EOF
-mount -t vfat LABEL=Share $1
-EOF
- if [ $? -ne 0 ]; then
- echo "Error mounting device labeled Share"
- return 1
- fi
-
- return 0
-}
-
-function progress() {
-
- echo -ne '\b|'
- usleep 100000
- echo -ne '\b/'
- usleep 100000
- echo -ne '\b-'
- usleep 100000
- echo -ne '\b\\'
- usleep 100000
-}
-
-function lumount() {
- local dir=$1
- loop=$(perl -ne '@l = split; if ($l[1] eq "'$dir'") { print $l[0]; exit }' /proc/mounts)
- umount $dir
- losetup -d $loop
-}
diff --git a/rescue/Flash/scripts/reset_rootpass b/rescue/Flash/scripts/reset_rootpass
deleted file mode 100755
index 63b4e8b3a..000000000
--- a/rescue/Flash/scripts/reset_rootpass
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/bin/bash
-
-# import functions library
-source rescue_common
-
-tmpdir="/tmp/flash-rescue-root"
-rootdir="$tmpdir/pen"
-
-function prepare() {
-
- modprobe unionfs > /dev/null 2>&1
- modprobe squashfs > /dev/null 2>&1
- modprobe loop > /dev/null 2>&1
-
- mkdir -p $rootdir
- mkdir -p $tmpdir/squash
- mkdir -p $tmpdir/user
- mkdir -p $tmpdir/union
-
- if ! mount_usbroot $rootdir; then
- return 1
- fi
-
- mount -t squashfs -o loop $sfs_loop $tmpdir/squash > /dev/null 2>&1
- if [ $? -ne 0 ]; then
- echo "Error mounting distrib.sqfs"
- return 1
- fi
-
- mount -t ext2 -o loop $sys_loop $tmpdir/user > /dev/null 2>&1
- if [ $? -ne 0 ]; then
- echo "Error mounting system.loop"
- return 1
- fi
-
- mount -t unionfs -o dirs=$tmpdir/user=rw:$tmpdir/squash=ro \
- none $tmpdir/union
- if [ $? -ne 0 ]; then
- echo "Error creating union of distrib.sqfs and system.loop"
- return 1
- fi
-
- chroot $tmpdir/union /etc/init.d/keytable start &> /dev/null
- chroot $tmpdir/union /usr/bin/unicode_start
-
- return 0
-}
-
-function doit() {
-
- clear
- echo
- chroot $tmpdir/union passwd root
- echo
- echo
-
- return 0
-}
-
-function cleanup() {
-
- chroot $tmpdir/union /usr/bin/unicode_stop
-
- umount $tmpdir/union > /dev/null 2>&1
- lumount $tmpdir/user > /dev/null 2>&1
- lumount $tmpdir/squash > /dev/null 2>&1
- umount $rootdir > /dev/null 2>&1
-
- rmdir $tmpdir/union $tmpdir/user $tmpdir/squash 2> /dev/null
- rmdir $rootdir $tmpdir 2> /dev/null
-}
-
-clear
-trap cleanup SIGINT
-
-version=""
-if ! insert_pendrive; then
- exit 1
-fi
-
-if [ x"$version" = x"1.0" ]; then
- sys_loop="$rootdir/loopbacks/system.loop"
- sfs_loop="$rootdir/loopbacks/distrib.sqfs"
-else
- sys_loop="$rootdir/.loopbacks/system.loop"
- sfs_loop="$rootdir/.loopbacks/distrib.sqfs"
-fi
-
-if ! prepare; then
- cleanup
- exit 1
-fi
-
-if ! doit; then
- cleanup
- exit 1
-fi
-
-cleanup
-exit 0
diff --git a/rescue/Flash/scripts/reset_userpass b/rescue/Flash/scripts/reset_userpass
deleted file mode 100755
index 320457cdc..000000000
--- a/rescue/Flash/scripts/reset_userpass
+++ /dev/null
@@ -1,111 +0,0 @@
-#!/bin/bash
-
-# import functions library
-source rescue_common
-
-tmpdir="/tmp/flash-rescue-root"
-rootdir="$tmpdir/pen"
-
-function prepare() {
-
- modprobe unionfs > /dev/null 2>&1
- modprobe squashfs > /dev/null 2>&1
- modprobe loop > /dev/null 2>&1
-
- mkdir -p $rootdir
- mkdir -p $tmpdir/squash
- mkdir -p $tmpdir/user
- mkdir -p $tmpdir/union
-
- if ! mount_usbroot $rootdir; then
- return 1
- fi
-
- mount -t squashfs -o loop $sfs_loop $tmpdir/squash > /dev/null 2>&1
- if [ $? -ne 0 ]; then
- echo "Error mounting distrib.sqfs"
- return 1
- fi
-
- mount -t ext2 -o loop $sys_loop $tmpdir/user > /dev/null 2>&1
- if [ $? -ne 0 ]; then
- echo "Error mounting system.loop"
- return 1
- fi
-
- mount -t unionfs -o dirs=$tmpdir/user=rw:$tmpdir/squash=ro \
- none $tmpdir/union > /dev/null 2>&1
- if [ $? -ne 0 ]; then
- echo "Error creating union of distrib.sqfs and system.loop"
- return 1
- fi
-
- chroot $tmpdir/union /etc/init.d/keytable start &> /dev/null
- chroot $tmpdir/union /usr/bin/unicode_start
-
- return 0
-}
-
-function doit() {
-
- username=$(tail -1 $tmpdir/union/etc/passwd | cut -d ':' -f1)
-
- clear
- echo
- echo -n "What is your username? [$username] "
- read name
-
- if [ -z "$name" ]; then
- name="$username"
- fi
-
- echo
- echo
- chroot $tmpdir/union passwd $name
- echo
- echo
-
- return 0
-}
-
-function cleanup() {
-
- chroot $tmpdir/union /usr/bin/unicode_stop
-
- umount $tmpdir/union > /dev/null 2>&1
- lumount $tmpdir/user > /dev/null 2>&1
- lumount $tmpdir/squash > /dev/null 2>&1
- umount $rootdir > /dev/null 2>&1
-
- rmdir $tmpdir/union $tmpdir/user $tmpdir/squash 2> /dev/null
- rmdir $rootdir $tmpdir 2> /dev/null
-}
-
-clear
-trap cleanup SIGINT
-
-version=""
-if ! insert_pendrive; then
- exit 1
-fi
-
-if [ x"$version" = x"1.0" ]; then
- sys_loop="$rootdir/loopbacks/system.loop"
- sfs_loop="$rootdir/loopbacks/distrib.sqfs"
-else
- sys_loop="$rootdir/.loopbacks/system.loop"
- sfs_loop="$rootdir/.loopbacks/distrib.sqfs"
-fi
-
-if ! prepare; then
- cleanup
- exit 1
-fi
-
-if ! doit; then
- cleanup
- exit 1
-fi
-
-cleanup
-exit 0
diff --git a/rescue/Flash/scripts/restore_systemloop b/rescue/Flash/scripts/restore_systemloop
deleted file mode 100755
index 39c56e030..000000000
--- a/rescue/Flash/scripts/restore_systemloop
+++ /dev/null
@@ -1,167 +0,0 @@
-#!/bin/bash
-
-# import functions library
-source rescue_common
-
-tmpdir="/tmp/flash-rescue-root"
-rootdir="$tmpdir/pen"
-
-function prepare() {
-
- mkdir -p $rootdir
-
- if ! mount_usbroot $rootdir; then
- return 1
- fi
-
- if [ x"$version" = x"1.0" ]; then
- mkdir -p $tmpdir/shared
- if ! mount_sharedroot $tmpdir/shared; then
- return 1
- fi
- fi
-
- return 0
-}
-
-function doit() {
-
- if [ ! -d $dir ]; then
- echo
- echo "Can't find a backup directory in the Share partition"
- echo
- return 0
- fi
-
- cd $dir
- i=1
- for file in $(ls -c1 backup-*.bz2 2> /dev/null | sort -r | head -10); do
- files[$i]="$file"
- let i++
- done
- cd - > /dev/null
-
- if [ $i -eq 1 ]; then
- echo
- echo 'No backup files found!'
- echo
- return 0
- fi
-
- while [ true ]; do
-
- clear
- echo
- echo "The following backup files were found:"
- echo
-
- i=1
- while [ -n "${files[$i]}" ]; do
- echo "[$i] ${files[$i]}"
- let i++
- done
- let i--
- echo
- echo '[0] Cancel / Return to main menu'
-
- echo
- echo 'Select from the list above, the file that you want to restore.'
- echo 'The most recent files come first in the list.'
- echo
- echo -n "What backup file do you want to restore? [1] "
- read option
-
- if [ -z "$option" ]; then
- option=1
- fi
- if [ x"$option" = x"0" ]; then
- return 0
- fi
-
- if [ ! -f $dir/${files[$option]} ]; then
- echo
- echo "Error reading backup file ${files[$option]}!"
- echo
- echo -n 'Do you want to restore another backup file? [N/y] '
- read confirm
-
- if [ x"$confirm" = x"y" -o x"$confirm" = x"Y" ]; then
- continue
- else
- return 0
- fi
- else
-
- echo
- echo -n 'Restoring backup file. This can take some time: '
-
- bunzip2 -c $dir/${files[$option]} > $loop \
- 2> /tmp/rescue-backup.err &
-
- sleep 2
-
- while ps | grep -q bunzip2; do
- progress
- done
-
- sync
- echo
- echo
-
- errsize=$(ls -la /tmp/rescue-backup.err | cut -d' ' -f5)
- if [ $errsize -ne 0 ]; then
- echo 'Error restoring user files!'
- echo
- return 1
- else
- echo 'Backup file restored!'
- echo
- break
- fi
- fi
- done
-
- return 0
-}
-
-function cleanup() {
-
- if [ x"$version" = x"1.0" ]; then
- umount $tmpdir/shared > /dev/null 2>&1
- rmdir $tmpdir/shared 2> /dev/null
- fi
-
- umount $rootdir > /dev/null 2>&1
- rmdir $rootdir $tmpdir 2> /dev/null
-
- return 0
-}
-
-clear
-trap cleanup SIGINT
-
-version=""
-if ! insert_pendrive; then
- exit 1
-fi
-
-if [ x"$version" = x"1.0" ]; then
- dir="$tmpdir/shared/backup"
- loop="$rootdir/loopbacks/system.loop"
-else
- dir="$rootdir/backup"
- loop="$rootdir/.loopbacks/system.loop"
-fi
-
-if ! prepare; then
- cleanup
- exit 1
-fi
-
-if ! doit; then
- cleanup
- exit 1
-fi
-
-cleanup
-exit 0
diff --git a/rescue/Flash/scripts/test_badblocks b/rescue/Flash/scripts/test_badblocks
deleted file mode 100755
index 3fb1f34d8..000000000
--- a/rescue/Flash/scripts/test_badblocks
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/bin/bash
-
-# import functions library
-source rescue_common
-
-tmpdir="/tmp/flash-rescue-root"
-rootdir="$tmpdir/pen"
-
-function prepare() {
-
- return 0
-}
-
-function doit() {
-
- clear
- echo
- echo "WARNING!"
- echo
- echo "Searching for bad blocks in Mandriva Flash is a slow process."
- echo
- echo -n "Do you want to continue? [N/y] "
- read confirm
-
- echo
- echo
-
- device=$(cat /tmp/rescue-device)
-
- if [ x"$confirm" = x"y" -o x"$confirm" = x"Y" ]; then
-
- /sbin/badblocks -n -v -s ${device}1
- if [ x"$version" = x"1.0" ]; then
- /sbin/badblocks -n -v -s ${device}2
- fi
- fi
-
- echo
- echo 'Bad blocks scan completed!'
- echo
-
- return 0
-}
-
-function cleanup() {
-
- umount $rootdir > /dev/null 2>&1
- rmdir $rootdir $tmpdir 2> /dev/null
-}
-
-clear
-trap cleanup SIGINT
-
-version=""
-if ! insert_pendrive; then
- exit 1
-fi
-
-if ! prepare; then
- cleanup
- exit 1
-fi
-
-if ! doit; then
- cleanup
- exit 1
-fi
-
-cleanup
diff --git a/rescue/Flash/scripts/upgrade b/rescue/Flash/scripts/upgrade
deleted file mode 100755
index 9d5dba227..000000000
--- a/rescue/Flash/scripts/upgrade
+++ /dev/null
@@ -1,250 +0,0 @@
-#!/bin/bash
-
-# import functions library
-source rescue_common
-
-tmpdir="/tmp/flash-rescue-root"
-rootdir="$tmpdir/pen"
-
-media_dir="/tmp/media"
-upgrade_dir="$media_dir/upgrade"
-
-
-config_files_network_scripts="etc/sysconfig/network-scripts/ifcfg-* \
- etc/sysconfig/network-scripts/cellular.d \
- etc/sysconfig/network-scripts/vpn.d \
- etc/sysconfig/network-scripts/wireless.d"
-
-config_files_users="etc/passwd etc/shadow etc/group etc/gshadow"
-config_files_time="etc/localtime etc/ntp etc/ntp.conf"
-config_files="etc/sysconfig/* $config_files_users $config_files_time \
- etc/wpa_supplicant.conf etc/shorewall etc/kde \
- etc/udev/rules.d/61-*_config.rules"
-
-config_files_to_remove="etc/sysconfig/harddrake2"
-
-function prepare() {
-
- echo "Mounting Mandriva Flash key..."
- echo
-
- modprobe unionfs > /dev/null 2>&1
- modprobe squashfs > /dev/null 2>&1
- modprobe loop > /dev/null 2>&1
-
- mkdir -p $rootdir
- mkdir -p $tmpdir/squash
- mkdir -p $tmpdir/user
- mkdir -p $tmpdir/union
-
- if ! mount_usbroot $rootdir; then
- return 1
- fi
-
- mount -t ext2 -o loop $sys_loop $tmpdir/user > /dev/null 2>&1
- if [ $? -ne 0 ]; then
- echo "Error mounting system.loop"
- return 1
- fi
-
- return 0
-}
-
-function get_existing_rpms() {
-
- echo "Getting list of installed packages..."
- echo
-
- mount -t squashfs -o loop $sfs_loop $tmpdir/squash > /dev/null 2>&1
- if [ $? -ne 0 ]; then
- echo "Error mounting distrib.sqfs"
- return 1
- fi
-
- mount -t unionfs -o dirs=$tmpdir/user=rw:$tmpdir/squash=ro \
- none $tmpdir/union
- if [ $? -ne 0 ]; then
- echo "Error creating union of distrib.sqfs and system.loop"
- return 1
- fi
-
- chroot $tmpdir/squash rpm -qa | sort > /tmp/previous_rpms.list
- if [ $? -ne 0 ]; then
- echo "Error getting list of vanilla rpms installed on previous key"
- fi
-
- chroot $tmpdir/union rpm -qa | sort > /tmp/existing_rpms.list
- if [ $? -ne 0 ]; then
- echo "Error getting list of rpms installed prior to upgrade"
- fi
-
- umount $tmpdir/union > /dev/null 2>&1
- lumount $tmpdir/squash > /dev/null 2>&1
-
- mkdir -p $tmpdir/user/root
- diff /tmp/previous_rpms.list /tmp/existing_rpms.list | sed -n 's/^> //p' > $tmpdir/user/root/new_existing_rpms.list
-
- return 0
-}
-
-function move_files() {
- for i in $*; do
- if [ -e $i ]; then
- dir=`dirname $i`
- [ "$dir" = "." ] || mkdir -p ..keep/$dir
- mv $i ..keep/$dir || { echo "Error moving $i"; return 1; }
- fi
- done
-
- return 0
-}
-
-function remove_non_user_nor_config_files() {
-
- echo "Filtering system configuration files and user accounts..."
- echo
-
- cd $tmpdir/user
-
- rm -rf $config_files_to_remove
-
- if [ -e ..keep ]; then
- mv ..keep ..keep.bak
- fi
- if [ -e ..keep ]; then
- echo "remove_non_user_nor_config_files can't work with existing temp dir"
- return 1
- fi
-
- mkdir ..keep
-
- move_files $config_files_network_scripts || return 1
- rm -rf etc/sysconfig/network-scripts
-
- move_files home root $config_files || return 1
- rm -rf *
- rm -rf .[^.]*
-
- mv ..keep/* .
- rmdir ..keep
-
- cd - > /dev/null
-
- return 0
-}
-
-function copy_new_version() {
-
- echo "Copying new Mandriva Flash system..."
-
- rm -rf $rootdir$boot_rel
- rm -f $rootdir$loopbacks_rel/.*sqf
- rm -f $rootdir$loopbacks_rel/.*sqfs
- [ -d "$modules_dir" ] && rm -rf $modules_dir
-
- tar c -C $upgrade_dir . | pv -s `du -sb $upgrade_dir | cut -f 1` | tar x -C $rootdir
- echo
-
- chmod -R u+w $rootdir
- chmod -R u-w $rootdir$boot_rel $rootdir$loopbacks_rel
-
- new_label=$(source_version_variables "2.0"; echo $label)
- MTOOLS_SKIP_CHECK=1 mlabel -i $usbroot_device ::$new_label
-
- return 0
-}
-
-function merge_config_files() {
-
- echo "Merging user and group accounts in new system..."
- echo
-
- mount -t squashfs -o loop $sfs_loop $tmpdir/squash > /dev/null 2>&1
- if [ $? -ne 0 ]; then
- echo "Error mounting distrib.sqfs"
- return 1
- fi
-
- upgrade.merge-users $tmpdir/user/etc $tmpdir/squash/etc
-
- mount -t unionfs -o dirs=$tmpdir/user=rw:$tmpdir/squash=ro \
- none $tmpdir/union
- if [ $? -ne 0 ]; then
- echo "Error creating union of distrib.sqfs and system.loop"
- return 1
- fi
-
- #- reapply lang configuration, mostly to rewrite kdeglobals
- chroot $tmpdir/union perl -I/usr/lib/libDrakX -Mlang -e "lang::write(lang::read())" &>/dev/null
-
- #- remove KDE sessions file so that previous compiz usage does not break session
- rm -f $tmpdir/union/home/*/.kde/share/config/ksmserverrc &>/dev/null
-
- #- remove KDE autostart files that should have been migrated by startkde...
- rm -f $tmpdir/union/home/*/.kde/Autostart/{alignment-icons,openkmenu}.desktop &>/dev/null
-
- return 0
-}
-
-function doit() {
-
- if [ -d $tmpdir/user/var/lib/rpm/Packages ]; then
- get_existing_rpms || return 1
- fi
-
- remove_non_user_nor_config_files || return 1
-
- copy_new_version || return 1
-
- merge_config_files || return 1
-
- return 0
-}
-
-function cleanup() {
- cd /
-
- umount $tmpdir/union > /dev/null 2>&1
- lumount $tmpdir/user > /dev/null 2>&1
- lumount $tmpdir/squash > /dev/null 2>&1
- umount $rootdir > /dev/null 2>&1
-
- rmdir $tmpdir/union $tmpdir/user $tmpdir/squash 2> /dev/null
- rmdir $rootdir $tmpdir 2> /dev/null
-}
-
-clear
-trap cleanup SIGINT
-
-version=""
-if ! insert_pendrive; then
- exit 1
-fi
-
-#- works only when upgrading versions with the same layout
-sys_loop="$rootdir$loopbacks_rel/system.loop"
-sfs_loop="$rootdir$loopbacks_rel/distrib.sqfs"
-
-modules_dir="$rootdir$loopbacks_rel/modules"
-
-echo
-
-if ! prepare; then
- cleanup
- exit 1
-fi
-
-if ! doit; then
- cleanup
- exit 1
-fi
-
-echo "Please wait, finishing copy to key..."
-echo
-
-cleanup
-
-echo "Congratulations! Your Mandriva Flash system is now upgraded."
-echo
-
-exit 0
diff --git a/rescue/Flash/scripts/upgrade.merge-users b/rescue/Flash/scripts/upgrade.merge-users
deleted file mode 100755
index 297960e91..000000000
--- a/rescue/Flash/scripts/upgrade.merge-users
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/perl
-
-use MDK::Common;
-
-@ARGV == 2 or die "merge_users <existing files dir> <new files dir>\n";
-
-my ($existing_dir, $new_dir) = @ARGV;
-
-merge('passwd', 'shadow');
-merge('group', 'gshadow');
-
-sub merge {
- my ($main, $shadow) = @_;
-
- my @new = cat_("$new_dir/$main");
- my %new_ids = map { (split ':')[2] => $_ } @new;
-
- my %names_to_have;
- foreach (cat_("$existing_dir/$main")) {
- my @l = split ':';
- next if $l[0] eq 'nobody' || $l[2] < 500;
- if (my $e = $new_ids{$l[2]}) {
- $_ eq $e or warn "ERROR: conflicting entries:\n $_ $e";
- } else {
- push @new, $_;
- $names_to_have{$l[0]} = 1;
- }
- }
-
- my @new_shadow = grep { !/^root:/ } cat_("$new_dir/$shadow");
- foreach (cat_("$existing_dir/$shadow")) {
- my ($name) = split ':';
- if ($name eq 'root') {
- unshift @new_shadow, $_;
- } elsif ($names_to_have{$name}) {
- push @new_shadow, $_;
- }
- }
-
- if (rename "$existing_dir/$main", "$existing_dir/$main.old") {
- output("$existing_dir/$main", @new);
- } else {
- warn "rename $existing_dir/$main failed: $?\n";
- <STDIN>;
- }
- if (rename "$existing_dir/$shadow", "$existing_dir/$shadow.old") {
- output("$existing_dir/$shadow", @new_shadow);
- } else {
- warn "rename $existing_dir/$shadow failed: $?\n";
- <STDIN>;
- }
-}
diff --git a/rescue/Makefile b/rescue/Makefile
index c2dfe17d9..b9462add0 100644
--- a/rescue/Makefile
+++ b/rescue/Makefile
@@ -1,6 +1,6 @@
include ../Makefile.config
-VERSION=1.10
+VERSION=1.68
PRODUCT=drakx-installer-rescue
RESCUE = rescue.sqfs
@@ -10,17 +10,16 @@ all: $(RESCUE)
install: $(RESCUE)
cp -f $< $(STAGE2_DEST)
-$(RESCUE): list.xml drvinst guessmounts lsparts rescue-doc make_rescue_img
+$(RESCUE): $(wildcard tree/**/*) $(wildcard bin/*) $(wildcard sbin/*) make_rescue_img list.xml aliases
+ if [[ -n "$$DEBUG_INSTALL_LANG" ]]; then perl -pi -e '$$_ = "loadkeys '$$DEBUG_INSTALL_LANG'\n$$_" if /LANGUAGE/' tree/usr/bin/mageia-rescue; fi
DISTRIB_DESCR=$(DISTRIB_DESCR) ./make_rescue_img
+dist: tar
+
tar:
rm -rf $(PRODUCT)*.tar* $(PRODUCT)-$(VERSION)
- mkdir -p $(PRODUCT)-$(VERSION)/tools
- svn export -q -rBASE . $(PRODUCT)-$(VERSION)/rescue
- cp ../Makefile.config $(PRODUCT)-$(VERSION)/
- cp ../tools/install-xml-file-list $(PRODUCT)-$(VERSION)/tools
- tar cfj $(PRODUCT)-$(VERSION).tar.bz2 $(PRODUCT)-$(VERSION)
- rm -rf $(PRODUCT)-$(VERSION)
+ @cd ..; git archive --prefix=$(PRODUCT)-$(VERSION)/ $(PRODUCT)-$(VERSION) rescue tools/install-xml-file-list Makefile.config | xz >$(PRODUCT)-$(VERSION).tar.xz;
+ $(info $(PRODUCT)-$(VERSION).tar.xz is ready)
clean:
rm -f $(RESCUE) kernel_read_part
diff --git a/rescue/NEWS b/rescue/NEWS
index 32d3b014e..dafe7c222 100644
--- a/rescue/NEWS
+++ b/rescue/NEWS
@@ -1,3 +1,326 @@
+Version 1.68 - 18 October 2025 by Jani Välimaa
+- replace i586 with i686 in files
+- fix and sort nedeed systemd files
+ - add systemd-executor
+ - remove systemd-cgroups-agent
+
+Version 1.67 - 28 April 2023 by Martin Whitaker
+
+- mount efivars in chroot on UEFI systems (mga#31844)
+
+Version 1.66 - 11 November 2020 by Thierry Vignaud
+
+- include overload.pm for File::Temp
+
+Version 1.65 - 16 June 2020 by Thierry Vignaud
+
+- fix running loadkeys w/o arg if DEBUG_INSTALL_LANG is not set (mga#26782)
+
+Version 1.64 - 20 March 2020 by Thierry Vignaud
+
+- debug mode:
+ o preset keyboard if DEBUG_INSTALL_LANG is set during build
+- do not preload all fs modules uselessly
+- guessmount:
+ o enable to repair encrypted LVMs/LUKS (mga#22795)
+ o fix displaying the version of the distro
+ o just use the fs reported by blkid instead of doing brute force guessing
+
+Version 1.63 - 19 March 2020 by Thierry Vignaud
+
+- add more tools for XFS & btrfs
+- include all of /usr/lib/udev/hwdb.d (mga#20327)
+- include F2FS tools
+- include missing LVM tools symlinks (mga#25466)
+- include ntfs3g compression support plugin
+- include Encode::Unicode module for reFind
+
+Version 1.62 - 18 June 2019 by Thomas Backlund
+
+- start udevd to support lvm2 (mga#24878)
+
+Version 1.61 - 11 May 2019 by Thomas Backlund
+
+- update filelist for new systemd
+
+Version 1.60 - 22 November 2018 by Thierry Vignaud
+
+- fix collecting needed perl files with glibc-2.26
+
+Version 1.59 - 26 August 2018 by Thomas Backlund
+
+- adapt for btrfs-progs 4.17.1
+
+Version 1.58 - 26 August 2018 by Thomas Backlund
+
+- adapt for perl-5.28
+
+Version 1.57 - 10 February 2018 by Thierry Vignaud
+
+- add more udev rules (syncing with regular stage2)
+
+Version 1.56 - 19 January 2018 by Thomas Backlund
+
+- adapt for new systemd
+
+Version 1.55 - 30 January 2017 by Thierry Vignaud
+
+- lsparts: fix reporting half sizes (mga#8853)
+
+Version 1.54 - 20 June 2016 by Thierry Vignaud
+
+- do not run shells uselessly
+- drop (broken) support for Alpha, IA64 & PPC, Sparc
+- fix a message when re-installing bootloader
+
+Version 1.53 - 28 September 2015 by Thierry Vignaud
+
+- fix build with libified perl
+
+Version 1.52 - 30 April 2015 by Thierry Vignaud
+
+- guessmount: mount /dev, /run & /sys too (mga#10865)
+- lsparts (mga#8854):
+ o display label too
+ o silent run_program
+
+Version 1.51 - 15 April 2015 by Thierry Vignaud
+
+- fix reinstalling grub2 on UEFI (mga#15695)
+
+Version 1.50 - 9 January 2015 by Thomas Backlund
+
+- add efibootmgr on x86_64
+
+Version 1.49 - 18 September 2014 by Thomas Backlund
+
+- 80-net-name-slot.rules is replaced with 99-default.link
+
+Version 1.48 - 18 September 2014 by Thomas Backlund
+
+- killall5 is no more needed
+
+Version 1.47 - 8 December 2013 by Colin Guthrie
+
+- use systemd as init in the rescue system
+- allowing systemd-nspawn "booting" of a mounted /mnt (after umount /mnt/proc)
+
+Version 1.46 - 20 October 2013 by Colin Guthrie
+
+- adapt to a dracut based stage1
+
+Version 1.45.1 - 14 October 2013 by Colin Guthrie
+
+- many btrfs tools no longer exist
+
+Version 1.45 - 14 October 2013 by Colin Guthrie
+
+- adapt to latest mdadm
+- drop /etc/termcap as it's no longer part of our build
+- include network interface name udev rules (mga#10947)
+
+Version 1.44 - 18 May 2013 by Colin Guthrie
+
+- ensure /dev is bind mounted before re-installing bootloader (mga#10107)
+
+Version 1.43 - 15 May 2013 by Colin Guthrie
+
+- ensure grabjournallogs script is executable (mga#10108)
+
+Version 1.42 - 30 April 2013 by Thierry Vignaud
+
+- add a script to simplfy grabbing of journal logs for bug reports
+- enable to abort choosing distro to rescue (mga#9765)
+
+Version 1.41 - 6 April 2013 by Thierry Vignaud
+
+- really adapt to /usr move (fix lvm2 freezing, mga#5795)
+- drop our "use modprobe instead" insmod since we've kmod one for free
+- include libdevmapper-event-*.so
+- include persistant storage udev rules needed to see new uuids
+- offer to pick the distro to rescue when there's more than one
+- /var/run/utmp is on tmpfs now
+- warn that i586 cannot rescue x86_64 (mga#8696)
+
+Version 1.40 - 6 March 2013 by Thierry Vignaud
+
+- preload fuse (mga#5833)
+- use kmod's modprobe, thus fixing loading modules (mga#9270)
+
+Version 1.39 - 3 September 2012 by Thierry Vignaud
+
+- adapt to latest systemd/udevd
+- adapt to perl-5.16.0
+- adapt to /usr move
+- default to the higher version when there're several mga roots (mga#6003)
+- drop KA support
+- fix detecting USB devices with kernel-3.5+ (mga#7248)
+- preload load btrfs and nilfs2 too
+- rely on stage1 for mounting /dev
+- revert to "linux" terminfo
+- simplify bringing up local loop interface (pok, mdv)
+- stop fixing the raid udev rule now that it has been fixed
+
+Version 1.38 - 11 May 2012, by Thierry Vignaud
+
+- include missing modules when SMB appears in fstab (mga#5850)
+
+Version 1.37 - 18 April 2012, by Thierry Vignaud
+
+- fix detecting RAID (mga#5048)
+- include more udev rules for RAID (mga#5048)
+
+Version 1.36 - 8 April 2012, by Pascal Terjan
+
+- fix modprobe to support being called by kernel (mga#5274)
+
+Version 1.35 - 5 April 2012, by Thierry Vignaud
+
+- add chrooted rescue system in PATH
+- 32bit grub needs 32 bit loader (mga#5191)
+- default to "screen" instead of "linux" terminfo (mga#4894)
+- include "screen" terminfo (mga#4894)
+
+Version 1.34 - 26 February 2012, by Maarten Vanraes (AL13N)
+
+- escape / in generated passwords in startssh
+- add trailing ; in command lists in startssh
+
+Version 1.33 - 26 February 2012, by Thierry Vignaud
+
+- do not symlink /dev (mga#1023)
+
+Version 1.32 - 25 February 2012, by Thierry Vignaud & Maarten Vanraes (AL13N)
+
+- don't overwrite /dev after udev handles it
+- add some tests and error handling in startssh
+- really fix mounting /dev/pts & /dev/shm (mga#1023)
+
+Version 1.31 - 25 February 2012, by Thierry Vignaud & Maarten Vanraes (AL13N)
+
+- add logging to dropbear
+- fix mounting /dev/pts & /dev/shm (mga#1023)
+- make root user homedir /root
+- add agetty (mga#2052)
+
+Version 1.30 - 26 January 2012, by Thierry Vignaud
+
+- enable autologin on all consoles
+- include mkfs.nilfs2 & nilfs-tune
+
+Version 1.29 - 25 January 2012, by Thierry Vignaud
+
+- drop support for squashfs3
+- enable rescue through serial line (mga#2052)
+- fix mounting / (mga#3327)
+- fix mounting / on LV
+- fix mounting / on soft RAID or crypted LV (mga#3778 & mga#448)
+- include xz for xz modules
+- mount /proc in chroot
+- only consider fstab from the selected fs
+- switch to udev
+
+Version 1.28 - 15 January 2012, by Thierry Vignaud
+
+- use init from drakx-installer-sysvinit instead of system one
+
+Version 1.27 - 28 October 2011, by Thomas "tmb" Backlund
+
+- clean up genpasswd (AL13N)
+- add gdisk for GPT partitioning support (#1023)
+
+Version 1.26 - 24 October 2011, by Thomas "tmb" Backlund
+
+- add dropbear ssh support to rescue mode (AL13N, mga #1023)
+ * add screen, dropbear, dropbearkey, genpasswd and startssh
+ * add /etc/shells
+- add partprobe tool from parted (9k)
+
+Version 1.25.1 - 05 August 2011, by Thierry Vignaud
+
+- fix build with perl-5.14
+
+Version 1.25 - 05 August 2011, by Thierry Vignaud
+
+- add missing libfuse.so.2 for mount.ntfs-3g (#1189)
+- prefer Mageia root partitions over Mdv ones (#1320)
+
+Version 1.24 - 20 May 2011, by tmb
+
+- devices.pl: call mknod directly
+- list.xml: add btrfs tools to the image
+- list.xml: fix XSLoader path
+
+Version 1.23 - 06 April 2011, by Dmorgan
+
+- Fix function names ( Bug #651 )
+
+Version 1.22 - 24 February 2011, by Pascal "pterjan" Terjan
+
+- cleaning for Mageia import
+- include /etc/netconfig (needed by mount.nfs)
+
+Version 1.18 - 13 April 2010, by Olivier "blino" Blin
+
+- image restore script: use blkid instead of deprecated vol_id
+
+Version 1.17 - 12 April 2010, by Olivier "blino" Blin
+
+- Handle LVM (#44723)
+- image restore script: handle hybrid images (by matching main device)
+
+Version 1.16 - 9 October 2009, by Olivier "blino" Blin
+
+- work both with squashfs 3 and 4
+- image restore script (from Paulo Ricardo Zanoni):
+ o re-read partition table after writing image
+ o do not extend / to the end of the disk, it overlaps with swap
+ partition
+- do not make de-latin1 keymap a symlink/include loop (#45109)
+- use extipl from /usr/lib/extipl on x86_64 too
+ (to fix restore_ms_boot, hardcoding this path)
+
+Version 1.15 - 3 September 2009, by Thierry Vignaud
+
+- add back dumpe2fs
+- run /oem-rescue.sh if oem option is present on cmdline
+- allow to specify main partition in the restore config file
+ (MAIN_PART_NUMBER), if there is a restore partition at beginning of
+ disk
+- load ext4 module (#48816)
+- use blkid instead of vol_id which we no longer ship
+
+Version 1.14 - 27 May 2009, by Olivier "blino" Blin
+
+- adapt to new extipl location in x86_64
+- adapt to new magic.mgc location
+
+Version 1.13 - 27 May 2009, by Olivier "blino" Blin
+
+- include various commands
+- image restore script:
+ o better estimate of image dump progression
+ o fix detecting multiple partitions to avoid win32 detection
+ o fix guessing extension when filename contains a dot
+
+Version 1.12 - 20 February 2009, by Olivier "blino" Blin
+
+- image restore script:
+ o add swap partition
+ o use a minimum size for disks to be detected (Caio)
+ o resize Windows partitions if needed (Caio)
+- Flash rescue:
+ o add support for Flash 2009
+ o try to load squashfs-lzma too
+ o handle path to lzma distrib loopbacks
+- fix build:
+ o do not include dead parsehdlist
+ o do not include dead rpm helpers
+
+Version 1.11 - 25 September 2008, by Olivier "blino" Blin
+
+- add image restoration scripts ("restore" command line parameter)
+
Version 1.10 - 25 April 2008, by Olivier "blino" Blin
- fix "Mounting other partitions from fstab" which use UUID=xxx
diff --git a/rescue/aliases b/rescue/aliases
index 59c96a124..ae924a86e 100644
--- a/rescue/aliases
+++ b/rescue/aliases
@@ -1,2 +1,9 @@
-/bin/vi vim-minimal
-/lib/modules /modules
+/bin usr/bin
+/sbin usr/sbin
+/lib usr/lib
+/usr/bin/vi vim-minimal
+/usr/sbin/init ../lib/systemd/systemd
+/usr/lib/modules ../../modules
+/usr/lib/systemd/system/default.target rescue.target
+/usr/lib/systemd/system/rescue.target.wants/sockets.target ../sockets.target
+/usr/lib/systemd/system/dbus-org.freedesktop.machine1.service systemd-machined.service
diff --git a/rescue/drvinst b/rescue/bin/drvinst
index cc7fb4fa2..4868b42e0 100755
--- a/rescue/drvinst
+++ b/rescue/bin/drvinst
@@ -19,28 +19,19 @@ use detect_devices;
$ARGV[0] =~ /^--?h/ and die "usage: drivers_install [drivertype1 [drivertype2 ...]]\n";
my @types = @ARGV;
-sub install_module_raw {
- my ($driver, $o_descr) = @_;
- print STDERR "Installing driver $driver", $o_descr ? " (for \"$o_descr\")" : '', "\n";
- system("/sbin/modprobe", $driver) and print "\tfailed\n";
-}
-
-my $already_usb;
sub install_module {
my ($driver, $descr) = @_;
- install_module_raw($driver, $descr);
- if (!$already_usb && $driver =~ /usb/) {
- $already_usb = 1;
- install_module_raw('usbkbd');
- install_module_raw('keybdev');
- }
+ print STDERR qq(Installing driver $driver (for "$descr")\n);
+ system("/sbin/modprobe", $driver) and print "\tfailed\n";
}
#- start
foreach my $card (detect_devices::pci_probe()) {
+ # ignoring "unknown", "Card:foobar" and the like as well as video cards:
$card->{driver} eq 'unknown' || $card->{driver} =~ /:/ and next;
$card->{media_type} eq "DISPLAY_VGA" and next;
+ # load drivers for selected categories or for everything if no args:
if (!@ARGV || find { $card->{media_type} =~ /$_/i } @types) {
install_module($card->{driver}, $card->{description});
}
diff --git a/rescue/bin/guessmounts b/rescue/bin/guessmounts
new file mode 100755
index 000000000..494f98f44
--- /dev/null
+++ b/rescue/bin/guessmounts
@@ -0,0 +1,168 @@
+#!/usr/bin/perl
+#
+# Guillaume Cottenceau
+#
+# Copyright 2001-2005 Mandriva
+#
+# This software may be freely redistributed under the terms of the GNU
+# public license.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+
+use lib qw(/usr/lib/libDrakX);
+use common;
+use devices;
+use fs;
+use fs::dmcrypt;
+use fs::proc_partitions;
+use fs::type;
+use lvm;
+use run_program;
+
+my @proc_mounts = fs::read_fstab('', '/proc/mounts');
+
+my $target = '/mnt';
+
+if (fs::get::mntpoint2part($target, \@proc_mounts)) {
+ print STDERR "$target is already mounted (according to /proc/mounts)\n";
+ exit 0;
+}
+
+system('drvinst', 'STORAGE');
+
+print STDERR "\nPlease wait, trying to find your root device...\n";
+
+mkdir_p($target);
+
+{
+ local $::isInstall = 1; # so that detect_during_install() got called by init:
+ lvm::init();
+}
+fs::dmcrypt::init;
+
+my @parts = map {
+ $_->{device} = delete $_->{dev};
+ put_in_hash($_, fs::type::type_subpart_from_magic($_));
+} fs::proc_partitions::read_raw();
+
+# Basically doing fsedit::raids():
+my ($raid_parts, $normal_parts) = partition { isRawRAID($_) } @parts;
+
+if (@$raid_parts) {
+ require raid;
+ raid::detect_during_install(@$raid_parts);
+ my $raids = raid::get_existing(@$raid_parts);
+ push @$normal_parts, @$raids;
+}
+
+# Basically doing fsedit::dmcrypts():
+(my $luks_parts, $normal_parts) = partition { isRawLUKS($_) } @$normal_parts;
+if (@$luks_parts) {
+ use interactive;
+ use interactive::curses;
+ require diskdrake::interactive;
+ my $in = interactive->vnew('su');
+ my $all_hds = fsedit::get_hds({}, $in);
+ # Unlocking them in order to look at their fs (do they hold a Mageia installation):
+ foreach my $part (@$luks_parts) {
+ diskdrake::interactive::dmcrypt_open($in, undef, $part, $all_hds);
+ }
+ my @dmcrypts = fs::dmcrypt::get_existing(@$luks_parts);
+ push @$normal_parts, @dmcrypts;
+}
+
+my @roots;
+
+my $arch = arch() =~ /i.86/ ? $MDK::Common::System::compat_arch{arch()} : arch();
+foreach (@$normal_parts) {
+ my $dev = devices::make($_->{device});
+
+ my $fs = $_->{fs_type};
+ member($fs, fs::type::true_local_fs_types()) or next;
+ system("mount -t $fs $dev $target 2>/dev/null");
+
+ if (my $release_file = common::release_file($target)) {
+ my @fstab = fs::read_fstab($target, '/etc/fstab');
+ my $h = common::parse_release_file($target, $release_file, $_);
+ add2hash($h, { dev => $dev, fs => $fs, fstab => \@fstab,
+ pretty_name => "$h->{release} $h->{version} $h->{arch} on $dev" });
+ my $release = chomp_(cat_("$target$release_file"));
+ printf STDERR "=> found a %s root partition on $dev\n=> type $fs, version `$release'\n", $h->{release};
+ # Offer to rescue only same arch:
+ $h->{pretty_name} .= " (cannot be rescued: $h->{arch} ne $arch;)" if $h->{arch} ne $arch;
+ push @roots, $h;
+ }
+ system('umount', $target) == 0 or die "error unmounting $target\n";
+}
+
+my ($root, $fs, @fstab);
+
+# Try Mageia first:
+if (@roots) {
+ # Order by release number:
+ @roots = sort { $b->{version} cmp $a->{version} } @roots;
+ # Then pick mga over mdv:
+ @roots = map { @$_ } partition { $_->{release} =~ /Mageia/ } @roots;
+
+ my $selected;
+ if (@roots == 1) {
+ $selected = first(@roots);
+ } else {
+ print "\n\nWhich system do you want to rescue?\n0: Abort\n";
+ each_index { print $::i + 1, ": $_->{pretty_name}\n" } @roots;
+ my $res;
+ while ($res < 1 || $res > @roots) {
+ print "what is your choice (type the number of your selection or C^c to abort)?\n";
+ $res = <>;
+ chomp($res);
+ if ($res eq "0") {
+ print "Aborting\n";
+ exit(1);
+ }
+ }
+ $selected = $roots[$res-1];
+ }
+
+ $root = $selected->{dev};
+ $fs = $selected->{fs};
+ @fstab = @{$selected->{fstab}};
+ print STDERR "=> Selecting $root as root fs\n";
+}
+
+if ($root) {
+ system("mount -t $fs $root $target 2>/dev/null");
+
+ print STDERR "\nMounting other partitions from fstab on $target...\n";
+ foreach (@fstab) {
+ my ($valued_options, $options) = fs::mount_options::unpack($_);
+
+ next if
+ !$_->{fs_type} || $_->{device} eq 'none'
+ || $valued_options->{noauto}
+ || $_->{mntpoint} eq '/'
+ || member($_->{fs_type}, 'swap', 'nfs', 'ntfs', 'ntfs-3g');
+
+ delete $valued_options->{'iocharset='};
+ delete $valued_options->{'codepage='};
+ fs::mount_options::pack($_, $valued_options, $options); #- vfat opts, we don't have the modules in rescue
+
+ my $where = "$target$_->{mntpoint}";
+ my $dev = fs::wild_device::from_part('', $_);
+ mkdir_p($where);
+ print STDERR "\t$dev on $where type $_->{fs_type} options $_->{options}\n";
+ system('mount', '-t', $_->{fs_type}, $dev, $where, '-o', $_->{options});
+ }
+ system(qw(mount -t proc proc), "$target/proc");
+ foreach (qw(/dev /run)) {
+ system('mount', '--bind', $_, "$target/$_");
+ }
+ system(qw(mount -t sysfs sysfs), "$target/sys");
+ system(qw(mount -t efivarfs efivarfs), "$target/sys/firmware/efi/efivars") if is_uefi();
+ print STDERR "\nYour system is ready on $target.\n\n";
+} else {
+ die "Could not find your root device :-(.\n";
+}
+
diff --git a/rescue/install_bootloader b/rescue/bin/install_bootloader
index e8bc04ad8..3eeb7a65e 100755
--- a/rescue/install_bootloader
+++ b/rescue/bin/install_bootloader
@@ -17,20 +17,21 @@ use common;
use bootloader;
use fs;
+my $auto;
if ($ARGV[0] eq '--auto') {
$auto = shift @ARGV;
}
$::prefix = '/mnt';
-my $release = common::mandrake_release($::prefix) ||
+my $release = common::mageia_release($::prefix) ||
do {
system('guessmounts') == 0 or die 'guessmounts failed';
- common::mandrake_release($::prefix);
+ common::mageia_release($::prefix);
};
if ($release) {
- $release =~ /Mandrake|Mandriva/ or die "release file doesn't contain 'Mandriva', exiting.\n";
+ $release =~ /Mageia|Mandriva/ or die "release file doesn't contain '%s', exiting.\n";
} elsif (fs::get::mntpoint2part($::prefix, [ fs::read_fstab('', '/proc/mounts') ])) {
die "unknown distribution mounted in $::prefix\n";
} else {
@@ -59,7 +60,7 @@ if (@main_methods == 0) {
my $install = $bootloader::{'install_raw_' . $main_method} or die "unknown bootloader method install_raw_$main_method\n";
-print "About to re-install Boot Loader $main_method of following Mandriva Linux distribution:\n\t",
+print "About to re-install Boot Loader $main_method of following Mageia distribution:\n\t",
$release, "\n";
if (!$auto) {
print "=> ok? <press Enter to continue, 'n' and Enter to cancel> ";
diff --git a/rescue/lsparts b/rescue/bin/lsparts
index e1e866db4..a1855a21e 100755
--- a/rescue/lsparts
+++ b/rescue/bin/lsparts
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
-# Main author Pascal Rigaux (pixel@mandriva.com)
+# Main author Pascal Rigaux (pixel)
# Put together by Guillaume Cottenceau
#
# Copyright 1999-2005 Mandriva
@@ -38,8 +38,9 @@ foreach (fs::proc_partitions::read_raw()) {
print STDERR "$err\n" if $verbose;
} else {
$_->{device} = $_->{dev};
+ local $::isStandalone = 1; # silent run_program
if (my $type = fs::type::type_subpart_from_magic($_)) {
- printf "$_->{dev}: %6s, fs %s (%s)\n", formatXiB($_->{size} * 512), $type->{fs_type}, fs::type::part2type_name($type);
+ printf "$_->{dev}: %6s, fs %s (%s) [%s]\n", formatXiB($_->{size} * 1024), $type->{fs_type}, fs::type::part2type_name($type), $type->{device_LABEL};
}
}
}
diff --git a/rescue/rescue-doc b/rescue/bin/rescue-doc
index fa03d1be3..e6514b462 100755
--- a/rescue/rescue-doc
+++ b/rescue/bin/rescue-doc
@@ -1,6 +1,7 @@
#!/usr/bin/perl
-sub output { my $f = shift; local *F; open F, ">$f" or die "output in file $f failed: $!\n"; print F foreach @_; }
+# From MDK::Common:
+sub output { my $f = shift; open(my $F, ">$f") or die "output in file $f failed: $!\n"; print $F $_ foreach @_ }
output('/tmp/rescue-doc-contents', q(
Information regarding problems not directly addressed
@@ -13,15 +14,15 @@ problem?
The rescue system on this CD is a very basic text-based
environment for rescuing systems that no longer boot. You will
not find an easy-to-use graphical environment in this rescue
-system, nor the Mandriva detection/configuration libraries.
+system, nor the detection/configuration libraries.
The vast majority of problems that can affect a Linux system are
much easier to repair on a running system than by booting into
"rescue mode". In fact, there are very few problems which aren't
easier to resolve in the comfortable environment of a fully
-installed Mandriva Linux system than in this spartan "rescue
-system" shell. Some of the most common problems include:
+installed system than in this spartan "rescue system" shell.
+Some of the most common problems include:
- bad or missing X (video display) configuration
- adding/removing/reconfiguring hardware
@@ -45,13 +46,9 @@ system is the right tool. Some common examples include:
just modify what's necessary to boot into a running system,
then complete the fix from there.
-In case you have found a new problem which should be handled by
-"rescue mode" but currently isn't, please report it to
-<pixel@mandriva.com>.
-
-For more information on troubleshooting a Mandriva Linux system,
+For more information on troubleshooting your system,
please consult the official manuals, the documentation on
-MandrivaLinux.com, MandrivaClub.org, or the MandrivaExpert.com support forum.
+wiki.mageia.org or support forum at forum.mageia.org.
<press 'q' (qwerty keyboard) to continue>
));
diff --git a/rescue/restore_ms_boot b/rescue/bin/restore_ms_boot
index 1f8cc2907..1f8cc2907 100755
--- a/rescue/restore_ms_boot
+++ b/rescue/bin/restore_ms_boot
diff --git a/rescue/devices.pl b/rescue/devices.pl
deleted file mode 100644
index 0d4a8f77f..000000000
--- a/rescue/devices.pl
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/perl
-
-@ARGV == 1 && chdir $ARGV[0] or die "usage: devices.pl <dir>\n";
-
-foreach (<DATA>) {
- chomp;
- my ($typ, $maj, $min, @l) = split;
- foreach (@l) {
- my @l2 = do {
- if (my ($prefix, $ini, $end) = /(.*)(\d+)-(\d+)$/) {
- map { "$prefix$_" } $ini .. $end;
- } else {
- $_;
- }
- };
- foreach (@l2) {
- my $cmd = "mknod-m600 $_ $typ $maj " . $min++;
- system($cmd) == 0 or die "$cmd failed\n";
- }
- }
-}
-
-__DATA__
-c 5 1 console
-b 2 0 fd0-1
-c 1 2 kmem
-b 7 0 loop0-15
-c 1 1 mem
-c 1 3 null
-c 1 4 port
-b 1 1 ram
-b 1 0 ram0-19
-b 1 0 ramdisk
-c 1 8 random
-b 11 0 scd0-7
-c 0 0 stderr
-c 0 0 stdin
-c 0 0 stdout
-c 5 0 tty
-c 4 0 tty0-9
-c 4 64 ttyS0-3
-c 1 9 urandom
-c 1 5 zero
-b 3 0 hda hda1-16
-b 3 64 hdb hdb1-16
-b 22 0 hdc hdc1-16
-b 22 64 hdd hdd1-16
-b 33 0 hde hde1-16
-b 33 64 hdf hdf1-16
-b 34 0 hdg hdg1-16
-b 34 64 hdh hdh1-16
-b 8 0 sda sda1-15 sdb sdb1-15 sdc sdc1-15 sdd sdd1-15 sde sde1-15 sdf sdf1-15 sdg sdg1-15 sdh sdh1-15
-b 9 0 md0-15
-c 10 144 nvram
-c 9 0 st0-15
diff --git a/rescue/dirs b/rescue/dirs
index e6d5a5d47..1b1153926 100644
--- a/rescue/dirs
+++ b/rescue/dirs
@@ -1,6 +1,9 @@
-/lib
+/dev
+/proc
+/run
+/sys
/tmp
+/usr/bin
+/usr/sbin
+/usr/lib/systemd/system/rescue.target.wants
/modules
-/proc
-/dev
-/dev/pts
diff --git a/rescue/guessmounts b/rescue/guessmounts
deleted file mode 100755
index c755e0743..000000000
--- a/rescue/guessmounts
+++ /dev/null
@@ -1,97 +0,0 @@
-#!/usr/bin/perl
-#
-# Guillaume Cottenceau
-#
-# Copyright 2001-2005 Mandriva
-#
-# This software may be freely redistributed under the terms of the GNU
-# public license.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-
-use lib qw(/usr/lib/libDrakX);
-use common;
-use fs;
-use fs::proc_partitions;
-use fs::type;
-
-
-my @proc_mounts = fs::read_fstab('', '/proc/mounts');
-
-my $target = '/mnt';
-
-if (fs::get::mntpoint2part($target, \@proc_mounts)) {
- print STDERR "$target is already mounted (according to /proc/mounts)\n";
- exit 0;
-}
-
-system('drvinst', 'STORAGE');
-
-print STDERR "\nPlease wait, trying to find your root device...\n";
-
-mkdir_p($target);
-
-my @parts = map {
- $_->{device} = delete $_->{dev};
- put_in_hash($_, fs::type::type_subpart_from_magic($_));
-} fs::proc_partitions::read_raw();
-my ($raid_parts, $normal_parts) = partition { isRawRAID($_) } @parts;
-
-if (@$raid_parts) {
- require raid;
- raid::detect_during_install_once(@$raid_parts);
- my $raids = raid::get_existing(@$raid_parts);
- push @$normal_parts, @$raids;
-}
-
-my @fstab;
-my $root;
-
-foreach (@$normal_parts) {
- my $dev = devices::make($_->{device});
-
- my $fs = find {
- system("mount -t $_ $dev $target 2>/dev/null") == 0;
- } fs::type::true_local_fs_types() or next;
-
- if (my $release_file = common::release_file($target)) {
- print STDERR "=> found a Mandriva Linux root partition on $dev\n=> type $fs, version `",
- chomp_(cat_("$target$release_file")), "'\n";
- @fstab = fs::read_fstab($target, '/etc/fstab');
- $root = $dev;
- last;
- } else {
- system('umount', $target) == 0 or die "error unmounting $target\n";
- }
-}
-
-if ($root) {
- print STDERR "\nMounting other partitions from fstab on $target...\n";
- foreach (@fstab) {
- my ($valued_options, $options) = fs::mount_options::unpack($_);
-
- next if
- !$_->{fs_type} || $_->{device} eq 'none'
- || $valued_options->{noauto}
- || $_->{mntpoint} eq '/'
- || member($_->{fs_type}, 'swap', 'nfs', 'ntfs', 'ntfs-3g');
-
- delete $valued_options->{'iocharset='};
- delete $valued_options->{'codepage='};
- fs::mount_options::pack($_, $valued_options, $options); #- vfat opts, we don't have the modules in rescue
-
- my $where = "$target$_->{mntpoint}";
- my $dev = fs::wild_device::from_part('', $_);
- mkdir_p($where);
- print STDERR "\t$dev on $where type $_->{fs_type} options $_->{options}\n";
- system("mount -t $_->{fs_type} $dev $where -o $_->{options}");
- system("cp -f /etc/mtab $target/etc/mtab"); #- to allow a nice chrooted "mount" or "df"
- }
- print STDERR "\nYour system is ready on $target.\n\n";
-} else {
- die "Could not find your root device :-(.\n";
-}
-
diff --git a/rescue/list.xml b/rescue/list.xml
index 697736152..50656352e 100644
--- a/rescue/list.xml
+++ b/rescue/list.xml
@@ -7,7 +7,7 @@
pwd reset
ls
- cp ln mkdir mknod mv rm rmdir
+ cp ln mkdir mknod mv rm rmdir
chmod chown
dd touch
@@ -20,16 +20,12 @@
find
file md5sum
- gzip zcat gunzip
+ gzip zcat gunzip xz
bzip2 bunzip2 bzcat
df du
- <mode copy="dereference">
- vol_id <!-- needed by libDrakX -->
- </mode>
-
- packdrake parsehdlist
+ packdrake
cpio ftp tar
rsync
ssh scp
@@ -44,58 +40,74 @@
eject
mount mount.nfs umount
+ losetup
ldconfig
- mingetty init
+ mingetty agetty
reboot halt shutdown
- kill killall5 ps strace
+ kill ps strace
sed tr
+ strings
loadkeys tset stty
ping hostname ifconfig route
fdformat badblocks
- e2fsck fsck.ext2 fsck.ext3 mke2fs mkfs.ext2 mkfs.ext3 resize2fs
- mkfs.ext3 mkfs.reiserfs mkfs.xfs mkfs.jfs
- debugfs dumpe2fs tune2fs
- fsck.xfs xfs_repair
- resize_reiserfs reiserfsck
mkswap swapoff swapon
+ e2fsck fsck.ext2 fsck.ext3 fsck.ext4
+ mke2fs mkfs.ext2 mkfs.ext3 mkfs.ext4
+ dumpe2fs tune2fs resize2fs debugfs
+
+ mkfs.reiserfs resize_reiserfs reiserfstune reiserfsck
+ mkfs.xfs xfs_admin xfs_growfs xfs_repair fsck.xfs
+ xfs_freeze xfs_io <!-- needed for setup grub on XFS formated / -->
+ xfs_db <!-- needed by xfs_admin for setting UUID -->
+ mkfs.ntfs mkdosfs dosfslabel mkntfs ntfsresize ntfslabel
+ mkfs.nilfs2 nilfs-tune
+
+ mkfs.btrfs btrfs btrfsck fsck.btrfs btrfstune
+ btrfs-map-logical btrfs-convert
+ mkfs.f2fs fsck.f2fs resize.f2fs
+
+ dropbear dropbearkey
+ screen
+
+ gdisk
+
<if ARCH="i.86|x86_64">
- fsck.jfs
- strings
- </if>
- <if ARCH="i.86|x86_64|ia64">
- ntfsresize
- mkdosfs
- </if>
- <if ARCH="ppc">
- hformat
+ mkfs.jfs fsck.jfs jfs_tune
</if>
+ quotacheck
+ cryptsetup dmsetup
- <if-not ARCH="ppc">
fdisk gpart
- testdisk
- </if-not>
- <if-not ARCH="ppc|sparc">
+ testdisk photorec
+
sfdisk
- </if-not>
-
- <if ARCH="ppc">
- pdisk
- </if>
+
dump dump.ext2 restore restore.ext2 dump.ext3 restore.ext3 dump.xfs restore.xfs
- parted partimage
+ parted partimage partprobe
+
+ udevadm
mdadm lvm2
- <if ARCH="i.86|x86_64|ia64">
+ <!-- symlinks -->
+ lvconvert lvcreate lvchange lvdisplay lvextend lvmconfig lvmdiskscan lvmsadc lvmsar lvreduce lvremove lvrename lvresize lvs lvscan
+ pvck pvcreate pvchange pvdisplay pvmove pvremove pvresize pvs pvscan
+ vgcfgbackup vgcfgrestore vgck vgconvert vgcreate vgchange vgdisplay vgexport vgextend vgimport vgimportclone vgmerge vgmknodes vgreduce vgremove vgrename vgs vgscan vgsplit
+
+ mdmon kpartx
+ dmevent_tool
+ dmeventd
+ <if ARCH="i.86|x86_64">
dmraid
</if>
lsmod
insmod
rmmod
+ modprobe
setserial
mt stinit
@@ -104,7 +116,7 @@
rpm
rpm2cpio rpmdb
- rpme rpmi rpmu rpmquery rpmverify
+ rpmquery rpmverify
vim-minimal hexedit
@@ -112,39 +124,38 @@
uniq
wget
- <if ARCH="i.86|x86_64|ia64">
+ awk clear dialog wc
+ setterm
+
+ <if ARCH="i.86|x86_64">
dmidecode
</if>
<if ARCH="i.86|x86_64">
grub grub-install
</if>
- <if ARCH="ia64">
+ <if ARCH="x86_64">
efibootmgr
</if>
- <if ARCH="ppc">
- ybin
- mkofboot ofpath
- nvsetenv
- </if>
- <if ARCH="sparc">
- silo
- </if>
</from>
<from>
/usr/lib/kbd/keymaps/include
- <if ARCH="i.86|x86_64">
+ <if ARCH="i.86|x86_64">
/usr/lib/kbd/keymaps/i386/include
/usr/lib/kbd/keymaps/i386/azerty/be-latin1.map.gz <!-- this one is needed by be2-latin1 -->
</if>
- /usr/share/misc/file/magic.mgc
+ /usr/share/misc/magic.mgc
/usr/share/terminfo/l/linux
+ /usr/share/terminfo/s/screen
/usr/share/pci.ids
- /var/run/utmp
+
+ <from expand="glob">
+ /usr/LIB/ntfs-3g/*
+ </from>
<if ARCH="i.86|x86_64">
- <from dir="/lib/grub/ARCH-mandriva" expand="glob">
+ <from dir="/lib/grub/ARCH-mageia" expand="glob">
stage1
stage2
*_stage1_5
@@ -152,11 +163,6 @@
/usr/lib/extipl/aldebaran.bin
</if>
- <if ARCH="ppc">
- /usr/lib/yaboot/ofboot
- /usr/lib/yaboot/yaboot
- </if>
-
<from expand="command">
perl -Mkeyboard -I/usr/lib/libDrakX -le 'print foreach keyboard::loadkeys_files()'
</from>
@@ -175,7 +181,19 @@
/usr/share/locale/pt_BR
/usr/share/locale/pt/LC_MESSAGES/partimage.mo
</if>
+ <!-- needed by mlabel used during Flash upgrades -->
+ /usr/lib/gconv/IBM850.so
+
+ /sbin/mount.ntfs-3g <!-- can not be expanded as binary, not executable for all users -->
+ /sbin/blkid
+</from>
+
+
+<from dir="/usr/LIB/device-mapper">
+ <from expand="glob">
+ *.so
+ </from>
</from>
<from dir="/usr/lib/rpm" expand="glob">
@@ -183,13 +201,13 @@
rpmrc
macros
rpmpopt-*
- rpmd rpme rpmi rpmu rpmq rpmv
</mode>
</from>
<filter subst="/^__END__/ and $_ = '', close ARGV">
<from expand="main-perl">
AutoLoader.pm
+ overload.pm <!-- required by File::Temp -->
strict.pm
vars.pm
warnings/register.pm
@@ -198,52 +216,202 @@
Exporter.pm
File/Path.pm
File/Basename.pm
- ARCH-linux-thread-multi/re.pm
- ARCH-linux-thread-multi/Cwd.pm
- ARCH-linux-thread-multi/auto/Cwd/Cwd.so
- ARCH-linux-thread-multi/CORE/libperl.so
- ARCH-linux-thread-multi/auto/POSIX/autosplit.ix
- ARCH-linux-thread-multi/auto/POSIX/load_imports.al
- ARCH-linux-thread-multi/auto/POSIX/POSIX.so
- ARCH-linux-thread-multi/POSIX.pm
- ARCH-linux-thread-multi/XSLoader.pm
- ARCH-linux-thread-multi/lib.pm
- ARCH-linux-thread-multi/Socket.pm
- ARCH-linux-thread-multi/IO/Socket.pm
- ARCH-linux-thread-multi/IO.pm
- ARCH-linux-thread-multi/IO/Handle.pm
- ARCH-linux-thread-multi/Encode/Symbol.pm
+ File/Temp.pm <!-- required by diskdrake::interactive -->
+ XSLoader.pm
Symbol.pm
SelectSaver.pm
- ARCH-linux-thread-multi/auto/DynaLoader/dl_findfile.al
- ARCH-linux-thread-multi/DynaLoader.pm
- ARCH-linux-thread-multi/auto/IO/IO.so
- ARCH-linux-thread-multi/auto/Socket/Socket.so
- ARCH-linux-thread-multi/Errno.pm
- ARCH-linux-thread-multi/IO/Socket/INET.pm
- ARCH-linux-thread-multi/IO/Socket/UNIX.pm
</from>
+
+<from expand="main-perl-bin">
+ re.pm
+ Cwd.pm
+ auto/Cwd/Cwd.so
+ auto/POSIX/POSIX.so
+ POSIX.pm
+ lib.pm
+ Socket.pm
+ IO/Socket.pm
+ IO.pm
+ IO/Handle.pm
+ Encode/Symbol.pm
+ Encode/Unicode.pm
+ auto/Encode/Unicode/Unicode.so
+ DynaLoader.pm
+ File/Spec.pm <!-- required by File::Temp -->
+ File/Spec/Unix.pm <!-- required by File::Spec -->
+ auto/IO/IO.so
+ auto/Socket/Socket.so
+ Errno.pm
+ IO/Socket/INET.pm
+ IO/Socket/UNIX.pm
+ List/Util.pm <!-- required by Scalar::Util -->
+ auto/List/Util/Util.so
+ Scalar/Util.pm <!-- required by File::Temp -->
+</from>
+
<from expand="perl">
packdrake.pm
MDV/Packdrakeng.pm
</from>
</filter>
+<from expand="rpm" matching="m!^/usr/(share|LIB)/perl5! and !/\.pod$/">
+ perl-Curses <!-- required by Curses::UI -->
+ perl-Curses-UI <!-- required by interactive::curses -->
+</from>
+
<from dir="/etc">
mke2fs.conf
+ netconfig
inputrc
- termcap
protocols
services
+ shells
ssh/ssh_config
</from>
+<from dir="/usr/lib/systemd">
+ systemd
+ systemd-executor
+ systemd-fsck
+ systemd-journald
+ systemd-machined
+ systemd-modules-load
+ systemd-reply-password
+ systemd-shutdown
+ systemd-sysctl
+ systemd-udevd
+ systemd-vconsole-setup
+ system-generators/systemd-fstab-generator
+</from>
+
+<from dir="/usr/lib/systemd/network">
+ 99-default.link
+</from>
+
+<from dir="/usr/lib/systemd/system">
+ cryptsetup.target
+ dbus.service
+ dbus.socket
+ emergency.target
+ sysinit.target
+ basic.target
+ halt.target
+ kexec.target
+ local-fs.target
+ local-fs-pre.target
+ remote-fs.target
+ remote-fs-pre.target
+ network.target
+ nss-lookup.target
+ nss-user-lookup.target
+ poweroff.target
+ reboot.target
+ rescue.target
+ rpcbind.target
+ shutdown.target
+ final.target
+ sigpwr.target
+ sockets.target
+ swap.target
+ timers.target
+ paths.target
+ umount.target
+ kmod-static-nodes.service
+ systemd-tmpfiles-setup-dev.service
+ systemd-ask-password-console.path
+ systemd-udevd-control.socket
+ systemd-udevd-kernel.socket
+ systemd-ask-password-plymouth.path
+ systemd-journald.socket
+ systemd-ask-password-console.service
+ systemd-modules-load.service
+ systemd-halt.service
+ systemd-poweroff.service
+ systemd-reboot.service
+ systemd-kexec.service
+ systemd-fsck@.service
+ systemd-udevd.service
+ systemd-udev-trigger.service
+ systemd-udev-settle.service
+ systemd-ask-password-plymouth.service
+ systemd-journald.service
+ systemd-machined.service
+ systemd-vconsole-setup.service
+
+ sysinit.target.wants/systemd-modules-load.service
+ sysinit.target.wants/systemd-ask-password-console.path
+ sysinit.target.wants/systemd-journald.service
+ sockets.target.wants/dbus.socket
+ sockets.target.wants/systemd-udevd-control.socket
+ sockets.target.wants/systemd-udevd-kernel.socket
+ sockets.target.wants/systemd-journald.socket
+ sysinit.target.wants/systemd-udevd.service
+ sysinit.target.wants/systemd-udev-trigger.service
+ sysinit.target.wants/kmod-static-nodes.service
+ sysinit.target.wants/systemd-tmpfiles-setup-dev.service
+
+ ctrl-alt-del.target
+ syslog.socket
+
+ slices.target
+</from>
+
+<from expand="binary">
+ journalctl systemctl echo swapoff systemd-cgls systemd-tmpfiles systemd-nspawn dbus-daemon machinectl
+</from>
+
+<from>
+ /etc/dbus-1/system.conf
+ /usr/share/dbus-1/system.d/org.freedesktop.systemd1.conf
+ /usr/share/dbus-1/system.d/org.freedesktop.machine1.conf
+ /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service
+ /usr/share/dbus-1/system-services/org.freedesktop.machine1.service
+</from>
+
+<from dir="/usr/lib/udev">
+ ata_id
+ scsi_id
+</from>
+
+<from dir="/usr/lib/udev/hwdb.d">
+ <from expand="glob">
+ *.hwdb
+ </from>
+</from>
+
+<from dir="/usr/lib/udev/rules.d">
+ 10-dm.rules
+ 11-dm-lvm.rules
+ 13-dm-disk.rules
+ 50-udev-default.rules
+ 60-persistent-storage.rules
+ 63-md-raid-arrays.rules
+ 64-md-raid-assembly.rules
+ 75-net-description.rules
+ 80-drivers.rules
+ 80-net-setup-link.rules
+ 95-dm-notify.rules
+</from>
+
+
<filter command="strip">
+ <!-- 32bit grub needs 32 bit loader -->
+ <if ARCH="x86_64">
+ <from dir="/lib">
+ ld-linux*.so.2
+ </from>
+ </if>
<from dir="/LIB">
libnss_files.so.2
libnss_dns.so.2
libresolv.so.2
ld-linux*.so.2
+ <!-- needed for mount.ntfs-3g -->
+ libfuse.so.2
+
+ <!-- needed by dmraid -->
+ libdmraid-events-isw.so
</from>
</filter>
@@ -258,21 +426,31 @@
<filter command="../tools/simplify-drakx-modules">
<from dir="." expand="collect-perl-files /usr/lib/libDrakX /usr/lib/libDrakX">
- <to dir="/usr/bin">
- rescue-doc drvinst lsparts
- guessmounts install_bootloader
+ <to dir="/usr">
+ bin/rescue-doc
+ bin/drvinst
+ bin/lsparts
+ bin/guessmounts
+ bin/install_bootloader
<if ARCH="i.86|x86_64">
- restore_ms_boot
+ bin/restore_ms_boot
</if>
</to>
- <to dir="/usr/sbin">
- partimage_whole_disk
+ <to dir="/usr">
+ sbin/partimage_whole_disk
</to>
</from>
+ <!-- Those are listed b/c collect-perl-files failed to detect them: -->
<from dir="/usr/lib/libDrakX" expand="glob">
- raid.pm <!-- required when needed in guessmounts -->
+ interactive.pm <!-- required by diskdrake::interactive -->
+ interactive/curses.pm <!-- required by interactive -->
+ diskdrake/interactive.pm <!-- required by guessmount -->
fs/dmraid.pm <!-- required by fsedit -->
+ fs/remote.pm <!-- required by fs::remote::* -->
+ fs/remote/davfs.pm <!-- required by fs -->
+ fs/remote/smb.pm <!-- required by fs -->
partition_table/*.pm <!-- required by partimage_whole_disk -->
+ raid.pm <!-- required when needed in guessmounts -->
</from>
</filter>
@@ -284,31 +462,8 @@
dhcp-client
</to>
</from>
-<from dir="/usr/bin">
- <to dir="/ka">
- bootable_flag.sh
- fdisk_to_desc
- gen_modprobe_conf.pl
- ka-d-client
- ka-d-server
- ka-d.sh
- ka_replication.sh
- make_initrd_grub
- make_initrd_lilo
- prepare_node.sh
- send_status.pl
- status_node.pl
- store_log.sh
- </to>
-</from>
-<from dir="/etc/ka">
- <to dir="/ka">
- replication.conf
- </to>
-</from>
<if set="RESCUE_FLASH">
<from expand="binary">
- clear
dirname
losetup
mlabel
diff --git a/rescue/make_flash_rescue b/rescue/make_flash_rescue
index 66bd6fd19..2f7ce8584 100755
--- a/rescue/make_flash_rescue
+++ b/rescue/make_flash_rescue
Binary files differ
diff --git a/rescue/make_partimage_save_rest_all b/rescue/make_partimage_save_rest_all
index a7af52130..929ffd2c1 100755
--- a/rescue/make_partimage_save_rest_all
+++ b/rescue/make_partimage_save_rest_all
@@ -57,7 +57,7 @@ EOF
ln -s $partimage_dir$data_dir .tmp$dir
fi
- genisoimage -f -o part_$action.iso -r -J -hide-rr-moved -nobak -cache-inodes -publisher Mandriva -V 'mdk part save/rest' -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table .tmp
+ genisoimage -f -o part_$action.iso -r -J -hide-rr-moved -nobak -cache-inodes -publisher Mageia -V 'part save/rest' -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table .tmp
mkcd --addmd5 part_$action.iso
done
diff --git a/rescue/make_rescue_img b/rescue/make_rescue_img
index cf8c2f7e9..8e3f64334 100755
--- a/rescue/make_rescue_img
+++ b/rescue/make_rescue_img
@@ -15,21 +15,33 @@ BEGIN { undef *_ }
sub __ { print @_, "\n"; system(@_) }
sub _ { __ @_; $? and die }
+my $arch = arch() =~ /i.86/ ? $MDK::Common::System::compat_arch{arch()} : arch();
_ "rm -rf $tmp" if -e $tmp;
-_ "mkdir $tmp";
-_ 'find . -name "*~" | xargs rm -f';
-mkdir_p($tmp . chomp_($_)) foreach cat_("dirs");
+_ "mkdir -p $tmp";
_ "cp -a tree/* $tmp";
-_ "find $tmp -name .svn | xargs rm -rf";
-_ "perl devices.pl $tmp/dev";
-_ "mkfifo $tmp/dev/initctl";
+_ "find $tmp -name '*~' -delete";
+mkdir_p($tmp . chomp_($_)) foreach cat_("dirs");
+foreach (cat_("aliases")) {
+ chomp; my ($f, $dest) = split;
+ symlink $dest, "$tmp$f";
+}
+if ($arch eq "x86_64") {
+ _ "mkdir $tmp/usr/lib64";
+ _ "ln -s usr/lib64 $tmp/lib64";
+}
substInFile { s/DISTRIB_DESCR/$ENV{DISTRIB_DESCR}/ } "$tmp/etc/issue";
_ "../tools/install-xml-file-list list.xml $tmp";
+_ "sed 's/Mageia \\([0-9]*\\)/Mageia Rescue \\1/' /etc/os-release >$tmp/etc/os-release";
+_ "ls -1 $tmp/etc | sed 's,\\(.*\\),/etc/\\1,' >>$tmp/usr/share/symlinks";
+# Loading the floppy module causes this service to fail so lets mask this to
+# prevent a red "FAILED" briefly showing on the screen
+_ "sed -i s/ExecStart=/ExecStart=-/ $tmp/usr/lib/systemd/system/systemd-modules-load.service";
+
my %keytable_conflicts;
-my @less_important_keytables = qw(am_old am_phonetic no-dvorak);
-foreach (keyboard::loadkeys_files()) {
+my @less_important_keytables = qw(am_old am_phonetic no-dvorak de-latin1);
+foreach (keyboard::loadkeys_files(sub { warn @_ })) {
my ($dir, $fname) = (dirname($_), basename($_));
my ($name) = $fname =~ /(.*)\.map\.gz/ or next;
next if member($name, @less_important_keytables);
@@ -42,20 +54,14 @@ foreach (keyboard::loadkeys_files()) {
}
}
-foreach (cat_("aliases")) {
- chomp; my ($f, $dest) = split;
- symlink $dest, "$tmp$f";
-}
-
-
if (my ($LANGUAGE) = map { if_(/LANGUAGE_(.*)/, $1) } keys %ENV) {
substInFile {
$_ = "export LANGUAGE=$LANGUAGE\n" . "export LC_ALL=$LANGUAGE\n" if /^#LANGUAGE/;
- } "$tmp/etc/rc.sysinit";
+ } "$tmp/usr/bin/mageia-rescue";
}
exit 0 if $ARGV[0];
_ "mksquashfs $tmp $rescue -all-root -noappend >/dev/null";
_ "chmod 755 $rescue";
-_ "rm -rf $tmp";
+#_ "rm -rf $tmp";
diff --git a/rescue/partimage_whole_disk b/rescue/sbin/partimage_whole_disk
index ed0653a95..ed0653a95 100755
--- a/rescue/partimage_whole_disk
+++ b/rescue/sbin/partimage_whole_disk
diff --git a/rescue/tree/bin/insmod b/rescue/tree/bin/insmod
deleted file mode 100755
index 49b298142..000000000
--- a/rescue/tree/bin/insmod
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-echo "Use modprobe instead"
diff --git a/rescue/tree/etc/hostname b/rescue/tree/etc/hostname
new file mode 100644
index 000000000..344f71bc8
--- /dev/null
+++ b/rescue/tree/etc/hostname
@@ -0,0 +1 @@
+rescue
diff --git a/rescue/tree/etc/hosts b/rescue/tree/etc/hosts
index a9bbdee7f..d02c36416 100644
--- a/rescue/tree/etc/hosts
+++ b/rescue/tree/etc/hosts
@@ -1 +1 @@
-127.0.0.1 mandrake-rescue
+127.0.0.1 mageia-rescue
diff --git a/rescue/tree/etc/inittab b/rescue/tree/etc/inittab
deleted file mode 100644
index 771d7c0d4..000000000
--- a/rescue/tree/etc/inittab
+++ /dev/null
@@ -1,14 +0,0 @@
-#Inittab for Mandrake Rescue Disk
-#Author: Daouda Lo <daouda@mandrakesoft.com>
-id:3:initdefault:
-
-si::sysinit:/etc/rc.sysinit
-re:6:wait:/etc/rc.reboot
-ca:12345:ctrlaltdel:/sbin/fakeshutdown
-
-1:12345:respawn:/sbin/mingetty --autologin root tty1
-2:23:respawn:/sbin/mingetty tty2
-3:23:respawn:/sbin/mingetty tty3
-4:23:respawn:/sbin/mingetty tty4
-5:23:respawn:/sbin/mingetty tty5
-6:23:respawn:/sbin/mingetty tty6
diff --git a/rescue/tree/etc/issue b/rescue/tree/etc/issue
index 2bbd2b38a..11f9f3102 100644
--- a/rescue/tree/etc/issue
+++ b/rescue/tree/etc/issue
@@ -11,7 +11,7 @@
     [2[1;37;4
     
    
-    Mandriva Linux Rescue Disk
+    Mageia Linux Rescue Disk
     
     
    
@@ -24,5 +24,7 @@ Use loadkeys to change your keyboard layout (eg: loadkeys fr)
Use modprobe to load modules (eg: modprobe snd-card-fm801)
Use drvinst to install drivers according to detected devices
Use lsparts to list your partitions with types
+Use startssh to start an ssh daemon
Use rescue-gui to go back to the rescue menu
+Use grabjournallogs to grab the last 24 hours of journal logs
diff --git a/rescue/tree/etc/passwd b/rescue/tree/etc/passwd
index 568451e4e..c0274a116 100644
--- a/rescue/tree/etc/passwd
+++ b/rescue/tree/etc/passwd
@@ -1,3 +1,2 @@
-root::0:0::/:/bin/bash
-shutdown:*:6:0:shutdown:/sbin:/sbin/shutdown
-halt:*:7:0:halt:/sbin:/sbin/halt
+root::0:0::/root:/bin/bash
+messagebus:x:1:1::/:/sbin/nologin
diff --git a/rescue/tree/etc/profile b/rescue/tree/etc/profile
index 3b5ac21cc..17f0700dc 100644
--- a/rescue/tree/etc/profile
+++ b/rescue/tree/etc/profile
@@ -1,12 +1,12 @@
# /etc/profile
-# (c) Mandrakesoft, Chmouel Boudjnah <chmouel@mandrakesoft.com>
+# (c) Mandrakesoft, Chmouel Boudjnah <chmouel>
# System wide environment and startup programs
# Functions and aliases go in /etc/bashrc
PROFILE_LOADED=1
-export PATH=/usr/bin:/bin:/sbin:/usr/sbin:/usr/X11R6/bin
+PATH=/usr/bin:/bin:/sbin:/usr/sbin:/mnt/sbin:/mnt/bin:/mnt/usr/sbin:/mnt/usr/bin
PS1="[root@rescue \w]\\$ "
ls () { /bin/ls --color=auto -F "$@";}
diff --git a/rescue/tree/etc/rc.reboot b/rescue/tree/etc/rc.reboot
deleted file mode 100755
index 0b67416f1..000000000
--- a/rescue/tree/etc/rc.reboot
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-sleep 1
-/sbin/killall5 -9
-
-umount -a -f -t noproc
-
-reboot -i -d
diff --git a/rescue/tree/etc/rc.sysinit b/rescue/tree/etc/rc.sysinit
deleted file mode 100755
index 5bac9f4db..000000000
--- a/rescue/tree/etc/rc.sysinit
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/bin/sh
-
-action() { echo $1; shift; $*; }
-DATE=`date +%Y%m%d-%Hh%M`
-KADIR="/ka2"
-
-export PATH=/bin:/sbin:/usr/bin:/usr/sbin
-
-echo -e "\t\t\tWelcome to \\033[1;36mMandriva\\033[0;39m Linux"
-
-action "Remounting root filesystem in read-write mode" mount -n -o remount,rw /
-
-ln -s /tmp/stage2/etc/* /etc 2>/dev/null
-
-rm -f /dev ; cp -a /tmp/stage2/dev /dev
-
-mkdir -p /mnt /var/log
-
->/etc/mtab
-mount -f /
-mount -f /proc
-
-# Set the hostname.
-action "Setting hostname rescue" hostname rescue
-echo rescue > /etc/HOSTNAME
-
-# Loads common modules ( no kerneld :( )
-echo "Loading additional modules..."
-load() { modprobe $* 2>/dev/null; }
-load ide-disk
-load ide-cd_mod
-load floppy
-load af_packet
-load isofs
-load vfat
-load ext3
-load reiserfs
-load xfs
-load jfs
-load loop
-load sd_mod
-load sr_mod
-
-/sbin/ifconfig lo 127.0.0.1 netmask 255.0.0.0
-/sbin/route add 127.0.0.1 lo
-
-# disable the weird echoprt in cooked mode for user interaction:
-stty sane
-
-#LANGUAGE (filled by make_rescue_img)
-
-grep -q noauto /proc/cmdline || drvinst SERIAL_USB
-
-partimage_default_dir=/data/box
-partimage_dir=`perl -lne 'print $1 if /BOX=(\S+)/' /proc/cmdline`
-[ -z "$partimage_dir" ] && partimage_dir=$partimage_default_dir
-partimage_server=`perl -lne 'print $1 if /\bpserver=(\S+)/' /proc/cmdline`
-
-if grep -q save_all /proc/cmdline; then
- partimage_whole_disk -s $partimage_server save_all $partimage_default_dir
-elif grep -q rest_all /proc/cmdline; then
- if [ -d /tmp/image$partimage_dir ]; then
- partimage_whole_disk rest_all /tmp/image$partimage_dir
- else
- partimage_whole_disk -s $partimage_server rest_all $partimage_dir
- fi
-elif grep kamethod /proc/cmdline; then
- echo "Welcome to Ka"
- drvinst
- ln -sf /tmp/stage2/ka $KADIR
- ln -sf /tmp/stage2/disk /disk
- cd $KADIR
- echo "-------- Starting LOG server -------------"
- perl send_status.pl > /tmp/kacmd &
- exec ./ka_replication.sh > /tmp/ka_log-$HOSTNAME-$DATE 2>&1
-elif ! grep -q expert /proc/cmdline; then
- rescue-gui
-fi
diff --git a/rescue/tree/sbin/fakeshutdown b/rescue/tree/sbin/fakeshutdown
deleted file mode 100755
index 3511020ff..000000000
--- a/rescue/tree/sbin/fakeshutdown
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/perl
-
-#
-# Guillaume Cottenceau (gc@mandrakesoft.com)
-#
-# Copyright 2001 Mandrakesoft
-#
-# This software may be freely redistributed under the terms of the GNU
-# public license.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-
-sub cat_ { local *F; open F, $_[0] or $_[1] ? die "cat of file $_[0] failed: $!\n" : return; my @l = <F>; wantarray ? @l : join '', @l }
-
-print "\n";
-
-
-#- try to umount as much as possible; uses Pixel's ultra optimized algo (let you guess how it works..)
-print "Umounting:\n";
-my @mounts = cat_('/proc/mounts');
-my $something_moved;
-do {
- $something_moved = 0;
- foreach (@mounts) {
- my $where = (split)[1];
- next if $where eq '/'; #- ouch! umounting the ramdisk on / always succeeds, and makes it becoming ro :-(
- if (!system("umount $where 2>/dev/null")) {
- print "\t$where\n";
- $something_moved++;
- }
- }
-} while $something_moved;
-
-
-#- shutdown with init
-exec '/sbin/init', 6;
diff --git a/rescue/tree/sbin/modprobe b/rescue/tree/sbin/modprobe
deleted file mode 100755
index a9cd91a89..000000000
--- a/rescue/tree/sbin/modprobe
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/perl
-
-use lib qw(/usr/lib/libDrakX);
-use list_modules;
-use modules;
-
-# based on install::commands
-sub modprobe {
- !@_ || $_[0] =~ /^-?-h/ and die "usage: modprobe <module> [<options...>]\n";
- my $name = shift;
- list_modules::load_default_moddeps();
- modules::load_with_options([ $name ], { $name => join(' ', @_) });
-}
-
-$::isInstall = 1;
-modprobe(@ARGV);
diff --git a/rescue/tree/bin/login b/rescue/tree/usr/bin/login
index 4b2816926..4b2816926 100755
--- a/rescue/tree/bin/login
+++ b/rescue/tree/usr/bin/login
diff --git a/rescue/tree/usr/bin/mageia-rescue b/rescue/tree/usr/bin/mageia-rescue
new file mode 100755
index 000000000..7d8bb5135
--- /dev/null
+++ b/rescue/tree/usr/bin/mageia-rescue
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# Uncomment for debugging:
+# set -x
+
+systemctl start systemd-udevd
+udevadm trigger --type=subsystems --action=add
+udevadm trigger --type=devices --action=add
+
+# disable the weird echoprt in cooked mode for user interaction:
+stty sane
+
+#LANGUAGE (filled by make_rescue_img)
+
+grep -q noauto /proc/cmdline || drvinst SERIAL_USB
+
+partimage_default_dir=/data/box
+partimage_dir=`perl -lne 'print $1 if /BOX=(\S+)/' /proc/cmdline`
+[ -z "$partimage_dir" ] && partimage_dir=$partimage_default_dir
+partimage_server=`perl -lne 'print $1 if /\bpserver=(\S+)/' /proc/cmdline`
+
+LOOP=""
+if grep -q save_all /proc/cmdline; then
+ partimage_whole_disk -s $partimage_server save_all $partimage_default_dir
+elif grep -q rest_all /proc/cmdline; then
+ if [ -d /tmp/image$partimage_dir ]; then
+ partimage_whole_disk rest_all /tmp/image$partimage_dir
+ else
+ partimage_whole_disk -s $partimage_server rest_all $partimage_dir
+ fi
+elif grep -q oem /proc/cmdline; then
+ /tmp/image/oem-rescue.sh
+elif grep -q restore /proc/cmdline; then
+ /usr/sbin/restore-image.sh
+elif ! grep -q expert /proc/cmdline; then
+ rescue-gui && LOOP=y
+fi
+
+while [ "$LOOP" ]; do
+ bash --login
+ rescue-gui
+done
diff --git a/rescue/tree/usr/lib/CVS. b/rescue/tree/usr/lib/CVS.
deleted file mode 100644
index e69de29bb..000000000
--- a/rescue/tree/usr/lib/CVS.
+++ /dev/null
diff --git a/rescue/tree/usr/lib/modules-load.d/mageia-rescue.conf b/rescue/tree/usr/lib/modules-load.d/mageia-rescue.conf
new file mode 100644
index 000000000..9d9850baf
--- /dev/null
+++ b/rescue/tree/usr/lib/modules-load.d/mageia-rescue.conf
@@ -0,0 +1,8 @@
+ide-gd_mod
+ide-cd_mod
+floppy
+af_packet
+loop
+fuse
+sd_mod
+sr_mod
diff --git a/rescue/tree/usr/lib/restore-image-lib.sh b/rescue/tree/usr/lib/restore-image-lib.sh
new file mode 100755
index 000000000..3451f7be5
--- /dev/null
+++ b/rescue/tree/usr/lib/restore-image-lib.sh
@@ -0,0 +1,80 @@
+#!/bin/bash
+
+TITLE="%s Installer"
+BACKTITLE="%s"
+MIN_DISKSIZE=5000000
+
+debug="/dev/null"
+
+function _msgbox()
+{
+ dialog --timeout 60 --backtitle "$BACKTITLE" --title "$TITLE" --msgbox \
+ "$1" 0 0
+
+ return $?
+}
+
+function _infobox()
+{
+ dialog --backtitle "$BACKTITLE" --title "$TITLE" --sleep 2 \
+ --infobox "$1" 0 0
+
+ return $?
+}
+
+function _yesno()
+{
+ dialog --backtitle "$BACKTITLE" --title "$TITLE" \
+ --yes-label "Yes" --no-label "No" --yesno "$1" 0 0
+
+ return $?
+}
+
+function _mount()
+{
+ mount $1 $2 > $debug 2>&1
+
+ return $?
+}
+
+function _umount()
+{
+ umount $1 > $debug 2>&1
+
+ return $?
+}
+
+function _bind()
+{
+ mount --bind $1 $2 > $debug 2>&1
+
+ return $?
+}
+
+function _eject()
+{
+ eject $1 > $debug 2>&1
+
+ return $?
+}
+
+function _shutdown()
+{
+ [ -e /tmp/no-shutdown ] && exit
+ clear
+ sync
+ echo s > /proc/sysrq-trigger
+ echo o > /proc/sysrq-trigger
+ exit
+}
+
+function _reboot()
+{
+ [ -e /tmp/no-shutdown ] && exit
+ clear
+ sync
+ echo s > /proc/sysrq-trigger
+ echo b > /proc/sysrq-trigger
+ exit
+}
+
diff --git a/rescue/tree/usr/lib/systemd/system/rescue.service b/rescue/tree/usr/lib/systemd/system/rescue.service
new file mode 100644
index 000000000..336e06c22
--- /dev/null
+++ b/rescue/tree/usr/lib/systemd/system/rescue.service
@@ -0,0 +1,20 @@
+[Unit]
+Description=Mageia Rescue
+DefaultDependencies=no
+Conflicts=shutdown.target
+After=sysinit.target plymouth-start.service
+Before=shutdown.target
+
+[Service]
+Environment=HOME=/
+WorkingDirectory=/
+ExecStartPre=-/bin/plymouth quit
+ExecStart=/usr/bin/mageia-rescue
+ExecStopPost=-/usr/bin/systemctl --fail --no-block reboot
+Type=idle
+StandardInput=tty-force
+StandardOutput=inherit
+StandardError=inherit
+KillMode=process
+IgnoreSIGPIPE=no
+SendSIGHUP=yes
diff --git a/rescue/tree/usr/lib/systemd/system/systemd-udevd.service.d/dracut-rules.conf b/rescue/tree/usr/lib/systemd/system/systemd-udevd.service.d/dracut-rules.conf
new file mode 100644
index 000000000..b75df2e4e
--- /dev/null
+++ b/rescue/tree/usr/lib/systemd/system/systemd-udevd.service.d/dracut-rules.conf
@@ -0,0 +1 @@
+ExecStartPre=-/usr/bin/rm -f /etc/udev/rules.d/10-console.rules
diff --git a/rescue/tree/usr/sbin/diskdrake-resize b/rescue/tree/usr/sbin/diskdrake-resize
new file mode 100755
index 000000000..88372aac7
--- /dev/null
+++ b/rescue/tree/usr/sbin/diskdrake-resize
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+
+use lib qw(/usr/lib/libDrakX);
+
+use devices;
+use log;
+use resize_fat::main;
+use diskdrake::resize_ntfs;
+use diskdrake::resize_ext2;
+
+my ($device, $fs_type, $size) = @ARGV
+ or die "usage: $0 <device> <fs type> <size>\n";
+
+my %fs_pkgs = (
+ vfat => 'resize_fat::main',
+ ntfs => 'diskdrake::resize_ntfs',
+ ext2 => 'diskdrake::resize_ext2',
+ ext3 => 'diskdrake::resize_ext2',
+ ext4 => 'diskdrake::resize_ext2',
+);
+
+my $resize_pkg = $fs_pkgs{$fs_type}
+ or die "no support for $fs_type type\n";
+
+log::l("resizing $device to $size");
+
+my $resize = $resize_pkg->new($device, devices::make($device))
+ or die "unable to initialize resize\n";
+$resize->resize($size);
diff --git a/rescue/tree/usr/sbin/genpasswd b/rescue/tree/usr/sbin/genpasswd
new file mode 100755
index 000000000..2f129673d
--- /dev/null
+++ b/rescue/tree/usr/sbin/genpasswd
@@ -0,0 +1,13 @@
+#!/usr/bin/perl
+
+use strict;
+
+system "stty -echo";
+print STDERR "Give a password for ssh access: ";
+chomp(my $word = <STDIN>);
+print STDERR "\n";
+system "stty echo";
+
+my @salt = ('.', '/', 0..9, 'A'..'Z', 'a'..'z')[rand 64, rand 64];
+print crypt($word, join('', @salt));
+print "\n";
diff --git a/rescue/tree/usr/sbin/grabjournallogs b/rescue/tree/usr/sbin/grabjournallogs
new file mode 100755
index 000000000..ef2ea4a1d
--- /dev/null
+++ b/rescue/tree/usr/sbin/grabjournallogs
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+if ! mountpoint -q /mnt ; then
+ echo "I do not seem to see a Mageia install mounted on /mnt. You need to mount it first!" >&2
+ exit 1
+fi
+
+if [ ! -f /mnt/etc/machine-id ]; then
+ echo "Cannot find machine-id file (/mnt/etc/machine-id)" >&2
+ exit 1
+fi
+
+MID=$(cat /mnt/etc/machine-id)
+echo
+echo "Found machine-id: $MID"
+if [ ! -d /mnt/var/log/journal/$MID ]; then
+ echo "Cannot find journal log directory (/mnt/var/log/journal/<machine-id>)" >&2
+ exit 1
+fi
+
+TIMEFRAME=24
+if [ -n "$1" ]; then
+ NEWTIMEFRAME=$(( 0 + $1 ))
+ if [ $NEWTIMEFRAME -gt 0 ]; then
+ TIMEFRAME=$NEWTIMEFRAME
+ fi
+fi
+SINCE="$(LC_ALL=c date --date=$TIMEFRAME' hours ago' +'%F %T')"
+echo "Will collect logs from the last $TIMEFRAME hour(s)"
+echo " NB give numeric argument to override capture period"
+
+TEMPFILE=$(mktemp /tmp/grabjournallogs.XXXXXX)
+echo -n "Extracting logs... "
+journalctl -D /mnt/var/log/journal/$MID --since "$SINCE" -o short >$TEMPFILE
+echo "done"
+
+if [ $(cat $TEMPFILE | wc -l) -lt 2 ]; then
+ rm -f $TEMPFILE
+ echo >&2
+ echo "Cannot find any logs. Consider increasing the capture period by passing a" >&2
+ echo "numeric argument larger than $TIMEFRAME." >&2
+ exit 1
+fi
+
+echo -n "Compressing logs... "
+cat $TEMPFILE | xz >/journallogs.xz
+rm -f $TEMPFILE
+echo "done"
+
+echo
+echo "Your logs have been extracted to the file 'journallogs.xz'"
diff --git a/rescue/tree/usr/sbin/restore-image.sh b/rescue/tree/usr/sbin/restore-image.sh
new file mode 100755
index 000000000..f4f904f3f
--- /dev/null
+++ b/rescue/tree/usr/sbin/restore-image.sh
@@ -0,0 +1,412 @@
+#!/bin/bash
+
+setterm -powersave off
+setterm -blank 0
+
+if [ -r ./restore-image-lib.sh ]; then
+ . ./restore-image-lib.sh
+elif [ -r /usr/lib/restore-image-lib.sh ]; then
+ . /usr/lib/restore-image-lib.sh
+fi
+
+export PATH="/sbin:/bin:/usr/sbin:/usr/bin"
+
+mnt_dir="/tmp/mnt"
+restore_media="/tmp/media"
+images_dir="$restore_media/images"
+images="$images_dir/list"
+images_config="$images_dir/config"
+image=""
+win32_part_dev=
+win32_part_type=
+win32_part_new_size=
+
+function read_config()
+{
+ if [ -r "$images_config" ]; then
+ . $images_config
+ fi
+}
+
+function image_list()
+{
+ list=$(cat $images | awk -F',' \
+ '{ print $1 " " $2 " " $4 }')
+
+ echo $list
+}
+
+function image_file()
+{
+ country="$1"
+
+ file=$(grep ^$country $images | awk -F',' '{ print $3 }')
+
+ echo $file
+}
+
+function welcome()
+{
+ while true; do
+ clear
+ msg="\n Welcome to $TITLE\n\
+\nThe following images were found, select one:\n "
+ opcao=$(dialog --backtitle "$BACKTITLE" --title "$TITLE" \
+ --stdout --radiolist "$msg" 0 0 0 \
+ $(image_list))
+
+ if [ "$?" != "0" ]; then
+ _yesno "\nInterrupt installation?\n "
+ if [ "$?" = "0" ]; then
+ _shutdown
+ fi
+ else
+ if [ -z "$opcao" ]; then
+ continue
+ else
+ image=$(image_file $opcao)
+ break
+ fi
+ fi
+ done
+
+ # disable kernel messages in the console
+ echo "1 4 1 7" > /proc/sys/kernel/printk
+}
+
+function install_warning()
+{
+ if [ -n "${win32_part_dev}" ]; then
+ warn_msg="Windows installation detected.\nWe will set it up as dual boot. \
+You may lose some data.\nPlease backup before proceeding."
+ else
+ warn_msg="WARNING: This process will erase all data in this machine, \
+do you want to continue?"
+ fi
+
+ clear
+ _yesno "\n$warn_msg\n"
+ if [ "$?" != "0" ]; then
+ _shutdown
+ fi
+}
+
+function detect_root()
+{
+ inst_source_dev=$(awk "\$2 == \"$restore_media\" { print \$1 }" /proc/mounts | sed -e 's/[0-9]$//')
+ inst_source_dev=${inst_source_dev#/dev/}
+ devices=$(grep "^ .*[^0-9]$" < /proc/partitions | grep -v ${inst_source_dev} | awk '$3 > '$MIN_DISKSIZE' { print $4,$3 }')
+
+ if [ -z "${devices}" ]; then
+ exit 1
+ fi
+
+ devs_found=$(($(echo $devices | wc -w)/2))
+
+ root_data=$(detect_win32 ${inst_source_dev})
+
+ if [ -z "${root_data}" ]; then
+ if [ "$devs_found" -gt "1" ]; then
+ if [ -n "${inst_source_dev}" ]; then
+ opcao=$(dialog --backtitle "$BACKTITLE" --title "$TITLE" --stdout --menu 'Choose one of the detected devices to restore to (check the blocks size column first):' 8 50 0 $devices )
+ if [ "$?" != "0" ]; then
+ _yesno "\nInterrupt installation?\n "
+ if [ "$?" = "0" ]; then
+ _shutdown
+ fi
+ else
+ root_data=${opcao}
+ fi
+ fi
+ else
+ root_data=$(echo ${devices} | cut -d ' ' -f 1)
+ fi
+ fi
+
+ echo ${root_data}
+}
+
+function detect_win32()
+{
+ # from detect_root()
+ skip_dev=${1}
+
+ # win32 detection won't handle complex layouts
+ if [ $(fdisk -l | grep "^/dev/" | grep -v ${skip_dev} | wc -l) -gt 1 ]; then
+ exit
+ fi
+
+ # get the last created windows partition information
+ set -f
+ device=$(fdisk -l | grep "^/dev/" | grep -v ${skip_dev} | grep -e "FAT\|NTFS\|HPFS" | tail -1 | sed 's/ .*$//')
+ set +f
+
+ if [ -z "${device}" ]; then
+ exit
+ fi
+
+ # it might be needed, for safety
+ device_type=$(blkid -o value -s TYPE ${device})
+ modprobe ${device_type}
+
+ # df for that partition
+ mount ${device} /mnt
+ size=$(df ${device} | tail -1)
+ umount /mnt
+
+ # its diskspace
+ used=$(echo ${size} | awk '{ print $3 }')
+ left=$(echo ${size} | awk '{ print $4 }')
+ avail=$((${left}/2))
+
+ if [ ! ${avail} -lt ${MIN_DISKSIZE} ]; then
+ win32_part_dev=${device}
+ win32_part_type=${device_type}
+ # our install takes half of 'left'
+ win32_part_new_size=$((${used}+${avail}))
+
+ dev=${win32_part_dev#/dev/}
+ disk=${dev%[0-9]}
+ number=${dev#[a-w][a-w][a-w]}
+ let number++
+ echo ${disk}${number} ${win32_part_dev} ${win32_part_type} ${win32_part_new_size}
+ fi
+}
+
+function resize_win32()
+{
+ device=${1}
+ device_type=${2}
+ new_win32_size=${3}
+
+ dialog --backtitle "$BACKTITLE" --title "$TITLE" --infobox "\nResizing Windows partition...\n" 4 55
+
+ dev=${device#/dev/}
+ disk=${dev%[0-9]}
+ win32_number=${dev#[a-w][a-w][a-w]}
+
+ case ${device_type} in
+ vfat) device_id=b ;;
+ ntfs) device_id=7 ;;
+ hpfs) device_id=87 ;;
+ esac
+
+ # wrapper around libdrakx by blino
+ diskdrake-resize ${device} ${device_type} $((${new_win32_size}*2)) &>/dev/null
+
+ # we need some free sector here, rebuilding layout
+ fdisk /dev/${disk} &>/dev/null <<EOF
+d
+n
+p
+${win32_number}
+
++${new_win32_size}K
+t
+${device_id}
+a
+${win32_number}
+w
+EOF
+ # adds linux partition to the end of the working disk
+ fdisk /dev/${disk} &>/dev/null <<EOF
+n
+p
+$((${win32_number}+1))
+
++${MIN_DISKSIZE}K
+t
+$((${win32_number}+1))
+83
+w
+EOF
+}
+
+function detect_device()
+{
+ dialog --backtitle "$BACKTITLE" --title "$TITLE" --infobox "\nTrying to detect your root partition and disk...\n" 4 55
+
+ root_data=$(detect_root)
+ if [ -z "${root_data}" ]; then
+ _msgbox "\nError writing image: disk device not detected.\n"
+ # so that netbooks using USB sticks as disks can retry (like Gdium)
+ welcome
+ root_data=$(detect_root)
+ fi
+ set ${root_data}
+ root=$1
+ win32_part_dev=$2
+ win32_part_type=$3
+ win32_part_new_size=$4
+}
+
+function write_image()
+{
+ if [ -n "${win32_part_dev}" ]; then
+ resize_win32 ${win32_part_dev} ${win32_part_type} ${win32_part_new_size}
+ fi
+
+ image=$(cat $images_dir/list | cut -d ',' -f 3)
+ extension=${image/*./}
+ imagesize=$(ls -l $images_dir/$image | awk '{ print $5 }')
+ case $extension in
+ gz)
+ uncomp=zcat
+ total=$(gzip -l $images_dir/$image | tail -n 1 | awk '{ print $2 }')
+ ;;
+ bz2)
+ uncomp=bzcat
+ total=$((imagesize * 3))
+ ;;
+ *)
+ uncomp=cat
+ total=$imagesize
+ ;;
+ esac
+
+ skipstart=/bin/true
+ if [ -n "$win32_part_dev" ]; then
+ skipstart='dd of=/dev/null bs=1 count=32256'
+ fi
+
+ # the actual dumping command, from image to disk
+ ${uncomp} ${images_dir}/${image} | (${skipstart} &>/dev/null; dd bs=4M of=/dev/${root} >/tmp/backup.out 2>&1>>/tmp/log) &
+
+ sleep 3
+ pid=$(ps ax | grep 'dd bs=4M of' | grep -v grep | awk '{ print $1 }')
+
+ while [ true ]; do
+ ps | grep -q $pid
+ if [ $? -eq 0 ]; then
+ /bin/kill -SIGUSR1 $pid
+ complete=$(tail -n 1 /tmp/backup.out | awk '{ print $1 }')
+ echo $((complete*100/total))
+ sleep 1
+ else
+ break
+ fi
+ done | dialog --backtitle "$BACKTITLE" --title "$TITLE" --gauge "\nWriting image..." 8 45
+
+ in=$(tail -n 3 /tmp/backup.out | grep 'in$' | cut -d' ' -f1)
+ out=$(tail -n 3 /tmp/backup.out | grep 'out$' | cut -d' ' -f1)
+
+ if [ x"$in" != x"$out" ]; then
+ _msgbox "\nError writing image!\n"
+ sleep 24h
+ fi
+
+ # Now re-read the partition table because 'dd' might have changed it
+ sfdisk -R /dev/${root}
+}
+
+function grub_setup()
+{
+ root=${1}
+ grub_dir=${2}
+
+ # install the bootloader
+ grub <<EOF
+device (hd0) /dev/${root%[0-9]}
+root (hd0,1)
+setup (hd0)
+quit
+EOF
+ # change the partition order and boot timeout accordingly
+ sed -i 's/(hd0,0)/(hd0,1)/g;/^timeout/s/$/0/' ${grub_dir}/menu.lst
+
+ # dualboot configuration for grub
+ cat >> ${grub_dir}/menu.lst <<EOF
+title Microsoft Windows
+root (hd0,0)
+makeactive
+rootnoverify(hd0,0)
+chainloader +1
+EOF
+}
+
+function expand_fs()
+{
+ if [ -z "$win32_part_dev" ]; then
+ if [ -n "$MAIN_PART_NUMBER" ]; then
+ part_number=$MAIN_PART_NUMBER
+ else
+ part_number=1
+ fi
+ root=${root%[0-9]}$part_number
+ fi
+ filesystem_type=$(dumpe2fs -h /dev/${root} 2>/dev/null| grep "Filesystem OS type" | awk '{ print $4 }')
+ if [ "${filesystem_type}" = "Linux" ]; then
+ dialog --backtitle "$BACKTITLE" --title "$TITLE" --infobox "Finishing Install... Expanding ${root}" 3 40
+ disk=/dev/${root%[0-9]}
+ main_part=/dev/${root}
+
+ # FIXME: absurdly dirty hack
+ main_part_num=${root:3}
+ swap_part_num=$((main_part_num+1))
+ swap_part=${disk}${swap_part_num}
+
+ main_part_sectors=
+ if [ -n "$SWAP_BLOCKS" ]; then
+ if [ -n "$EXPAND_FS" ]; then
+ total_blocks=$(sfdisk -s $disk)
+ main_part_blocks=$((total_blocks-SWAP_BLOCKS))
+ main_part_sectors=$((main_part_blocks*2))
+ else
+ main_part_sectors=$(sfdisk -d $disk | perl -lne 'm|^'$main_part'\b.*,\s*size\s*=\s*(\d+)\b| and print($1), exit')
+ fi
+ fi
+ if [ -n "$SWAP_BLOCKS" ]; then
+ parted $disk -- mkpartfs primary linux-swap ${main_part_sectors}s -1s yes
+ mkswap -L swap $swap_part
+ fi
+ if [ -n "$EXPAND_FS" ]; then
+ e2fsck -fy $main_part
+ fdisk $disk << EOF
+d
+$main_part_num
+n
+p
+$main_part_num
+
+
+a
+$main_part_num
+w
+EOF
+ sfdisk -R $disk
+ e2fsck -fy $main_part
+ resize2fs $main_part
+ fi
+ mkdir -p $mnt_dir
+ mount $main_part $mnt_dir
+ grub_dir="$mnt_dir/boot/grub"
+ if [ -d "$grub_dir" ]; then
+ echo "(hd0) $disk" > "$grub_dir/device.map"
+ if [ -n "$win32_part_dev" ]; then
+ grub_setup ${root} ${grub_dir}
+ fi
+ fi
+ if [ -n "$MKINITRD" ]; then
+ mount -t sysfs none "$mnt_dir/sys"
+ mount -t proc none "$mnt_dir/proc"
+ chroot $mnt_dir bootloader-config --action rebuild-initrds
+ umount "$mnt_dir/sys"
+ umount "$mnt_dir/proc"
+ fi
+ umount $mnt_dir
+ fi
+}
+
+# installation steps
+welcome
+read_config
+detect_device
+install_warning
+write_image
+expand_fs
+
+# all done!
+_msgbox "\nInstallation process finished.\nPress ENTER to shutdown.\n "
+
+_shutdown
+
diff --git a/rescue/tree/usr/sbin/startssh b/rescue/tree/usr/sbin/startssh
new file mode 100755
index 000000000..e14bb10e8
--- /dev/null
+++ b/rescue/tree/usr/sbin/startssh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+# test for an up interface != lo
+if test "x"`ifconfig | cut -d ' ' -f 1 | grep -v '^$' | grep -v lo` = "x"; then
+ echo "There is no up interface, you can try to execute 'drvinst' to find drivers and 'dhcp-client' to configure your interface for DHCP." >&2
+ exit 5
+fi
+
+# generate host keys
+mkdir -p /etc/dropbear
+[[ -f /etc/dropbear/dropbear_dss_host_key ]] || dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key >/dev/null || { echo "Can't generate dsa host key" >&2 ; exit 4; }
+[[ -f /etc/dropbear/dropbear_rsa_host_key ]] || dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key >/dev/null || { echo "Can't generate rsa host key" >&2 ; exit 3; }
+
+# set a password
+passwd=`genpasswd`
+if (( $? != 0 )); then
+ reset
+ exit $?
+fi
+sed -E -i -e 's/^root:[^:]*:/root:'"${passwd//\//\\/}"':/' /etc/passwd || { echo "Can't set password" >&2 ; exit 2; }
+
+# test for /dev/pts
+grep '^devpts /dev/pts devpts ' /proc/mounts >/dev/null 2>/dev/null || mount -t devpts devpts /dev/pts
+
+echo ""
+echo -n "Starting ssh daemon... "
+dropbear -E 2>/var/log/dropbear.log && echo "OK" || { echo "Failed" ; exit 1; }
diff --git a/rescue/tree/usr/share/symlinks b/rescue/tree/usr/share/symlinks
deleted file mode 100644
index 5862fb8ac..000000000
--- a/rescue/tree/usr/share/symlinks
+++ /dev/null
@@ -1,10 +0,0 @@
-/bin
-/boot
-/dev
-/etc/fstab
-/etc/inittab
-/etc/rc.sysinit
-/lib
-/lib64
-/sbin
-/usr