Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37893755
en ru br
ALT Linux repositórios
S:0.47-alt1
5.0: 0.7-alt1
4.1: 0.6-alt0.M41.1
4.0: 0.4.2-alt1

Group :: Sistema/Base
RPM: startup-rescue

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

rescue-0.7/000075500000000000000000000000001116735010600126445ustar00rootroot00000000000000rescue-0.7/find-fstab000075500000000000000000000027731116735010600146200ustar00rootroot00000000000000#!/bin/sh -efu

. shell-error

## Volume manager specific functions

fstype() {
[ "$#" -eq 1 -a -n "$1" ] || return 1
local fs= fsinfo="`evms_query info "$1" |sed -n -e 's/^Filesystem: //p'`"
case "$fsinfo" in
ReiserFS) fs="reiserfs" ;;
Ext2/3) fs="ext2 ext3" ;;
XFS) fs="xfs" ;;
JFS) fs="jfs" ;;
*) return 1 ;;
esac
echo "$fs"
}

volumes() {
evms_query volumes
}

## Functions

usage() {
echo "Usage: $PROG [--help|--list-only|<outdir>]" >&2
exit 1
}

workdir=
exit_handler() {
local rc=$?
trap - EXIT
if cut -d' ' -f2 /proc/mounts |fgrep -xqs "$workdir"; then
umount -l "$workdir"
fi
[ ! -d "$workdir" ] || rm -rf -- "$workdir"
exit $rc
}

listonly=
outdir=
i=0
fstab_list() {
local v fs fslist success
for v in `volumes`; do
fslist="`fstype "$v"`" && [ -n "$fslist" ] || continue

success=
for fs in $fslist; do
modprobe -b $fs ||:
mount -t "$fs" -oro "$v" "$workdir" >/dev/null 2>&1 && success=1 ||:
done

[ -n "$success" ] || continue

if [ ! -f "$workdir/etc/fstab" ]; then
umount -l "$workdir"
continue
fi

i="$(($i+1))"
[ -z "$listonly" ] &&
cp -- "$workdir/etc/fstab" "$outdir/fstab.$i" ||
echo "File /etc/fstab found on volume '$v'"
umount -l "$workdir"
done
}

[ "$#" -eq 1 ] || usage

if [ "$1" = "--list-only" ]; then
listonly=1
elif [ "$1" = "--help" ]; then
usage
else
outdir="`readlink -ev "$1"`"
fi

trap exit_handler HUP PIPE INT QUIT TERM EXIT
workdir="`mktemp -dt "$PROG.XXXXXXXXXX"`"
fstab_list

[ "$i" -gt 0 ] && rc=0 || rc=1
exit $rc
rescue-0.7/fixmbr000075500000000000000000000030311116735010600140560ustar00rootroot00000000000000#!/bin/bash

verbose(){
[ -n "$verbose" ] && echo $@
}

show_help(){
cat <<'EOF'
fixmbr - restore MBR erased by Microsoft Windows (TM)

Usage: fixmbr [options]

Options:
-e, --edit start editor for manusl editing lilo.conf;
-v, --verbose be more verbose;
-h, --help show this text and exit.

Set $EDITOR variable to change an editor for manual lilo.conf editing

Report bugs to http://bugzilla.altlinux.ru/

EOF
exit
}

[ -z "$EDITOR" ] && EDITOR=/usr/bin/mcedit

TEMP=`getopt -n fixmbr -o v,h,e -l verbose,help,edit -- "$@"` || show_help
eval set "--" $TEMP

while :; do
case "$1" in
-v|--verbose) verbose=-v
;;
-h|--help) show_help
;;
-e|--edit) edit=1
;;
--) shift; break;
;;
esac
shift
done

verbose "Mounting partitions"
mount-system

