Fix correct commit hash for release 0.7.0 of openXC7
[dev-env-setup.git] / cp-scripts-to-chroot
1 #!/bin/bash
2 # useful script which copies dev-env-setup into a named chroot.
3 # (when setting up chroots, this is needed every time)
4
5 if [ "$EUID" -ne 0 ]
6 then echo "Please run as root"
7 exit
8 fi
9 if [ -z "$1" ]
10 then echo "Need arg $1 to specify which chroot to copy scripts to!"
11 exit
12 fi
13
14 chrootdir="$1"
15
16 if [ -e /opt/chroot/$chrootdir ]; then
17
18 cur_dir=$(pwd | grep -o '[^/]*$')
19 if [ "$cur_dir" == "dev-env-setup" ]; then
20 echo "Copy over the dev-env-setup scripts to $chrootdir environment"
21 cp -R ../dev-env-setup /opt/chroot/$chrootdir/home/$SUDO_USER/
22 chown -R $SUDO_USER /opt/chroot/$chrootdir/home/$SUDO_USER/dev-env-setup
23 chgrp -R $SUDO_USER /opt/chroot/$chrootdir/home/$SUDO_USER/dev-env-setup
24 else
25 echo "This script must be run from dev-env-setup directory!"
26 fi
27 else
28 echo "$chrootdir environment does not exist, cannot copy scripts!"
29 fi
30