Merge branch 'next'

This commit is contained in:
parazyd 2016-12-18 15:52:19 +01:00
commit 1aaa86ffbd
No known key found for this signature in database
GPG Key ID: F0CB28FCF78637DE
18 changed files with 61 additions and 39 deletions

View File

@ -18,7 +18,7 @@ zsh debootstrap sudo kpartx cgpt xz-utils
## Documentation ## Documentation
Find documentation inside the `doc` directory of libdevuansdk. Find documentation inside the `docs` directory of libdevuansdk.
## Notes ## Notes

2
config
View File

@ -24,7 +24,7 @@ arrs+=(core_packages base_packages purge_packages blend_packages)
os="devuan" os="devuan"
release="jessie" release="jessie"
version="1.0.0-beta2.rc1" version="1.0.0-beta2"
mirror="http://auto.mirror.devuan.org/merged" mirror="http://auto.mirror.devuan.org/merged"
section="main" section="main"

View File

@ -50,5 +50,11 @@ so that apt doesn't autostart daemons when they are installed.
this function will allow root login with password in the bootstrapped rootfs. this function will allow root login with password in the bootstrapped rootfs.
## chroot-script()
allows you to chroot inside the `$strapdir` and execute the
script/binary that's given to it.
takes an optional argument: `-d` (will call dpkgdivert on and off)
## silly() ## silly()
a funny function printing out random messages. a funny function printing out random messages.

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this source code. If not, see <http://www.gnu.org/licenses/>. # along with this source code. If not, see <http://www.gnu.org/licenses/>.
libdevuansdk_version="0.2" libdevuansdk_version="0.3"
LIBPATH=${LIBPATH:-`dirname $0`} LIBPATH=${LIBPATH:-`dirname $0`}
source $LIBPATH/config source $LIBPATH/config

View File

