Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update cob-stud installation #85

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion cob-stud-clients/README.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

==== Install Ubuntu 14.04 LTS
----
username: ipa
username: stud-admin
systemname: cob-stud-<client number>
password: ****
----
Expand Down Expand Up @@ -35,9 +35,12 @@ $ sudo sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/g' /etc/ss

==== Gain root rights for admin user's
----
$ sudo adduser --home /home-local/Admin Admin --force-badname
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you use Admin with capital A? we always use lower case names for accounts

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes with a capital A, admin is already a group.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about stud-admin user, then?

$ sudo adduser Admin sudo
$ sudo nano /etc/sudoers
##add to the list###
stud-admin ALL=(ALL) NOPASSWD: ALL
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this mean we can delete stud-admin?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, stud-admin has still sudo rights, but it is a pool account and not a local one. This user is also the administrator for cob-kitchen-svr

Admin ALL=(ALL) NOPASSWD: ALL
----


Expand Down Expand Up @@ -138,3 +141,13 @@ $ rosdep update
$ sudo apt-get install python-rosinstall python-rosdep
$ sudo apt-get install python-setuptools ogre-tools
----

=== Extra tools

----
$ sudo cp ~/setup/cob-stud-clients/upstart_lightdm /etc/init.d/.
$ sudo update-rc.d upstart_lightdm defaults
$ sudo cp ~/setup/cob-stud-clients/restart_lightdm /usr/sbin/.
$ sudo cp ~/setup/cob-stud-clients/restart_lock /etc/init.d/.
$ sudo update-rc.d restart_lock defaults
----
11 changes: 1 addition & 10 deletions cob-stud-clients/cob-stud-execute.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,7 @@ cob-stud-3
cob-stud-4
cob-stud-5
cob-stud-6
cob-stud-7
cob-stud-8
cob-stud-9
cob-stud-101
cob-stud-102
cob-stud-103
cob-stud-104
cob-stud-601
cob-stud-602
cob-stud-603"
cob-stud-7"

for client in $client_list; do
echo "-------------------------------------------"
Expand Down
12 changes: 1 addition & 11 deletions cob-stud-clients/cob-stud-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,13 @@ cob-stud-3
cob-stud-4
cob-stud-5
cob-stud-6
cob-stud-7
cob-stud-8
cob-stud-9
cob-stud-101
cob-stud-102
cob-stud-103
cob-stud-104
cob-stud-601
cob-stud-602
cob-stud-603"
cob-stud-7"

for client in $client_list; do
echo "-------------------------------------------"
echo "Installing <<"$*">> on $client"
echo "-------------------------------------------"
echo ""
#ssh $client "sudo apt-get install $* -y"
ssh $client "sudo apt-get install $* "
ret=${PIPESTATUS[0]}
if [ $ret != 0 ] ; then
Expand Down
2 changes: 2 additions & 0 deletions cob-stud-clients/restart_lightdm
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sudo mount -a
sudo service lightdm restart&
13 changes: 13 additions & 0 deletions cob-stud-clients/restart_lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
export DISPLAY=:0 && dbus-monitor --session "type='signal',interface='org.gnome.ScreenSaver'" | \
(
while true; do
read X
if echo $X | grep "boolean true" &> /dev/null; then
echo SCREEN_LOCKED;
elif echo $X | grep "boolean false" &> /dev/null; then
sudo mount -a;
sleep 1;
fi
done
)
7 changes: 2 additions & 5 deletions cob-stud-clients/stud-adduser
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ client_list="
cob-stud-1
cob-stud-2
cob-stud-3
cob-stud-4
cob-stud-5
cob-stud-6
cob-stud-7
cob-stud-101
cob-stud-102
cob-stud-103
cob-stud-104"
cob-stud-7"

echo "Executing adduser"
sudo /usr/sbin/adduser $1
Expand Down
33 changes: 33 additions & 0 deletions cob-stud-clients/sync_packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this well tested? can this be used for the robot pcs too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested and adapted for the robots! ipa320/setup_cob4#51

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please consider updated scripts for robot as proposed in ipa320/setup_cob4#84

is it possible to make the pcs list configurable from outside of the script and use the functional part for both robots and cob-stud-pcs.... ➡️ harmonization and less maintenance...


sudo apt list --installed > /tmp/package_list
perl -pi -e 's{ / .*? ]}{}x' /tmp/package_list
sed -i 's/Listing...//' /tmp/package_list
sed -i ':a;N;$!ba;s/\n/ /g' /tmp/package_list
tr '\n' ' ' < /tmp/package_list | sed -i '$s/ $/\n/' /tmp/package_list
packages=$(cat /tmp/package_list)

pcs="
cob-stud-1
cob-stud-2
cob-stud-3
cob-stud-4
cob-stud-5
cob-stud-6
cob-stud-7"

for i in $pcs; do
echo "-------------------------------------------"
echo "Installing packages on $i"
echo "-------------------------------------------"
echo ""
ssh $i "sudo apt-get update"
ssh $i "sudo apt-get install $packages -y"
ret=${PIPESTATUS[0]}
if [ $ret != 0 ] ; then
echo -t "apt-get return an error (error code: $ret), aborting..."
exit 1
fi
echo ""
done

7 changes: 7 additions & 0 deletions cob-stud-clients/upstart_lightdm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
while ! ping -c 1 -W 1 10.0.1.2; do
echo "Waiting for 10.0.1.2 - network interface might be down..."
sleep 1
done
sudo mount -a
sudo service lightdm restart
2 changes: 2 additions & 0 deletions restart_lightdm
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sudo mount -a
sudo service lightdm restart&
13 changes: 13 additions & 0 deletions restart_lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
export DISPLAY=:0 && dbus-monitor --session "type='signal',interface='org.gnome.ScreenSaver'" | \
(
while true; do
read X
if echo $X | grep "boolean true" &> /dev/null; then
echo SCREEN_LOCKED;
elif echo $X | grep "boolean false" &> /dev/null; then
sudo mount -a;
sleep 1;
fi
done
)
7 changes: 7 additions & 0 deletions upstart_lightdm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
while ! ping -c 1 -W 1 10.0.1.2; do
echo "Waiting for 10.0.1.2 - network interface might be down..."
sleep 1
done
sudo mount -a
sudo service lightdm restart