Script: softice-osc-setup

From SOFTICE

Jump to: navigation, search


#!/bin/bash
# copyleft Alessio Gaspar, SOFTICE project, 2006/07/17
# file:         $SOFTICE_ROOT/osc/bin/softice-osc-setup
# chmod:        executable by anyone (should be the user installing his/her own stuff)

# populate user account with all the data necessary for the student
# to work on the softice osc labs


# configuration of our softice installation
SOFTICE_ROOT="/softice"
WHEREWECOMEFROM="`pwd`"
what="softice-osc-setup"

#let's first figure out if we're running for osc or elsa labs
TAG="osc"


# Let's configure the environment depending on the lab series
# location of the files in students' home directory
HOMERUN="$HOME/.softice-$TAG"



# creating .softice-osc
        echo "$what [step: 1]   creating $HOMERUN...."
        cd ~/
        mkdir $HOMERUN


# copy the configurations for students to be able to run konqueror in "softice" profile
        echo "$what [step: 2]   copying config files"
        cd ~/
        cp -r   $SOFTICE_ROOT/$TAG/homerun/.kde/  .
        cp      $SOFTICE_ROOT/$TAG/homerun/.bashrc  .
        #cp     $SOFTICE_ROOT/$TAG/homerun/.bash_profile  .
        # commented out on 9/14/07 by Matt Rideout to fix overwrite problem


# copying virtual machine files
        echo "$what [step: 3]   copying virtual machine"
        cd $HOMERUN
        cp -r $SOFTICE_ROOT/$TAG/homerun/* .


# configure the config.rfs
        echo "$what [step: 4]   configuring UML virtual machine"
        cd $HOMERUN
        # the current config.rfs is meant to mount inside /root/SOFTICE_USER_ACCOUNT/ directory
        # of the virtual machine the /home/students
        # the code below would make it so that we mount directly the user account
#       mkdir lp
#       mount config.rfs lp -o loop
#       cd lp
#       rm username.dat
#       echo "$HOME" >! username.dat
#       cd ..
#       umount lp
#       rmdir lp

# apply the chown and chmod to the whole user account

        echo "$what [step: 5]   fixing access rights"
        chmod    u+rwx  $HOMERUN
        chmod -R u+rw   $HOMERUN/*

        USER_ID="`/usr/bin/id -n -u`"
        chown -R $USER_ID:students      $HOMERUN
        chmod    og-rwx                 ~/ ~/.kde $HOMERUN


cd $WHEREWECOMEFROM