Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37413490
en ru br
Репозитории ALT

Группа :: Система/Основа
Пакет: make-initrd-propagator

 Главная   Изменения   Спек   Патчи   Исходники   Загрузить   Gear   Bugs and FR  Repocop 

pax_global_header00006660000000000000000000000064122701532030014505gustar00rootroot0000000000000052 comment=16f75f292c2b96f912490734e0ffceeec858d51f
make-initrd-propagator-0.23/000075500000000000000000000000001227015320300160075ustar00rootroot00000000000000make-initrd-propagator-0.23/.gear-rules000064400000000000000000000000071227015320300200530ustar00rootroot00000000000000tar: .
make-initrd-propagator-0.23/make-initrd-propagator.spec000064400000000000000000000110751227015320300232470ustar00rootroot00000000000000Name: make-initrd-propagator
Version: 0.23
Release: alt1

Summary: Put propagator into make-initrd generated image
License: GPL
Group: System/Base

Source0: %name-%version.tar

Requires: console-vt-tools fdisk /sbin/addpart grep
Requires: aufs2-util sysvinit-utils net-tools
Requires: sed procps psmisc findutils nfs-utils
Requires: make-initrd
Requires: e2fsprogs
Requires: udev-rules udev-extras

# For new put-file utility
Requires: make-initrd >= 0.7.6-alt1

BuildArch: noarch
AutoReq: noshell, noshebang


%description
Make-initrd feature, able to make hybrid propagator/make-initrd initrd

%prep
%setup

%install
mkdir -p %buildroot%_datadir/make-initrd/features/
cp -a propagator %buildroot%_datadir/make-initrd/features/
mkdir -p %buildroot%_datadir/make-initrd/features/propagator/data/image

%files
%_datadir/make-initrd/features/propagator

%changelog
* Thu Jan 23 2014 Anton V. Boyarshinov <boyarsh@altlinux.ru> 0.23-alt1
- partition size calculation fixed again

* Wed Dec 25 2013 Anton V. Boyarshinov <boyarsh@altlinux.ru> 0.22-alt2
- partition size calculation fixed

* Tue Dec 24 2013 Anton V. Boyarshinov <boyarsh@altlinux.ru> 0.22-alt1
- resurrect rw live on x86_64

* Mon Oct 14 2013 Fr. Br. George <george@altlinux.ru> 0.21-alt2
- Use subdirectory when mounting profiled .iso patches

* Mon Sep 30 2013 Fr. Br. George <george@altlinux.ru> 0.21-alt1
- Fix non-posix invalid redirection
- Show mounted overlays and mount status

* Thu Apr 11 2013 Michael Shigorin <mike@altlinux.org> 0.20-alt1
- fixed a typo, thanks Andrey Liakhovets

* Thu Mar 21 2013 Anton V. Boyarshinov <boyarsh@altlinux.ru> 0.19-alt1
- use disk and nfs slices only if stagenage=live

