Browse Source

Added package checking checking to astronaut

master
mid-kid 10 years ago
parent
commit
7a5ffea2ac
  1. 25
      astronaut/astronaut
  2. 8
      astronaut/hello.sat
  3. 22
      tools/chroot
  4. 25
      tools/prepchroot

25
astronaut/astronaut

@ -8,6 +8,7 @@ dir_source="$PWD/source"
dir_install="$PWD/install"
cmd_download="curl -#L -o {dst} {src}"
cmd_extract="tar xf {src}"
enable_check=true
if [ -f /etc/astronaut.conf ]; then
. /etc/astronaut.conf
fi
@ -16,11 +17,13 @@ fi
show_help() {
echo "This astronaut will help you build some satellites.
Just describe what he's got to do in a satellite file.
Usage: $0 [-s <dir>] [-b <dir>] [-i <dir>] <satellite>
Usage: $0 [-s <dir>] [-b <dir>] [-i <dir>] [-cC] <satellite>
-s Set source directory
-b Set build directory [WARNING: Will be deleted before build]
-i Set install directory"
-i Set install directory
-c Enable package checking
-C Disable package checking"
}
msg() {
@ -33,7 +36,7 @@ exiterr() {
}
# Gather info
while getopts "h?s:b:i:" opt; do
while getopts "h?s:b:i:cC" opt; do
case "$opt" in
h|\?)
show_help
@ -48,6 +51,12 @@ while getopts "h?s:b:i:" opt; do
i)
dir_install="$(realpath "$OPTARG")"
;;
c)
enable_checking=true
;;
C)
enable_checking=false
;;
esac
done
@ -113,6 +122,16 @@ extrafile() {
cp "$(dirname "$satellite")/$1" "$dir_build/$1"
}
do_check() {
if [ "$enable_check" = true ]; then
if [ "$1" ]; then
$@
else
echo true
fi
fi
}
# Create the satellite
rm -rf "$dir_build"

8
astronaut/hello.sat

@ -22,4 +22,12 @@ extract "$name-$version.tar.gz" \
cd "$name-$version"
./configure
make
# Know if the user wants the package to be checked
if do_check; then
make check
fi
# Abbreviation for the above, for single commands
#do_check make check
make DESTDIR="$dir_install" install

22
tools/chroot

@ -1,6 +1,26 @@
#!/bin/sh
umask 022
set -e
if [ "$(id -u)" != "0" ]; then
echo "Please run this script as root" 1>&2
exit 1
fi
if [ ! "$rocket" ]; then
echo 'Please set the $rocket variable' 1>&2
exit 1
fi
mkdir -p "$rocket/dev" "$rocket/proc" "$rocket/sys" "$rocket/run"
mount --bind /dev "$rocket/dev"
mount -t devpts devpts "$rocket/dev/pts"
mount -t proc proc "$rocket/proc"
mount -t tmpfs tmpfs "$rocket/run"
if [ -h "$rocket/dev/shm" ]; then
mkdir -p "$rocket/$(readlink "$rocket/dev/shm")"
fi
chroot "$rocket" /tools/bin/env -i \
HOME=/root \
TERM="$TERM" \

25
tools/prepchroot

@ -0,0 +1,25 @@
#!/bin/sh
umask 022
set -e
if [ "$(id -u)" != "0" ]; then
echo "Please run this script as root" 1>&2
exit 1
fi
if [ ! "$rocket" ]; then
echo 'Please set the $rocket variable' 1>&2
exit 1
fi
echo "Changing ownership of $rocket to root"
chown -R 0.0 "$rocket"
echo "Creating device nodes"
mknod -m 600 "$rocket/dev/console" c 5 1
mknod -m 666 "$rocket/dev/null" c 1 3
echo "Configuring astronaut"
mkdir -p "$rocket/etc"
echo '# This is a config for use with busybox
cmd_download="wget -O {dst} {src}"' > "$rocket/etc/astronaut.conf"
Loading…
Cancel
Save