add minicom to dependencies
[dev-env-setup.git] / cp-scripts-to-chroot
1 #!/bin/bash
2 if [ "$EUID" -ne 0 ]
3 then echo "Please run as root"
4 exit
5 fi
6 if [ -z "$1" ]
7 then echo "Need arg $1 to specify which chroot to copy scripts to!"
8 exit
9 fi
10
11 chrootdir="$1"
12
13 if [ -e /opt/chroot/$chrootdir ]; then
14
15 cur_dir=$(pwd | grep -o '[^/]*$')
16 if [ "$cur_dir" == "dev-env-setup" ]; then
17 echo "Copy over the dev-env-setup scripts to $chrootdir environment"
18 cp -R ../dev-env-setup /opt/chroot/$chrootdir/home/$SUDO_USER/
19 chown -R $SUDO_USER /opt/chroot/$chrootdir/home/$SUDO_USER/dev-env-setup
20 chgrp -R $SUDO_USER /opt/chroot/$chrootdir/home/$SUDO_USER/dev-env-setup
21 else
22 echo "This script must be run from dev-env-setup directory!"
23 fi
24 else
25 echo "$chrootdir environment does not exist, cannot copy scripts!"
26 fi
27