for system in /mnt/system* ; do
if grep -q 'boot="/dev/disk/by-id"' $system/etc/lilo.conf || grep -q 'boot="/dev/[^0-9]*"' $system/etc/lilo.conf ; then
device=$(grep 'boot="/dev/"' $system/etc/lilo.conf |
sed 's/.*"\/dev\/\(.*\)"/\1/')
seen=$(eval "echo \$$device")
if [ -z "$seen" ] ; then
if [ -n "$edit" ] ; then
verbose "Starting editor..."
$EDITOR $system/etc/lilo.conf
fi
verbose running lilo for $system
if chroot $system lilo ; then
eval "$device=done"
ok=yes
fi
fi
fi
done

if [ -z "$ok" ] ; then
verbose "Automatic fixing failed, starting editor..."
$EDITOR $system/etc/lilo.conf
verbose running lilo for $system
chroot $system lilo
fi
rescue-0.7/inittab.rescue000064400000000000000000000026751116735010600155200ustar00rootroot00000000000000# The default runlevel.
id:3:initdefault:

# Boot-time system configuration/initialization script.
# This is run first except when booting in emergency (-b) mode.
si::sysinit:/etc/rc.d/rc.sysinit.rescue

# /etc/rc.d/rc executes the S and K scripts upon change of runlevel.
#
# Runlevel 0 is halt.
# Runlevel 1 is single-user.
# Runlevels 2-5 are multi-user.
# Runlevel 6 is reboot.

l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6

# Normally not reached, but fallthrough in case of emergency.
z6:6:respawn:/sbin/sulogin

# What to do when CTRL-ALT-DEL is pressed.
ca:012345:ctrlaltdel:/sbin/shutdown -t3 -r now

# Action on special keypress (ALT-UpArrow).
kb::kbrequest:/bin/echo "Keyboard Request -- edit /etc/inittab to let this work."

# What to do when the power fails/returns.
pf::powerwait:/etc/rc.d/rc.powerfail start
pn::powerfailnow:/etc/rc.d/rc.powerfail now
po::powerokwait:/etc/rc.d/rc.powerfail stop

# Format:
# <id>:<runlevels>:<action>:<process>
1:2345:respawn:/bin/openvt -elfw -c 1 -- /usr/bin/rescue-shell
2:2345:respawn:/bin/openvt -elfw -c 2 -- /usr/bin/rescue-shell
3:2345:respawn:/bin/openvt -elfw -c 3 -- /usr/bin/rescue-shell
4:2345:respawn:/bin/openvt -elfw -c 4 -- /usr/bin/rescue-shell
5:2345:respawn:/bin/openvt -elfw -c 5 -- /usr/bin/rescue-shell
6:2345:respawn:/bin/openvt -elfw -c 6 -- /usr/bin/rescue-shell
rescue-0.7/mount-fstab000075500000000000000000000031471116735010600150360ustar00rootroot00000000000000#!/bin/sh -efu

. shell-error
. shell-args

TEST=

show_help() {
local rc="${1:-0}"
cat <<EOF

$PROG - mount a file system via fstab in specifed mountpoint

Usage: $PROG [options] <fstab> <mount-point>

Options:
--dry-run
-q, --quiet Try to be more quiet.
-v, --verbose Print a message for each action.
-V, --version print program version and exit.
-h, --help Show this message.

EOF
exit "$rc"
}

workdir=
exit_handler() {
local rc=$?
trap - EXIT
[ ! -d "$workdir" ] || rm -rf -- "$workdir"
exit $rc
}

TEMP=`getopt -n $PROG -o $getopt_common_opts -l dry-run,$getopt_common_longopts -- "$@"` || show_usage
eval set -- "$TEMP"
while :; do
case "$1" in
--dry-run) TEST=message
;;
--) shift; break
;;
*) parse_common_option "$1"
;;
esac
shift
done

[ "$#" -eq 2 ] || show_usage
fstab="`readlink -ev "$1"`"
dstdir="`readlink -ev "$2"`"

trap exit_handler HUP PIPE INT QUIT TERM EXIT
workdir="`mktemp -dt "$PROG.XXXXXXXXXX"`"

