Skip to content

Commit

Permalink
Merge pull request SyneRBI#64 from CCPPETMR/initial_script
Browse files Browse the repository at this point in the history
Initial script to be run manually at VM creation.
  • Loading branch information
paskino authored Feb 27, 2018
2 parents ab85984 + f644335 commit 81d9007
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 4 deletions.
39 changes: 39 additions & 0 deletions scripts/first_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#! /bin/bash

#========================================================================
# Author: Edoardo Pasca
# Copyright 2018 Science Technology Facilities Council
#
# This file is part of the CCP PETMR Synergistic Image Reconstruction Framework (SIRF) virtual machine.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0.txt
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#=========================================================================

# script to adjust gnome settings and other bits to be run only once
# after VM is created

PID=$(pgrep -u sirfuser gnome-session)
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ|cut -d= -f2-)
export DISPLAY=$(grep -z DISPLAY /proc/$PID/environ | cut -d= -f2-)
#echo "display " $DISPLAY " dbus " $DBUS_SESSION_BUS_ADDRESS

# add input sources
gsettings set org.gnome.desktop.input-sources sources "[('xkb','uk'), ('xkb','us'),('xkb','de'),('xkb','fr'),('xkb','es'),('xkb','it'),('xkb','pt'),('xkb','br'),('xkb','jp'),('xkb','cn')]"
# remove screen lock for sirfuser
gsettings set org.gnome.desktop.lockdown disable-lock-screen 'true'

#zerofill
dd if=/dev/zero of=/tmp/EMPTY bs=1M
rm -f /tmp/EMPTY

28 changes: 24 additions & 4 deletions vagrant/Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
#========================================================================
# Author: Edoardo Pasca, Ben Thomas
# Copyright 2018 University College London
# Copyright 2018 Science Technology Facilities Council
#
# This file is part of the CCP PETMR Synergistic Image Reconstruction Framework (SIRF) virtual machine.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0.txt
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#=========================================================================

Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.synced_folder '.', '/vagrant', disabled: true
Expand Down Expand Up @@ -95,6 +116,7 @@ Vagrant.configure("2") do |config|
sudo locale-gen en_US.UTF-8
sudo locale-gen de_DE.UTF-8
sudo locale-gen fr_FR.UTF-8
sudo locale-gen es_ES.UTF-8
sudo locale-gen it_IT.UTF-8
sudo locale-gen pt_PT.UTF-8
sudo locale-gen pt_BR.UTF-8
Expand All @@ -115,10 +137,8 @@ Vagrant.configure("2") do |config|
sudo echo 'SystemAccount=true' >> vagrant
sudo cp -v vagrant /var/lib/AccountsService/users/vagrant
# To Ubuntu user from login screen:
#sudo echo '[User]' > Ubuntu
#sudo echo 'SystemAccount=true' >> Ubuntu
#sudo cp -v Ubuntu /var/lib/AccountsService/users/Ubuntu
# To remove the Ubuntu user from VM:
sudo deluser --remove-home ubuntu
# Could add custom logos here: /etc/gdm3/greeter.dconf-defaults
cd /opt
Expand Down

0 comments on commit 81d9007

Please sign in to comment.