aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/scripts/install
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/install')
-rwxr-xr-xscripts/install/create_sim.sh75
-rwxr-xr-xscripts/install/go_live.sh12
-rw-r--r--scripts/install/group_migrate.sql48
-rw-r--r--scripts/install/opensim.tmux.conf97
-rwxr-xr-xscripts/install/secure.sh26
5 files changed, 258 insertions, 0 deletions
diff --git a/scripts/install/create_sim.sh b/scripts/install/create_sim.sh
new file mode 100755
index 0000000..b940315
--- /dev/null
+++ b/scripts/install/create_sim.sh
@@ -0,0 +1,75 @@
1#!/bin/bash
2
3source ../common.sh
4getPrgDir
5
6NAME=$1
7LOCATION=$2
8SIZE=$3
9
10cd ${OS_PATH}/config
11
12k=0
13for i in $(seq -w 1 99)
14do
15 if [ -e "sim$i" ]
16 then
17 k=$i
18 fi
19done
20
21if [ "x${NAME}" = "x" ]
22then
23 NAME="No name sim $RANDOM" # Should be unique per grid.
24 echo "WARNING setting the sim name to [${NAME}], this may not be what you want."
25fi
26# Sanitize the name. Not removing [ or ], couldn't get that to work, only important for Windows.
27sim=$(sanitize ${NAME})
28
29if [ "x${LOCATION}" = "x" ]
30then
31 LOCATION="$RANDOM,$RANDOM" # again UNIQUE (i.e. ONLY ONE) per grid in THIS case!
32 echo "WARNING setting the Location to ${LOCATION}, this may not be what you want."
33fi
34
35if [ "x${SIZE}" = "x" ]
36then
37 SIZE="256"
38fi
39
40# Wow, the hoops we have to jump through to avoid octal.
41if [ 9 -gt $k ]; then
42 NUM=$(printf '0%1s' $(( 10#$k + 1 )) )
43else
44 NUM=$(printf '%2s' $(( 10#$k + 1 )) )
45fi
46
47PORT=$(( 9005 + (10#$k * 2) )) # 9002 is used for HTTP/UDP so START with port 9003! CAUTION Diva/D2 starts at port 9000.
48UUID=$(uuidgen)
49
50echo "Creating sim${NUM} on port ${PORT} @ ${LOCATION} - ${NAME}."
51
52cp -r sim_skeleton sim${NUM}
53
54cd sim${NUM}
55sed -i "s@SIM_NAME@${NAME}@g" ThisSim.ini
56sed -i "s@SIM_UUID@${UUID}@g" ThisSim.ini
57sed -i "s@SIM_POS@${LOCATION}@g" ThisSim.ini
58sed -i "s@SIM_INT_PORT@$(( ${PORT} + 1 ))@g" ThisSim.ini
59sed -i "s@SIM_SIZE@${SIZE}@g" ThisSim.ini
60
61ln -s ../../current/scripts/common.sh common.sh
62ln -s ../../current/scripts/start-sim start-sim
63cp -P start-sim backup-sim
64cp -P start-sim stop-sim
65
66sed -i "s@SIM_NUMBER@${NUM}@g" ThisSim.ini
67sed -i "s@SIM_PORT@${PORT}@g" ThisSim.ini
68
69sed -i "s@OS_PATH@${OS_PATH}@g" opensim-monit.conf
70sed -i "s@SIM_NUMBER@${NUM}@g" opensim-monit.conf
71
72mv ThisSim.ini $(sanitize "${NAME}").ini
73
74sudo chown -R ${OS_USER}:${OS_USER} ..
75sudo chmod -R g+w ..
diff --git a/scripts/install/go_live.sh b/scripts/install/go_live.sh
new file mode 100755
index 0000000..c5ce90e
--- /dev/null
+++ b/scripts/install/go_live.sh
@@ -0,0 +1,12 @@
1#!/bin/bash
2
3source common.sh
4
5for i in $(seq 99)
6do
7 j=$(printf "sim%02d" $i)
8 if [ -e "$OSPATH/config/$j" ]
9 then
10 sudo ln -s $OSPATH/config/$j/opensim-monit.conf /etc/monit/conf.d/$j.conf
11 fi
12done
diff --git a/scripts/install/group_migrate.sql b/scripts/install/group_migrate.sql
new file mode 100644
index 0000000..6c15011
--- /dev/null
+++ b/scripts/install/group_migrate.sql
@@ -0,0 +1,48 @@
1INSERT INTO `griddy`.`os_groups_groups`
2(GroupID, Name, Charter, InsigniaID, FounderID, MembershipFee, OpenEnrollment, ShowInList,
3AllowPublish, MaturePublish, OwnerRoleID)
4SELECT GroupID, Name, Charter, InsigniaID, FounderID, MemberShipFee, OpenEnrollment, ShowInList, AllowPublish,
5MaturePublish, OwnerRoleID
6FROM `griddy`.osgroup;
7
8/*fill os_groups_invites in ROBUST database with values from osgroupinvite
9or FlotSam osgroupinvite*/
10INSERT INTO `griddy`.`os_groups_invites`
11(InviteID, GroupID, RoleID, PrincipalID, TMStamp)
12SELECT InviteID, GroupID, RoleID, AgentID, TMStamp
13FROM `griddy`.osgroupinvite;
14
15/*fill os_groups_membership in ROBUST database with values from osgroupmembership
16or FlotSam osgroupmembership*/
17INSERT INTO `griddy`.`os_groups_membership`
18(GroupID, PrincipalID, SelectedRoleID, Contribution, ListInProfile, AcceptNotices)
19SELECT GroupID, AgentID, SelectedRoleID, Contribution, ListInProfile, AcceptNotices
20FROM `griddy`.osgroupmembership;
21
22/*fill os_groups_notices in ROBUST database with values from osgroupnotice
23or FlotSam osgroupnotice*/
24INSERT INTO `griddy`.`os_groups_notices`
25(GroupID, NoticeID, TMStamp, FromName, Subject, Message)
26SELECT GroupID, NoticeID, Timestamp, FromName, Subject, Message
27FROM `griddy`.osgroupnotice;
28
29/*fill os_groups_principals in ROBUST database with values from osagent
30or FlotSam osagent*/
31INSERT INTO `griddy`.`os_groups_principals`
32(PrincipalID, ActiveGroupID)
33SELECT AgentID, ActiveGroupID
34FROM `griddy`.osagent;
35
36/*fill os_groups_rolemembership in ROBUST database with values from osrolemembership
37or FlotSam osgrouprolemembership*/
38INSERT INTO `griddy`.os_groups_rolemembership
39(GroupID, RoleID, PrincipalID)
40SELECT GroupID, RoleID, AgentID
41FROM `griddy`.osgrouprolemembership;
42
43/*fill os_groups_roles in ROBUST database with values from osroles
44or FlotSam osrole*/
45INSERT INTO `griddy`.os_groups_roles
46(GroupID, RoleID, Name, Description, Title, Powers)
47SELECT GroupID, RoleID, Name, Description, Title, Powers
48FROM `griddy`.osrole;
diff --git a/scripts/install/opensim.tmux.conf b/scripts/install/opensim.tmux.conf
new file mode 100644
index 0000000..84e0c21
--- /dev/null
+++ b/scripts/install/opensim.tmux.conf
@@ -0,0 +1,97 @@
1# Tmux has a habit of changing what these options are for each version, so this is a bit of a mess.
2
3# Screen compatibility, change the command key. And rebind the prefix sending command.
4set-option -g prefix C-a
5unbind-key C-b
6bind-key C-a send-prefix
7
8# r reloads the configuration, handy
9bind r source-file ~/.tmux.conf
10
11bind R clear-history
12
13# More sane pane gain. B-)
14unbind % # Remove default binding since we’re replacing them.
15unbind '"'
16bind | split-window -h
17bind - split-window -v
18
19# set-options -g global, -s server, -w window, otherwise a session option.
20# -a appends a string to the existing option.
21# -u unsets an option.
22# -o prevents setting an aption if it is already set.
23# -q shut up info messages.
24
25# SESSION OPTIONS
26
27set-option -g bell-action any
28set-option -g bell-on-alert on
29
30# Not actually documented what the limit is, but there is one.
31set-option -g history-limit 100000
32
33# All this mouse stuff is unreliable in UTF8 mode. At least on roxterm.
34# Also keep in mind the terminal specs mouse report limit of 256 characters, being less than my typical terminal width.
35# Hmm, still wont pass mouse through like the docs say they will.
36# Ah, mc needs "mc -x". Though once again, watch that right edge on huge terminals.
37# These three wont work under Ubuntu 16.04.
38##set-option -g mouse-resize-pane on
39##set-option -g mouse-select-pane on
40##set-option -g mouse-select-window on
41# This wont work under Ubuntu 16.04.
42##set-option -g mode-mouse on # on - mouse does copy mode stuff; copy-mode - mouse can't go into copy mode, but does stuff once in there; off - mouse is unmolested.
43# Instead do this (also defaults to turning on the above three mouse things) -
44set-option -g mouse on
45# Or this. sigh
46#set-option -g mouse
47##set-option -g mouse-utf8 off # Defaults to on.
48
49set-option -g set-remain-on-exit on
50
51# How to set the title of the terminal window.
52set-option -g set-titles on
53set-option -g set-titles-string '#W' # Default is "#S:#I:#W - "#T""
54
55set-option -g status-interval 1 # Redraw status line every second, for the clock.
56set-option -g status-justify centre # Window list in the middle.
57##set-option -g status-utf8 on
58
59# Character pair Replaced with
60 #(shell-command) First line of the command's output
61 #[attributes] Colour or attribute change
62 #H Hostname of local host (not FDQN)
63 #h Hostname of local host without the domain name
64 #F Current window flag
65 #I Current window index
66 #D Current pane unique identifier
67 #P Current pane index
68 #S Session name
69 #T Current pane title
70 #W Current window name
71 ## A literal ‘#’
72
73# Yes, my terminal really is bigger than 160 characters.
74set-option -g status-left-length 42
75#set-option -g status-left '[#H #S #F]'
76set-option -g status-left '#H [#S:#I.#P]#F'
77set-option -g status-right-length 64
78set-option -g status-right "%F #(uptime | cut -d ' ' -f 2-2,10-)" # %F is ISO date, uptime starts with the current time, and ends with the load average. B-)
79
80# Set window notifications
81set-option -g visual-activity on # Show status message for activity in monitor-activity windows.
82#set-option -g visual-content on # Show status message for content in monitor-content windows. Based on a fnmatch(3) string.
83set-option -g visual-silence on # Show status message for silence in monitor-silence windows. Based on a set interval.
84
85set-option -gw alternate-screen off # Don't save the original screen before starting tmux, may also allow use of the terminals original scrollback buffer.
86set-option -gw clock-mode-style 24 # We are using the uptime clock anyway, so this is pointless.
87
88# Highlight active window
89set-option -gw window-status-current-bg red
90set-option -gw window-status-current-format '[#I:#W]'
91set-option -gw window-status-format '[#I:#W]#F'
92
93# Set window notifications
94set-option -gw monitor-activity on # Bell on activity.
95
96# We want 256 colours in our terminal.
97set-option -g default-terminal "screen-256color"
diff --git a/scripts/install/secure.sh b/scripts/install/secure.sh
new file mode 100755
index 0000000..95aae84
--- /dev/null
+++ b/scripts/install/secure.sh
@@ -0,0 +1,26 @@
1#!/bin/bash
2
3source ../common.sh
4
5echo "Securing OpenSim."
6sudo chmod 600 ${OS_PATH}/config/*.ini
7sudo chmod 600 ${OS_PATH}/config/ROBUST/*.ini
8sudo chown -R ${OS_USER}:${OS_USER} ${OS_PATH}
9sudo chmod -R 775 ${OS_PATH}
10sudo chmod -R a-x ${OS_PATH}
11sudo chmod -R a+X ${OS_PATH}
12sudo chmod -R g+w ${OS_PATH}
13sudo chmod -R a+x ${OS_PATH}/current/*.sh
14sudo chmod -R a+x ${OS_PATH}/current/scripts/*.sh
15sudo chmod -R a+x ${OS_PATH}/current/scripts/install/*.sh
16sudo chmod a+x ${OS_PATH}/current/scripts/show-console
17sudo chmod a+x ${OS_PATH}/current/scripts/start-sim
18
19sudo chmod ug+rwx ${OS_PATH}/config
20sudo chmod g+s ${OS_PATH}/config
21sudo chmod 600 ${OS_PATH}/config/*.ini
22sudo chmod 600 ${OS_PATH}/config/ROBUST/*.ini
23
24chmod ug+rwx ${OS_PATH}/caches
25chmod o-rwx ${OS_PATH}/caches
26chmod g+s ${OS_PATH}/caches