sed -e '\,[[:space:]]*#,d' \
-e '\,^[[:space:]]*[^[:space:]]\+[[:space:]]\+/,!d' \
-e 's/[[:space:]]\+/ /g' "$fstab" |
sort -k2,2 -so "$workdir/fstab"

while read dev mpoint fstype opts dummy; do
if printf %s "$opts" |grep -qs '\<noauto\>'; then
continue
fi

case "$fstype" in
ext2|ext3|reiserfs|xfs|jfs)
modprobe -b "$fstype"
;;
*)
continue
;;
esac

cmd="mount -t '$fstype' -o '$opts'"

case "$dev" in
LABEL=*) cmd="$cmd -L '${dev#LABEL=}'" ;;
UUID=*) cmd="$cmd -U '${dev#UUID=}'" ;;
*) cmd="$cmd $dev" ;;
esac

$TEST mkdir -p -- "$dstdir$mpoint"
$TEST eval $cmd "$dstdir$mpoint"

done < "$workdir/fstab"
rescue-0.7/mount-system000075500000000000000000000012071116735010600152560ustar00rootroot00000000000000#!/bin/sh -eu

. shell-error

workdir=
exit_handler() {
local rc=$?
trap - EXIT
[ ! -d "$workdir" ] || rm -rf -- "$workdir"
exit $rc
}

trap exit_handler HUP PIPE INT QUIT TERM EXIT
workdir="`mktemp -dt "$PROG.XXXXXXXXXX"`"

mountpoint -q /mnt || mount -o rw -t tmpfs tmpfs /mnt

find-fstab "$workdir" || fatal "No fstab found"
cd "$workdir"

for fstab in fstab.*; do
[ "$fstab" != "fstab.*" ] || break
mpoint="/mnt/system${fstab##*.}"
mkdir -p -- "$mpoint"
if mount-fstab "$fstab" "$mpoint"; then
message "$mpoint: done"
fi
mount --bind /proc "$mpoint/proc"
mount --bind /sys "$mpoint/sys"
mount --bind /dev "$mpoint/dev"
done
cd -
rescue-0.7/rc.sysinit.rescue000075500000000000000000000140371116735010600161710ustar00rootroot00000000000000#!/bin/sh
# Based on rc.sysinit from startup-0.9.8.10-alt1

# Don't do coredumps
ulimit -Sc 0 >/dev/null 2>&1

trap '' SIGPIPE

WITHOUT_RC_COMPAT=1

# Source function library
. /etc/init.d/functions

action_begin_msg()
{
[ -z "$*" ] || printf '%s ' "$*"
}

action_end_msg()
{
local rc=$1
if [ "$BOOTUP" = color ]; then
[ $rc = 0 ] && echo_success || echo_failure
fi
echo
}

unset action
action()
{
action_begin_msg "$1"
shift
$*
local rc=$?
action_end_msg "$rc"
return $rc
}

# Fix console loglevel
dmesg -n "$LOGLEVEL"

HOSTNAME=`hostname`

# Read in config data
if ! SourceIfNotEmpty /etc/sysconfig/network; then
NETWORKING=no
fi