@ -63,8 +63,6 @@ bootstrap_complete_base() {
## write third-stage for chroot ## write third-stage for chroot
bootstrap_config_thirdstage | sudo tee $strapdir/thirdstage bootstrap_config_thirdstage | sudo tee $strapdir/thirdstage
bootstrap_config_cleanup | sudo tee $strapdir/cleanup bootstrap_config_cleanup | sudo tee $strapdir/cleanup
sudo chmod +x $strapdir/thirdstage
sudo chmod +x $strapdir/cleanup
## chroot into it and configure further ## chroot into it and configure further
## debootstrap stage 3 ## debootstrap stage 3
@ -72,10 +70,7 @@ bootstrap_complete_base() {
devprocsys mount $strapdir || zerr devprocsys mount $strapdir || zerr
dpkgdivert on $strapdir chroot-script -d thirdstage cleanup || zerr
sudo -E chroot $strapdir /thirdstage || zerr
sudo -E chroot $strapdir /cleanup || zerr
dpkgdivert off $strapdir
sleep 1 sleep 1
devprocsys umount $strapdir || zerr devprocsys umount $strapdir || zerr
@ -94,7 +89,7 @@ rm -f /thirdstage
rm -f /etc/ssh/*_key rm -f /etc/ssh/*_key
rm -f /etc/ssh/*.pub rm -f /etc/ssh/*.pub
rm -f /root/.bash_history rm -f /root/.bash_history
#rm -f /usr/bin/qemu-* #rm -f /usr/bin/qemu-arm-static
## our file for which we check the bootstrap is complete ## our file for which we check the bootstrap is complete
echo "1" > .done echo "1" > .done
rm -f /cleanup rm -f /cleanup
@ -141,8 +136,7 @@ apt-get clean
rm -f /prepack rm -f /prepack
EOF EOF
sudo chmod +x $strapdir/prepack || zerr chroot-script prepack || zerr
sudo -E chroot $strapdir /prepack || zerr
local _dest=$(dirname $bootstrap_tgz) local _dest=$(dirname $bootstrap_tgz)
@ -185,14 +179,13 @@ apt-get clean
rm -f /postunpack rm -f /postunpack
EOF EOF
dpkgdivert on $strapdir
devprocsys mount $strapdir devprocsys mount $strapdir
sudo chmod +x $strapdir/postunpack || zerr chroot-script -d postunpack || zerr
sudo -E chroot $strapdir /postunpack || zerr
devprocsys umount $strapdir devprocsys umount $strapdir
dpkgdivert off $strapdir
## below typically used in arm-sdk ## below typically used in arm-sdk
[[ -z $inittab ]] || { print $inittab | sudo tee -a $strapdir/etc/inittab } [[ -z $inittab ]] || { print $inittab | sudo tee -a $strapdir/etc/inittab }
for i in $custmodules;do print $i | sudo tee -a $strapdir/etc/modules; done for i in $custmodules; do
print $i | sudo tee -a $strapdir/etc/modules
done
} }

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this source code. If not, see <http://www.gnu.org/licenses/>. # along with this source code. If not, see <http://www.gnu.org/licenses/>.
## helper functions that make your life easier ## helper functions that make my life easier
build_image_dist() { build_image_dist() {
fn build_image_dist fn build_image_dist
@ -138,8 +138,8 @@ dpkg-divert --remove --rename /usr/sbin/invoke-rc.d
rm -f /dpkgdivert rm -f /dpkgdivert
EOF EOF
fi fi
sudo chmod +x $werdo/dpkgdivert
sudo -E chroot $werdo /dpkgdivert || zerr chroot-script dpkgdivert || zerr
} }
enableserv() { enableserv() {
@ -154,8 +154,7 @@ update-rc.d ${service} enable
EOF EOF
notice "enabling $service service" notice "enabling $service service"
sudo chmod +x $strapdir/enserv chroot-script enserv
sudo -E chroot $strapdir /enserv
} }
disableserv() { disableserv() {
@ -170,8 +169,7 @@ update-rc.d ${service} disable
EOF EOF
notice "disabling $service service" notice "disabling $service service"
sudo chmod +x $strapdir/disserv chroot-script disserv
sudo -E chroot $strapdir /disserv
} }
enablessh() { enablessh() {
@ -183,9 +181,9 @@ enablessh() {
#!/bin/sh #!/bin/sh
sed -i -e 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config sed -i -e 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
update-rc.d ssh enable update-rc.d ssh enable
chmod +x /etc/init.d/regensshkeys
update-rc.d regensshkeys defaults update-rc.d regensshkeys defaults
update-rc.d regensshkeys enable update-rc.d regensshkeys enable
rm -f /enssh
EOF EOF
cat <<EOF | sudo tee ${strapdir}/etc/init.d/regensshkeys cat <<EOF | sudo tee ${strapdir}/etc/init.d/regensshkeys
@ -222,10 +220,9 @@ case "\$1" in
esac esac
EOF EOF
dpkgdivert on $strapdir sudo chmod +x $strapdir/etc/init.d/regensshkeys
sudo chmod +x $strapdir/enssh
sudo -E chroot $strapdir /enssh chroot-script -d enssh
dpkgdivert off $strapdir
} }
install-custdebs() { install-custdebs() {
@ -246,8 +243,35 @@ apt-get autoremove
apt-get clean apt-get clean
rm -rf /debs install-debs rm -rf /debs install-debs
EOF EOF
sudo chmod +x $strapdir/install-debs chroot-script install-debs
sudo -E chroot $strapdir /install-debs }
chroot-script() {
fn chroot-script "$@"
case "x$1" in
x-d)
shift 1
local scripts="$@"
dpkgdivert on $strapdir
for i in $scripts; do
notice "chrooting to execute $i..."
sudo chmod +x $strapdir/$i
sudo -E chroot $strapdir /$i
done
dpkgdivert off $strapdir
;;
*)
local scripts="$@"
for i in $scripts; do
notice "chrooting to execute $i..."
sudo chmod +x $strapdir/$i
sudo -E chroot $strapdir /$i
done
;;
esac
} }
silly() { silly() {

View File

@ -36,10 +36,8 @@ apt-get --yes --force-yes autoremove
apt-get clean apt-get clean
rm -f /isoprep rm -f /isoprep
EOF EOF
dpkgdivert on $strapdir
sudo chmod +x $strapdir/isoprep chroot-script -d isoprep || zerr
sudo -E chroot $strapdir /isoprep
dpkgdivert off $strapdir
} }
iso_setup_isolinux() { iso_setup_isolinux() {

View File

@ -33,7 +33,7 @@ build_kernel_amd64() {
dpkgdivert on $strapdir dpkgdivert on $strapdir
devprocsys mount $strapdir devprocsys mount $strapdir
sudo chroot $strapdir \ sudo -E chroot $strapdir \
apt-get --yes --force-yes install $kernel apt-get --yes --force-yes install $kernel
devprocsys umount $strapdir devprocsys umount $strapdir
@ -54,7 +54,7 @@ build_kernel_i386() {
dpkgdivert on $strapdir dpkgdivert on $strapdir
devprocsys mount $strapdir devprocsys mount $strapdir
sudo chroot $strapdir \ sudo -E chroot $strapdir \
apt-get --yes --force-yes install $kernel apt-get --yes --force-yes install $kernel
devprocsys umount $strapdir devprocsys umount $strapdir

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this source code. If not, see <http://www.gnu.org/licenses/>. # along with this source code. If not, see <http://www.gnu.org/licenses/>.
## ilporcodio ## ilpd
rsync_to_raw_image() { rsync_to_raw_image() {
fn rsync_to_raw_image fn rsync_to_raw_image
@ -35,6 +35,7 @@ rsync_to_raw_image() {
die "not enough space. report a bug please" die "not enough space. report a bug please"
zerr zerr
} }
if [[ $parted_type = dos ]]; then if [[ $parted_type = dos ]]; then
sudo rsync -HPavz -q ./boot/* $workdir/boot || { sudo rsync -HPavz -q ./boot/* $workdir/boot || {
image_raw_umount image_raw_umount

View File

@ -39,7 +39,7 @@ proc /proc proc nodev,noexec,nosuid 0 0
/dev/sda2 / ext4 errors=remount-ro 0 1 /dev/sda2 / ext4 errors=remount-ro 0 1
# boot # boot
/dev/sda1 /boot ext2 noauto 0 0 /dev/sda1 /boot ext2 defaults 0 0
EOF EOF
} }