diff options
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/poky-chroot-run | 86 | ||||
| -rwxr-xr-x | scripts/poky-chroot-setup | 31 |
2 files changed, 0 insertions, 117 deletions
diff --git a/scripts/poky-chroot-run b/scripts/poky-chroot-run deleted file mode 100755 index f1f4dec6a4..0000000000 --- a/scripts/poky-chroot-run +++ /dev/null | |||
| @@ -1,86 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # | ||
| 3 | # Runs a command within a Poky chroot | ||
| 4 | # | ||
| 5 | |||
| 6 | XEPHYR=`which Xephyr` | ||
| 7 | if [ ! -n "$XEPHYR" -o ! -x "$XEPHYR" ]; then | ||
| 8 | echo "You need to install Xephyr to use $0" | ||
| 9 | exit 1 | ||
| 10 | fi | ||
| 11 | |||
| 12 | CHROOTUID=`which chrootuid` | ||
| 13 | if [ ! -n "$CHROOTUID" -o ! -x "$CHROOTUID" ]; then | ||
| 14 | echo "You need to install Xephyr to use $0" | ||
| 15 | exit 1 | ||
| 16 | fi | ||
| 17 | |||
| 18 | |||
| 19 | case $# in | ||
| 20 | 0) | ||
| 21 | echo "Invalid arguments." | ||
| 22 | echo "$ $0 <target> [command]" | ||
| 23 | exit 1 | ||
| 24 | ;; | ||
| 25 | 1) | ||
| 26 | ROOTFS=$1 | ||
| 27 | shift | ||
| 28 | # Set $1 to be the boot script | ||
| 29 | set -- /usr/bin/poky-chroot-launch | ||
| 30 | ;; | ||
| 31 | *) | ||
| 32 | ROOTFS=$1 | ||
| 33 | shift | ||
| 34 | # Now $1 onwards are the command and arguments to run | ||
| 35 | ;; | ||
| 36 | esac | ||
| 37 | |||
| 38 | test -f "$ROOTFS/.pokychroot" || { echo "$ROOTFS is not setup for use as a Poky chroot." ; exit 1 ;} | ||
| 39 | |||
| 40 | set -e | ||
| 41 | |||
| 42 | # chrootuid doesn't handle relative paths, so ensure that the rootfs path is | ||
| 43 | # absolute | ||
| 44 | if test ${ROOTFS:0:1} != /; then | ||
| 45 | ROOTFS="$(pwd)/$ROOTFS" | ||
| 46 | fi | ||
| 47 | |||
| 48 | safe_mount() { | ||
| 49 | if ! mountpoint -q "$ROOTFS/$1"; then | ||
| 50 | sudo mount --bind $1 "$ROOTFS/$1" | ||
| 51 | fi | ||
| 52 | } | ||
| 53 | safe_umount() { | ||
| 54 | if mountpoint -q "$ROOTFS/$1"; then | ||
| 55 | sudo umount "$ROOTFS/$1" | ||
| 56 | fi | ||
| 57 | } | ||
| 58 | |||
| 59 | # Mount the directories we need | ||
| 60 | for m in /dev /dev/pts /dev/shm /proc /sys /tmp; do | ||
| 61 | safe_mount $m | ||
| 62 | done | ||
| 63 | |||
| 64 | # Set up the environment | ||
| 65 | export PATH=/bin:/usr/bin:/sbin:/usr/sbin | ||
| 66 | export HOME=/home/$USER | ||
| 67 | |||
| 68 | if [ ! -f "$ROOTFS/.pokychroot.init" ]; then | ||
| 69 | sudo $CHROOTUID -i "$ROOTFS" $USER /bin/sh -c "/usr/bin/poky-chroot-init" | ||
| 70 | touch "$ROOTFS/.pokychroot.init" | ||
| 71 | fi | ||
| 72 | |||
| 73 | $XEPHYR :1 -ac -screen 640x480x16 & | ||
| 74 | |||
| 75 | # Go go go! | ||
| 76 | sudo $CHROOTUID -i "$ROOTFS" $USER "$@" || /bin/true | ||
| 77 | |||
| 78 | # Trap term signals so we don't kill ourselves | ||
| 79 | trap true TERM | ||
| 80 | # send term signal to the process group | ||
| 81 | kill -- -$$ | ||
| 82 | |||
| 83 | # Unmount TODO: only umount if there are no other sessions active, somehow. | ||
| 84 | for m in /tmp /sys /proc /dev/shm /dev/pts /dev; do | ||
| 85 | safe_umount $m | ||
| 86 | done | ||
diff --git a/scripts/poky-chroot-setup b/scripts/poky-chroot-setup deleted file mode 100755 index 209efd6df4..0000000000 --- a/scripts/poky-chroot-setup +++ /dev/null | |||
| @@ -1,31 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # | ||
| 3 | # Script to extract a poky qemux86 rootfs and prepare it for | ||
| 4 | # use as a chroot | ||
| 5 | # | ||
| 6 | |||
| 7 | set -e | ||
| 8 | |||
| 9 | case $# in | ||
| 10 | 2) | ||
| 11 | TGZ=$1 | ||
| 12 | TARGET=$2 | ||
| 13 | ;; | ||
| 14 | *) | ||
| 15 | echo "Invalid arguments, please run as:" | ||
| 16 | echo "$ $0 <qemux86-rootfs.tar.gz> <target-directory>" | ||
| 17 | exit 1 | ||
| 18 | esac | ||
| 19 | |||
| 20 | echo "Extracting $TGZ into $TARGET" | ||
| 21 | |||
| 22 | test -d "$TARGET" && { echo "$TARGET already exists, please remove and retry or specify a dirferent directory." ; exit 1 ; } | ||
| 23 | mkdir --parents "$TARGET" | ||
| 24 | |||
| 25 | tar -C "$TARGET" --exclude ./dev/\* -jxp -f "$TGZ" | ||
| 26 | echo "HAVE_TOUCHSCREEN=0" >> "$TARGET/etc/formfactor/machconfig" | ||
| 27 | echo "DISPLAY_WIDTH_PIXELS=640" >> "$TARGET/etc/formfactor/machconfig" | ||
| 28 | echo "DISPLAY_HEIGHT_PIXELS=480" >> "$TARGET/etc/formfactor/machconfig" | ||
| 29 | cp /etc/passwd "$TARGET/etc/passwd" | ||
| 30 | cp /etc/resolv.conf "$TARGET/etc/resolv.conf" | ||
| 31 | touch "$TARGET/.pokychroot" | ||