if [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" ]; then
HOSTNAME=localhost
fi

# Set system font
ExecIfExecutable /sbin/setsysfont >/dev/null 2>&1 && SETSYSFONT_DONE=1 || SETSYSFONT_DONE=

PrintMargin()
{
[ "$BOOTUP" != serial ] || return 0
local n
n="`printf %s "$*" |wc -c`" 2>/dev/null &&
tput hpa $(( ($COLUMNS - $n)/2 ))
}

WELCOME="Welcome to "
BANNER="ALT Linux (rescue)"
PrintMargin "$WELCOME$BANNER"
printf %s "$WELCOME"
SETCOLOR_INFO
printf %s "$BANNER"
SETCOLOR_NORMAL
echo

# Mount /proc (done here so volume labels can work with fsck)
action "Mounting proc filesystem:" mount -n -t proc proc /proc

# Mount /sys where appropriate
if grep -wqs sysfs /proc/filesystems; then
action "Mounting sys filesystem:" mount -n -t sysfs sysfs /sys
fi

action "Mounting tmpfs filesystem [/tmp]:" mount -t tmpfs tmpfs /tmp

remount_aufs() {
[ -d "$1" ] || return 0
mkdir -p -- "/tmp/root$1"
mount -n -taufs -o dirs="/tmp/root$1=rw:$1=ro" "/tmp/root$1" "$1"
}

for mpoint in /etc /var /lib /bin /sbin /home /root /mnt; do
action "Mounting '$mpoint' to overlay:" remount_aufs "$mpoint"
done

# Generate blacklist for udev
if [ -d /etc/modprobe.d ] && grep -iqs 'blacklist=' /proc/cmdline; then
sed -n -e 's/^.*blacklist=\([^= ]\)\( .*\|\$\)/\1/p' /proc/cmdline |
tr -s ':,' '\n' |
while read kmodule; do
echo "blacklist ${kmodule%.ko}"
done >> /etc/modprobe.d/local-blacklist
fi

RUN_UDEV=
udevd_exe=/etc/init.d/udevd
[ ! -x "$udevd_exe" ] ||
grep -iwqs noudev /proc/cmdline ||
RUN_UDEV=1

# Start udev
if [ -n "$RUN_UDEV" ]; then
RUN_FROM_SYSINIT=1 "$udevd_exe" start
[ -c /dev/rtc ] || modprobe -b rtc >/dev/null 2>&1
fi

# Find swap partitions and add them to /etc/fstab
sfdisk -l 2>/dev/null |
sed \
-e '/\/dev/!d' \
-e 's/[[:space:]]\+/ /g' \
-e 's/^\(\/dev\/[^[:space:]]\+\) \([[:digit:]]\)/\1 x \2/' |
while read dev boot start end blocks id system; do
[ "$id" = "82" ] || continue
printf "%s swap swap defaults 0 0\n" "$dev"
done >> /etc/fstab

# Activate swap
action "Activating swap partitions:" swapon -a -e

# Set the hostname
action "Setting hostname $HOSTNAME:" hostname "$HOSTNAME"

# Set the NIS domain name
if [ -n "$NISDOMAIN" ] && ! is_no "$NISDOMAIN"; then
action "Setting NIS domain name $NISDOMAIN:" domainname "$NISDOMAIN"
fi

# Clear mtab
[ -L /etc/mtab ] || >/etc/mtab

# Remove stale backups
rm -f /etc/mtab~ /etc/mtab~~

# Enter root and /proc into mtab. (pixel) also added /initrd/loopfs for loopback root
mount -f /proc
[ -d /sys/bus ] && mount -f -t sysfs sysfs /sys
[ -f /proc/bus/usb/devices ] && mount -f -t usbfs usbfs /proc/bus/usb
! mountpoint -q /dev || mount -f -t tmpfs udevfs /dev
! mountpoint -q /dev/pts || mount -f -t devpts devpts /dev/pts
! mountpoint -q /dev/shm || mount -f -t tmpfs shmfs /dev/shm
! mountpoint -q /tmp || mount -f -t tmpfs tmpfs /tmp

# Set hard disk parameters
/etc/rc.d/scripts/idetune

echo "$HOSTNAME" >/etc/HOSTNAME

# Configure kernel parameters
action "Configuring kernel parameters:" sysctl -e -p /etc/sysctl.conf

if [ -z "$USEMODULES" ]; then
if [ -f /proc/ksyms -o -f /proc/kallsyms ] &&
! fgrep -iwqs nomodules /proc/cmdline; then
USEMODULES=y
else
USEMODULES=n
fi
fi

if [ -f /proc/sys/kernel/modprobe ]; then
if is_yes "$USEMODULES"; then
if [ -z "$RUN_UDEV" ]; then
sysctl -w kernel.modprobe="/sbin/modprobe" >/dev/null 2>&1
sysctl -w kernel.hotplug="/sbin/hotplug" >/dev/null 2>&1
fi
else
# We used to set this to NULL, but that causes 'failed to exec' messages"
sysctl -w kernel.modprobe="/bin/true" >/dev/null 2>&1
sysctl -w kernel.hotplug="/bin/true" >/dev/null 2>&1
fi
fi

OLD_COLUMNS="$COLUMNS"

# Load modules
/etc/rc.d/scripts/load_modules

# Load framebuffer device settings
/etc/rc.d/scripts/framebuffer_init

# Set system font again, if required
if [ "$OLD_COLUMNS" != "$COLUMNS" ]; then
ExecIfExecutable /sbin/setsysfont >/dev/null 2>&1 && SETSYSFONT_DONE=1 || SETSYSFONT_DONE=
fi

# Load device-mapper, create its device file
if [ -e /proc/devices -a -e /proc/misc ]; then
rm -f /dev/mapper/control
modprobe -b dm-mod >/dev/null 2>&1
if [ -z "$RUN_UDEV" ]; then
MAJOR="$(sed -ne 's/^ *\([0-9]\+\) \+misc$/\1/p' /proc/devices)"
MINOR="$(sed -ne 's/^ *\([0-9]\+\) \+device-mapper$/\1/p' /proc/misc)"
if [ -n "$MAJOR" -a -n "$MINOR" ]; then
mkdir -p -m755 /dev/mapper
action "Creating device-mapper character device ($MAJOR, $MINOR):" \
mknod --mode=600 /dev/mapper/control c "$MAJOR" "$MINOR"
fi
unset MAJOR MINOR
fi
fi

# Activate EVMS
EVMS_ACTIVE=
STARTEVMS=/sbin/startevms
if [ -x "$STARTEVMS" ] && ! grep -iwqs noevms /proc/cmdline; then
action "Starting up EVMS:" "$STARTEVMS" init
EVMS_ACTIVE=1
fi

#VGSCAN=/sbin/vgscan
#VGCHANGE=/sbin/vgchange
#if [ -e "$VGCHANGE" -a -e "$VGSCAN" -a -c /dev/mapper/control ] && ! grep -iwqs nolvm /proc/cmdline; then
# modprobe dm-mod >/dev/null 2>&1
# "$VGSCAN" >/dev/null 2>&1
# action "Setting up LVM2:" "$VGCHANGE" -a y
#fi

MBRRESC=/sbin/fixmbr
if [ -e "$MBRRESC" ] && grep -iwqs fixmbr /proc/cmdline; then
action "Restore MBR:" "$MBRRESC"
if [ "$?" -eq "0" ]; then
# MBR successfully restored
printf "reboot in 10 seconds..."
sleep 10 && reboot
fi
fi

# Language fixes
/etc/rc.d/scripts/lang

# If they asked for ide-scsi, load it
if grep -iwqs ide-scsi /proc/cmdline; then
modprobe -b ide-cd >/dev/null 2>&1
modprobe -b ide-scsi >/dev/null 2>&1
fi

if [ -x /usr/sbin/update_chrooted ]; then
action "Updating chrooted environments:" /usr/sbin/update_chrooted conf lib
fi
rescue-0.7/rescue-shell000064400000000000000000000002241116735010600151600ustar00rootroot00000000000000#!/bin/sh

echo 'Welcome to rescue shell'
echo -e 'To restore Linux bootloader run \033[1mfixmbr\033[0m'

HOME=/root
export HOME

exec /bin/bash -l
rescue-0.7/sysreport.init000075500000000000000000000007361116735010600156140ustar00rootroot00000000000000#!/bin/sh
#
# Run sysreport
#
# chkconfig: 2345 99 01
# description: This service gathers system information via system-report.

WITHOUT_RC_COMPAT=1

# Source function library.
. /etc/init.d/functions

LOCKFILE=/var/lock/subsys/sysreport

case "$1" in
start|restart|reload)
# This action line is required to fool rc script.
system-report -o "/root/sysreport-$(date +"%Y%m%d").tar.bz2"
touch "$LOCKFILE"
;;
stop|condstop)
rm -f "$LOCKFILE"
;;
*)
;;
esac

exit 0
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009