* Tue Mar 19 2013 Michael Shigorin <mike@altlinux.org> 0.18-alt1
- init-bottom (see also the subsequent discussion in #28289):
+ require "live_rw" keyword for "cdrom" method to create rw slice
+ create ext4 w/o journal instead of ext3
+ tweaked rw slice mount options

* Sat Mar 16 2013 Michael Shigorin <mike@altlinux.org> 0.17-alt1
- accept cdrom for rw disk_slice on isohybrid media (closes: #28289)

* Thu Feb 21 2013 Michael Shigorin <mike@altlinux.org> 0.16-alt1
- reenable rw slice if it's not GPT (thus MBR)
- fixed annoying /etc/mtab related message

* Sun Feb 10 2013 Michael Shigorin <mike@altlinux.org> 0.15-alt1
- add name-slot-rules conditionally (see also #28484)
- fix a typo

* Thu Jan 31 2013 Anton V. Boyarshinov <boyarsh@altlinux.ru> 0.14-alt1
- add name-slot-rules

* Fri Dec 28 2012 Anton V. Boyarshinov <boyarsh@altlinux.ru> 0.13-alt2
- creating aufs slice on hybrid rw media temporary disabled

* Fri Nov 09 2012 Anton V. Boyarshinov <boyarsh@altlinux.ru> 0.13-alt1
- mount.nfs added

* Mon Sep 17 2012 Fr. Br. George <george@altlinux.ru> 0.12-alt1
- Provide /proc/cmdline parser
- Add overlays profiling support

* Wed Sep 12 2012 Anton V. Boyarshinov <boyarsh@altlinux.ru> 0.11-alt1
- put-file usage fix from sin@ (closes #27725)

* Wed Sep 05 2012 Anton V. Boyarshinov <boyarsh@altlinux.ru> 0.10-alt1
- added --numeric-ports option to netstat (dans@), (closes: #27698)

* Thu May 10 2012 Michael Shigorin <mike@altlinux.org> 0.9-alt1
- NMU: merged legion@'s update for current make-initrd

* Thu Mar 22 2012 Andriy Stepanov <stanv@altlinux.ru> 0.8-alt1.2
- Works independent from propagator

* Wed Sep 14 2011 Michael Shigorin <mike@altlinux.org> 0.8-alt1.1
- NMU: add Requires: make-initrd (closes: #26133)
- trivial spec cleanup

* Tue Aug 23 2011 Anton V. Boyarshinov <boyarsh@altlinux.ru> 0.8-alt1
- nfs live overlays order fixed

* Tue Jun 14 2011 Anton V. Boyarshinov <boyarsh@altlinux.ru> 0.7-alt4
- nfs live overlays fixed

* Thu Jun 09 2011 Anton V. Boyarshinov <boyarsh@altlinux.ru> 0.7-alt3
- head added to initramfs for nfs livecd overlays

* Tue Jun 07 2011 Anton V. Boyarshinov <boyarsh@altlinux.ru> 0.7-alt2
- udba=notify deleted for compatibility with 2.6.32

* Wed Jun 01 2011 Anton V. Boyarshinov <boyarsh@altlinux.ru> 0.7-alt1
- remount root for live to aufs

* Wed Dec 22 2010 Anton V. Boyarshinov <boyarsh@altlinux.ru> 0.6-alt1
- create /image in rootfs (fixes http and ftp methods)

* Fri Dec 10 2010 Anton Farygin <rider@altlinux.ru> 0.5-alt1
- do not copy plymouth files if plymouth not installed

* Wed Dec 08 2010 Anton V. Boyarshinov <boyarsh@altlinux.ru> 0.4-alt1
- creating /lib/firmware in rootfs

* Tue Dec 07 2010 Anton V. Boyarshinov <boyarsh@altlinux.ru> 0.3-alt1
- hack 60-persistent-storage-rules to not link sd[a-z] to disk/by-label

* Wed Dec 01 2010 Anton V. Boyarshinov <boyarsh@altlinux.ru> 0.2-alt1
- boot-duration copying added

* Tue Nov 30 2010 Anton V. Boyarshinov <boyarsh@altlinux.ru> 0.1-alt1
- first build



make-initrd-propagator-0.23/propagator/000075500000000000000000000000001227015320300201655ustar00rootroot00000000000000make-initrd-propagator-0.23/propagator/config.mk000064400000000000000000000011141227015320300217600ustar00rootroot00000000000000PROPAGATOR_FILES = \
/usr/share/terminfo/l/linux \
/bin/head \
/bin/grep \
/bin/openvt \
/sbin/mount.aufs \
/sbin/mount.nfs \
/sbin/chroot \
/sbin/mke2fs\
/bin/readlink \
/sbin/fdisk \
/bin/basename \
/bin/cut \
/bin/mountpoint \
/bin/netstat \
/bin/ps \
/bin/rmdir \
/bin/sed \
/bin/sort \
/bin/tail \
/usr/bin/find \
/usr/bin/seq \
/bin/wc \
/sbin/addpart

PROPAGATOR_FILES_NET = \
/lib/udev/rules.d/*-net-name-slot.rules \
/lib/udev/rules.d/*-net-description.rules \

PROPAGATOR_BIN = /usr/sbin/propagator

PROPAGATOR_DATADIR = $(FEATURESDIR)/propagator/data

make-initrd-propagator-0.23/propagator/data/000075500000000000000000000000001227015320300210765ustar00rootroot00000000000000make-initrd-propagator-0.23/propagator/data/sbin/000075500000000000000000000000001227015320300220315ustar00rootroot00000000000000make-initrd-propagator-0.23/propagator/data/sbin/init-bottom000075500000000000000000000112331227015320300242240ustar00rootroot00000000000000#!/bin/sh

stage2=/root

. /scripts/functions

# get /proc/cmdline parameter
# if key is specified, parse key1:value1,key2:value2... parameter argument
# and select corresponded key value
# returns:
# 0 if there is a parameter (also print it's value if "-p" is used)
# 1 if there is no such parameter
get_cmdline() { # [-p] parameter [key]
local SEDFLAG=""
local SEARCH=""
local REPLACE=""
local CMDLINE="${PROC_CMDLINE:-/proc/cmdline}"

case "$1" in
-p) SEDFLAG="p"; shift ;;
esac

case "$#" in
1) SEARCH="$1(=([^ ]*)|()( |$))"; REPLACE="\3";;
*) SEARCH="$1=(.*,|)$2(:([^, ]+)|()(,.*| |\$))"; REPLACE="\4";;
esac

sed -nr "
s/(^|.* )$SEARCH.*/$REPLACE/$SEDFLAG
t
q 1
" < "$CMDLINE"
}

# check if get_cmdline -p $2 [$3] is equal to $1 pattern
equal_cmdline() { # value <get_cmdline parameter> [<get_cmdline parameter2>]
local V="$1"; shift
case `get_cmdline -p "$@"` in
$V) return 0;;
*) return 1;;
esac
}

nfs_slice(){
local profile
local overlays=/srv/public/netinst/overlays-live
if equal_cmdline nfs automatic method; then
# mount overlays from nfs
ip=$(netstat -t --numeric-hosts --numeric-ports | grep :2049 | head -n1 | \
sed 's/ */ /g' | cut -d' ' -f5 | cut -d: -f1)
profile=$(get_cmdline -p profile || : )
mkdir -p $stage2/tmp/images
message "Mounting NFS overlays from $ip:$overlays"
if nfsmount -o nolock $ip:$overlays $stage2/tmp/images > /dev/null 2>&1 ; then
local msg
ls -l $stage2/tmp/images/ > /dev/null || :
for image in $(find $stage2/tmp/images/$profile -name "*.iso" | sort) ; do
msg="${msg} $(basename "$image" .iso)"
imgdir=$stage2/tmp/overlays/$(basename "$image")
mkdir -p $imgdir
mount -o loop $image $imgdir \
&& { mount -t aufs -o "remount,add:1:$imgdir/=rr+wh" none $stage2 || msg="$msg!"; } || msg="$msg?"
done
test -n "$msg" && message "$msg" || message "No overlays found"
else
message "NFS mount failed"
fi
fi
}

mount_options="noatime,nodiratime,commit=30,min_batch_time=100000,barrier=0,data=writeback,delalloc"

create_disk_slice() {
[ -f /sys/dev/block/$(mountpoint -d /image)/partition ] || return 0
[ -h /dev/disk/by-label/alt-live-storage ] && return 0

partition=$(mountpoint -d /image)
major=${partition%:*}
minor=$((${partition#*:}& ~0xf))
devlink=$(readlink /sys/dev/block/$major:$minor)
device=/dev/${devlink##*/}
before=$(fdisk -l $device | wc -l)
partpath=/sys/dev/block/$partition
newstart=$(($(cat $partpath/start)+$(cat $partpath/size)+1))
fdisk $device << _EOF_
n
p

$newstart

w
_EOF_
after=$(fdisk -l $device | wc -l)
if [ $after -gt $before ] ; then
partline=$(fdisk -l $device | tail -n1)
start=$(echo $partline | sed 's/ */ /g' | cut -d' ' -f2)
length=$(($(echo $partline | sed 's/ */ /g' | cut -d' ' -f3)-$start))
number=$(echo $partline | cut -d' ' -f1| sed 's/[^0-9]*//')
udevd --daemon
addpart $device $number $start $length && udevadm trigger
# wait for $device$number
for n in seq 1 10; do
[ -b $device$number ] && break
sleep 1
done
mke2fs -t ext4 -O ^has_journal -L alt-live-storage $device$number &&
mount -o $mount_options $device$number $stage2.rw
udevadm control --exit
fi
}

disk_slice(){
# Automaitc rw live on flash
# NB: may severely degrade first boot performance due to heavier I/O
case "$(get_cmdline -p automatic method)" in
disk|cdrom)
if get_cmdline automatic label || get_cmdline live_rw; then
create_disk_slice
fi
;;
esac

if [ -h /dev/disk/by-label/alt-live-storage ]; then
grep -qs "[[:space:]]$stage2.rw[[:space:]]" /proc/mounts ||
mount -o $mount_options /dev/disk/by-label/alt-live-storage $stage2.rw
fi
}

#
# Enter point
#

if cat /proc/mounts | grep "[[:space:]]$stage2[[:space:]]" | grep -s -q '[[:space:]]squashfs[[:space:]]'; then
message "Root fs is squashfs"
RO_ROOT="yes"
elif equal_cmdline live stagename; then
message "Running live"
RO_ROOT="yes"
else
message "Unknown root fs"
RO_ROOT="no"
fi

if [ "$RO_ROOT" = "yes" ]; then
message "Remounting / with aufs"
[ -L /etc/mtab ] || ln -sf /proc/mounts /etc/mtab
/bin/mkdir -p $stage2.rw $stage2.ro
if equal_cmdline live stagename; then
disk_slice
fi
/bin/mountpoint -q $stage2.rw || /bin/mount -t tmpfs none $stage2.rw -o mode=755
/bin/mount $stage2 $stage2.ro --move
/bin/mount -t aufs none $stage2 -o dirs=$stage2.rw=rw:$stage2.ro=rr
if equal_cmdline live stagename; then
nfs_slice
fi
/bin/mkdir -p $stage2/.ro $stage2/.rw
/bin/mount $stage2.ro $stage2/.ro --move
/bin/mount $stage2.rw $stage2/.rw --move
/bin/rmdir $stage2.rw $stage2.ro

message "Root FS overlayed with aufs"
fi

if get_cmdline propagator-debug ; then
/bin/openvt -s -w -- /bin/sh
fi
make-initrd-propagator-0.23/propagator/data/scripts/000075500000000000000000000000001227015320300225655ustar00rootroot00000000000000make-initrd-propagator-0.23/propagator/data/scripts/pre/000075500000000000000000000000001227015320300233535ustar00rootroot00000000000000make-initrd-propagator-0.23/propagator/data/scripts/pre/prepare/000075500000000000000000000000001227015320300250115ustar00rootroot00000000000000make-initrd-propagator-0.23/propagator/data/scripts/pre/prepare/000-propagator000075500000000000000000000001641227015320300274130ustar00rootroot00000000000000#!/bin/sh -efu

readonly PROPAGATOR="/usr/sbin/propagator"

if [ -x "$PROPAGATOR" ]; then
exec "$PROPAGATOR"
fi
make-initrd-propagator-0.23/propagator/data/scripts/pre/umount/000075500000000000000000000000001227015320300247025ustar00rootroot00000000000000make-initrd-propagator-0.23/propagator/data/scripts/pre/umount/000-remountrw000075500000000000000000000003431227015320300271670ustar00rootroot00000000000000#!/bin/sh

. /scripts/functions

readonly REMOUNTER="/sbin/init-bottom"

message "Suppose root FS already mounted. Go to RO\RW overlay"

if [ -x "$REMOUNTER" ]; then
"$REMOUNTER"
fi

message "Return from RO\RW overlay"
make-initrd-propagator-0.23/propagator/rules.mk000064400000000000000000000015561227015320300216570ustar00rootroot00000000000000propagator: create
@echo "Adding propagator ..."
@put-file "$(ROOTDIR)" $(PROPAGATOR_FILES)
@if [ -f /lib/udev/write_net_rules ]; then \
put-file "$(ROOTDIR)" /lib/udev/write_net_rules; \
else \
put-file "$(ROOTDIR)" $(PROPAGATOR_FILES_NET); \
fi
@if [ -f /usr/share/plymouth/default-install-duration ]; then \
mkdir -p $(PROPAGATOR_DATADIR)/var/lib/plymouth; \
fi
@if [ -f $(PROPAGATOR_BIN) ]; then put-file "$(ROOTDIR)" $(PROPAGATOR_BIN); fi
@if [ -f /usr/share/plymouth/default-install-duration ]; then \
cp /usr/share/plymouth/default-install-duration \
$(PROPAGATOR_DATADIR)/var/lib/plymouth/boot-duration; \
fi
@put-tree "$(ROOTDIR)" $(PROPAGATOR_DATADIR)
@sed -i 's|SYMLINK+="disk/by-label/|KERNEL!="sd[a-z]", SYMLINK+="disk/by-label/|' \
$(ROOTDIR)/etc/udev/rules.d/60-persistent-storage.rules
@mkdir $(ROOTDIR)/lib/firmware

pack: propagator
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin