mirror of
https://github.com/pentoo/pentoo-overlay
synced 2026-04-16 20:01:31 +02:00
pentoo-livecd: update to hopefully work right
This commit is contained in:
parent
2cd04afcea
commit
d5db49ca93
3 changed files with 31 additions and 56 deletions
|
|
@ -1,11 +1,12 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
# This script allows flushing of the permanent storage to a .lzm file,
|
||||
# allowing for some more space
|
||||
|
||||
DST="/mnt/cdrom/modules"
|
||||
# make sure this is the last filename
|
||||
DSTFILE="zz_changes"
|
||||
CHANGESDIR="/.unions/memory/aufs-rw-branch/default/"
|
||||
CHANGESDIR="/mnt/overlay/.upper"
|
||||
#CHANGESDIR="/.unions/memory/aufs-rw-branch/default/"
|
||||
|
||||
#gentoo-functions uses "consoletype" which returns non-zero exit codes on success
|
||||
#the cleanest way to handle this is to never "set -e" before sourcing gentoo-functions
|
||||
|
|
@ -24,17 +25,17 @@ usage ()
|
|||
|
||||
squash ()
|
||||
{
|
||||
if [ ! -e "${CHANGESDIR}" ]
|
||||
if ! mount | grep -q "${CHANGESDIR}"
|
||||
then
|
||||
eerror "It appears that you're not using unionfs"
|
||||
eerror "It appears that you're not using unionfs/aufs/overlayfs"
|
||||
return 1
|
||||
else
|
||||
mksquashfs "${CHANGESDIR}" $1 -comp xz -Xbcj x86 -b 1048576 -no-recovery -noappend -Xdict-size 1048576
|
||||
mksquashfs "${CHANGESDIR}" "$1" -comp xz -Xbcj x86 -b 1048576 -no-recovery -noappend -Xdict-size 1048576
|
||||
return $?
|
||||
fi
|
||||
}
|
||||
|
||||
if [ ! -z $1 ]
|
||||
if [ ! -z "$1" ]
|
||||
then
|
||||
DST=$1
|
||||
fi
|
||||
|
|
@ -48,14 +49,13 @@ then
|
|||
exit 1
|
||||
else
|
||||
index=0
|
||||
while [ 1 ]
|
||||
while true
|
||||
do
|
||||
indexstring="0${index}"
|
||||
indexstring="${indexstring:(-2)}"
|
||||
if [ ! -f "${DST}/${DSTFILE}-${indexstring}.lzm" ]
|
||||
then
|
||||
squash "${DST}/${DSTFILE}-${indexstring}.lzm"
|
||||
if [ $? -eq 0 ]
|
||||
if squash "${DST}/${DSTFILE}-${indexstring}.lzm"
|
||||
then
|
||||
einfo "$DST/${DSTFILE}-${indexstring}.lzm created successfully"
|
||||
break
|
||||
|
|
@ -64,25 +64,6 @@ else
|
|||
exit 1
|
||||
fi
|
||||
fi
|
||||
index=$(($index + 1))
|
||||
index=$((index + 1))
|
||||
done
|
||||
## I don't really get the point of this, and the doclean.sh code is terrible, so I am removing it for now
|
||||
# if [ -f "${DST}/${DSTFILE}-${indexstring}.lzm" ]
|
||||
# then
|
||||
# ewarn "The changesfile will be cleared a next reboot"
|
||||
# if [ -e /usr/sbin/doclean.sh ]
|
||||
# then
|
||||
# cp -a /usr/sbin/doclean.sh /.unions/memory/.doclean.sh
|
||||
# else
|
||||
# eerror "Unable to find /usr/sbin/doclean.sh"
|
||||
# eerror "Your changesfile will not be cleared at reboot"
|
||||
# exit 1
|
||||
# fi
|
||||
# fi
|
||||
fi
|
||||
|
||||
|
||||
## doclean.sh
|
||||
#good_msg "Cleaning the permanent changes"
|
||||
#rm -rf $CHANGES/*
|
||||
#good_msg "Cleaning complete"
|
||||
|
|
@ -10,38 +10,35 @@ if [[ -z "$@" ]] ; then
|
|||
eerror "Please specify a package to build." && exit 1
|
||||
fi
|
||||
|
||||
einfo "Pentoo AUFS module creator version 1.0 running..."
|
||||
einfo "Pentoo Overlay Module creator version 1.0 running..."
|
||||
|
||||
PKGDIR="$(portageq envvar PKGDIR)"
|
||||
if [ ! -w ${PKGDIR} ]; then
|
||||
if [ ! -w "${PKGDIR}" ]; then
|
||||
eerror "ERROR: ${PKGDIR} is not writable or does not exist!"
|
||||
exit 1
|
||||
fi
|
||||
mkdir -p /mnt/cdrom/modules/
|
||||
if [ ! -w "/mnt/cdrom/modules/" ]; then
|
||||
eerror "ERROR: /mnt/cdrom/modules is not writable, are you on the livecd?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TMPDIR="/tmp/rootfs-$$"
|
||||
|
||||
DEPS=$(emerge -pv $@)
|
||||
# | ignore nomerge | find versions | remove [ ebuild N ] | remove use flags | remove repo from version | not sure
|
||||
PKG=`echo "${DEPS}" | grep -v nomerge | grep -e ".*/.*" | awk -F '] ' '{print $2}' | awk '{print $1}' | awk -F '::' '{print $1}' | grep -v ^/`
|
||||
PKG=$(echo "${DEPS}" | grep -v nomerge | grep -e ".*/.*" | awk -F '] ' '{print $2}' | awk '{print $1}' | awk -F '::' '{print $1}' | grep -v ^/)
|
||||
|
||||
[[ -z "${PKG}" ]] && eerror "Nothing to emerge!" && exit 1
|
||||
|
||||
einfo "Here are the dependencies :"
|
||||
echo "${DEPS}"
|
||||
|
||||
read -p "Proceed with the merging? [y]/n " ASK
|
||||
read -rp "Proceed with the merging? [y]/n " ASK
|
||||
|
||||
if [ "${ASK}" == "n" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -e /mnt/cdrom/modules ]
|
||||
then
|
||||
ewarn "Unable to find module dir in /mnt/cdrom/"
|
||||
ewarn "Are you using Pentoo live or installed?"
|
||||
else
|
||||
|
||||
einfo "Preparing to merge all required packages"
|
||||
for x in ${PKG}
|
||||
do
|
||||
|
|
@ -54,16 +51,14 @@ do
|
|||
if [ -d "${TMPDIR}"/lib ] && [ -L /lib ]; then
|
||||
mkdir -p "${TMPDIR}$(realpath /lib)"
|
||||
mv -f "${TMPDIR}"/lib/* "${TMPDIR}$(realpath /lib)"
|
||||
rm -rf "${TMPDIR}"/lib
|
||||
rm -rf "${TMPDIR:?}"/lib
|
||||
fi
|
||||
mkdir -p "${TMPDIR}"/var/db/pkg/"${x%:*}"
|
||||
# remove slot again since it's not in the vdb folder version number
|
||||
cp -a /var/db/pkg/"${x%:*}"/* "${TMPDIR}"/var/db/pkg/"${x%:*}"/
|
||||
MOFILE=$(echo ${x%:*} | sed -e 's/.*\///g')
|
||||
MOFILE=$(echo "${x%:*}" | sed -e 's/.*\///g')
|
||||
einfo "Building module for ${MOFILE}"
|
||||
mksquashfs "${TMPDIR}" /mnt/cdrom/modules/"${MOFILE}".lzm -comp xz -Xbcj x86 -b 1048576 -no-recovery -noappend -Xdict-size 1048576
|
||||
einfo "Module now available in /mnt/cdrom/modules/${MOFILE}.lzm"
|
||||
rm -rf "${TMPDIR}"
|
||||
done
|
||||
|
||||
fi
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
# Copyright 1999-2017 Gentoo Foundation
|
||||
# Copyright 1999-2018 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: $
|
||||
|
||||
EAPI=6
|
||||
|
||||
|
|
@ -10,19 +9,19 @@ SRC_URI=""
|
|||
|
||||
LICENSE=""
|
||||
SLOT="0"
|
||||
KEYWORDS="~arm ~amd64 ~x86"
|
||||
KEYWORDS="~amd64 ~x86"
|
||||
IUSE="livecd"
|
||||
|
||||
S="${WORKDIR}"
|
||||
|
||||
DEPEND=""
|
||||
RDEPEND="!<pentoo/pentoo-system-2014.3-r4
|
||||
livecd? ( pentoo/pentoo-installer
|
||||
app-misc/livecd-tools
|
||||
virtual/eject
|
||||
sys-apps/hwsetup
|
||||
sys-block/disktype
|
||||
x11-misc/mkxf86config
|
||||
RDEPEND="!<pentoo/pentoo-system-2014.3-r4"
|
||||
PDEPEND="livecd? ( pentoo/pentoo-installer
|
||||
app-misc/livecd-tools
|
||||
virtual/eject
|
||||
sys-apps/hwsetup
|
||||
sys-block/disktype
|
||||
x11-misc/mkxf86config
|
||||
sys-apps/gentoo-functions
|
||||
)"
|
||||
|
||||
|
|
@ -32,8 +31,8 @@ pkg_setup() {
|
|||
|
||||
src_install() {
|
||||
#/usr/sbin
|
||||
newsbin "${FILESDIR}"/flushchanges-2014.3-r5 flushchanges
|
||||
newsbin "${FILESDIR}"/makemo-2014.3-r7 makemo
|
||||
newsbin "${FILESDIR}"/flushchanges-2018.0 flushchanges
|
||||
newsbin "${FILESDIR}"/makemo-2018.0 makemo
|
||||
newsbin "${FILESDIR}"/livecd-setpass-r1 livecd-setpass
|
||||
|
||||
newinitd "${FILESDIR}"/binary-driver-handler.initd-2017.3 binary-driver-handler
|
||||
Loading…
Reference in a new issue