diff options
Diffstat (limited to 'scripts/install')
-rwxr-xr-x | scripts/install/create_sim.sh | 75 | ||||
-rwxr-xr-x | scripts/install/go_live.sh | 12 | ||||
-rw-r--r-- | scripts/install/group_migrate.sql | 48 | ||||
-rw-r--r-- | scripts/install/opensim.tmux.conf | 97 | ||||
-rwxr-xr-x | scripts/install/secure.sh | 26 |
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 | |||
3 | source ../common.sh | ||
4 | getPrgDir | ||
5 | |||
6 | NAME=$1 | ||
7 | LOCATION=$2 | ||
8 | SIZE=$3 | ||
9 | |||
10 | cd ${OS_PATH}/config | ||
11 | |||
12 | k=0 | ||
13 | for i in $(seq -w 1 99) | ||
14 | do | ||
15 | if [ -e "sim$i" ] | ||
16 | then | ||
17 | k=$i | ||
18 | fi | ||
19 | done | ||
20 | |||
21 | if [ "x${NAME}" = "x" ] | ||
22 | then | ||
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." | ||
25 | fi | ||
26 | # Sanitize the name. Not removing [ or ], couldn't get that to work, only important for Windows. | ||
27 | sim=$(sanitize ${NAME}) | ||
28 | |||
29 | if [ "x${LOCATION}" = "x" ] | ||
30 | then | ||
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." | ||
33 | fi | ||
34 | |||
35 | if [ "x${SIZE}" = "x" ] | ||
36 | then | ||
37 | SIZE="256" | ||
38 | fi | ||
39 | |||
40 | # Wow, the hoops we have to jump through to avoid octal. | ||
41 | if [ 9 -gt $k ]; then | ||
42 | NUM=$(printf '0%1s' $(( 10#$k + 1 )) ) | ||
43 | else | ||
44 | NUM=$(printf '%2s' $(( 10#$k + 1 )) ) | ||
45 | fi | ||
46 | |||
47 | PORT=$(( 9005 + (10#$k * 2) )) # 9002 is used for HTTP/UDP so START with port 9003! CAUTION Diva/D2 starts at port 9000. | ||
48 | UUID=$(uuidgen) | ||
49 | |||
50 | echo "Creating sim${NUM} on port ${PORT} @ ${LOCATION} - ${NAME}." | ||
51 | |||
52 | cp -r sim_skeleton sim${NUM} | ||
53 | |||
54 | cd sim${NUM} | ||
55 | sed -i "s@SIM_NAME@${NAME}@g" ThisSim.ini | ||
56 | sed -i "s@SIM_UUID@${UUID}@g" ThisSim.ini | ||
57 | sed -i "s@SIM_POS@${LOCATION}@g" ThisSim.ini | ||
58 | sed -i "s@SIM_INT_PORT@$(( ${PORT} + 1 ))@g" ThisSim.ini | ||
59 | sed -i "s@SIM_SIZE@${SIZE}@g" ThisSim.ini | ||
60 | |||
61 | ln -s ../../current/scripts/common.sh common.sh | ||
62 | ln -s ../../current/scripts/start-sim start-sim | ||
63 | cp -P start-sim backup-sim | ||
64 | cp -P start-sim stop-sim | ||
65 | |||
66 | sed -i "s@SIM_NUMBER@${NUM}@g" ThisSim.ini | ||
67 | sed -i "s@SIM_PORT@${PORT}@g" ThisSim.ini | ||
68 | |||
69 | sed -i "s@OS_PATH@${OS_PATH}@g" opensim-monit.conf | ||
70 | sed -i "s@SIM_NUMBER@${NUM}@g" opensim-monit.conf | ||
71 | |||
72 | mv ThisSim.ini $(sanitize "${NAME}").ini | ||
73 | |||
74 | sudo chown -R ${OS_USER}:${OS_USER} .. | ||
75 | sudo 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 | |||
3 | source common.sh | ||
4 | |||
5 | for i in $(seq 99) | ||
6 | do | ||
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 | ||
12 | done | ||
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 @@ | |||
1 | INSERT INTO `griddy`.`os_groups_groups` | ||
2 | (GroupID, Name, Charter, InsigniaID, FounderID, MembershipFee, OpenEnrollment, ShowInList, | ||
3 | AllowPublish, MaturePublish, OwnerRoleID) | ||
4 | SELECT GroupID, Name, Charter, InsigniaID, FounderID, MemberShipFee, OpenEnrollment, ShowInList, AllowPublish, | ||
5 | MaturePublish, OwnerRoleID | ||
6 | FROM `griddy`.osgroup; | ||
7 | |||
8 | /*fill os_groups_invites in ROBUST database with values from osgroupinvite | ||
9 | or FlotSam osgroupinvite*/ | ||
10 | INSERT INTO `griddy`.`os_groups_invites` | ||
11 | (InviteID, GroupID, RoleID, PrincipalID, TMStamp) | ||
12 | SELECT InviteID, GroupID, RoleID, AgentID, TMStamp | ||
13 | FROM `griddy`.osgroupinvite; | ||
14 | |||
15 | /*fill os_groups_membership in ROBUST database with values from osgroupmembership | ||
16 | or FlotSam osgroupmembership*/ | ||
17 | INSERT INTO `griddy`.`os_groups_membership` | ||
18 | (GroupID, PrincipalID, SelectedRoleID, Contribution, ListInProfile, AcceptNotices) | ||
19 | SELECT GroupID, AgentID, SelectedRoleID, Contribution, ListInProfile, AcceptNotices | ||
20 | FROM `griddy`.osgroupmembership; | ||
21 | |||
22 | /*fill os_groups_notices in ROBUST database with values from osgroupnotice | ||
23 | or FlotSam osgroupnotice*/ | ||
24 | INSERT INTO `griddy`.`os_groups_notices` | ||
25 | (GroupID, NoticeID, TMStamp, FromName, Subject, Message) | ||
26 | SELECT GroupID, NoticeID, Timestamp, FromName, Subject, Message | ||
27 | FROM `griddy`.osgroupnotice; | ||
28 | |||
29 | /*fill os_groups_principals in ROBUST database with values from osagent | ||
30 | or FlotSam osagent*/ | ||
31 | INSERT INTO `griddy`.`os_groups_principals` | ||
32 | (PrincipalID, ActiveGroupID) | ||
33 | SELECT AgentID, ActiveGroupID | ||
34 | FROM `griddy`.osagent; | ||
35 | |||
36 | /*fill os_groups_rolemembership in ROBUST database with values from osrolemembership | ||
37 | or FlotSam osgrouprolemembership*/ | ||
38 | INSERT INTO `griddy`.os_groups_rolemembership | ||
39 | (GroupID, RoleID, PrincipalID) | ||
40 | SELECT GroupID, RoleID, AgentID | ||
41 | FROM `griddy`.osgrouprolemembership; | ||
42 | |||
43 | /*fill os_groups_roles in ROBUST database with values from osroles | ||
44 | or FlotSam osrole*/ | ||
45 | INSERT INTO `griddy`.os_groups_roles | ||
46 | (GroupID, RoleID, Name, Description, Title, Powers) | ||
47 | SELECT GroupID, RoleID, Name, Description, Title, Powers | ||
48 | FROM `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. | ||
4 | set-option -g prefix C-a | ||
5 | unbind-key C-b | ||
6 | bind-key C-a send-prefix | ||
7 | |||
8 | # r reloads the configuration, handy | ||
9 | bind r source-file ~/.tmux.conf | ||
10 | |||
11 | bind R clear-history | ||
12 | |||
13 | # More sane pane gain. B-) | ||
14 | unbind % # Remove default binding since we’re replacing them. | ||
15 | unbind '"' | ||
16 | bind | split-window -h | ||
17 | bind - 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 | |||
27 | set-option -g bell-action any | ||
28 | set-option -g bell-on-alert on | ||
29 | |||
30 | # Not actually documented what the limit is, but there is one. | ||
31 | set-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) - | ||
44 | set-option -g mouse on | ||
45 | # Or this. sigh | ||
46 | #set-option -g mouse | ||
47 | ##set-option -g mouse-utf8 off # Defaults to on. | ||
48 | |||
49 | set-option -g set-remain-on-exit on | ||
50 | |||
51 | # How to set the title of the terminal window. | ||
52 | set-option -g set-titles on | ||
53 | set-option -g set-titles-string '#W' # Default is "#S:#I:#W - "#T"" | ||
54 | |||
55 | set-option -g status-interval 1 # Redraw status line every second, for the clock. | ||
56 | set-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. | ||
74 | set-option -g status-left-length 42 | ||
75 | #set-option -g status-left '[#H #S #F]' | ||
76 | set-option -g status-left '#H [#S:#I.#P]#F' | ||
77 | set-option -g status-right-length 64 | ||
78 | set-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 | ||
81 | set-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. | ||
83 | set-option -g visual-silence on # Show status message for silence in monitor-silence windows. Based on a set interval. | ||
84 | |||
85 | set-option -gw alternate-screen off # Don't save the original screen before starting tmux, may also allow use of the terminals original scrollback buffer. | ||
86 | set-option -gw clock-mode-style 24 # We are using the uptime clock anyway, so this is pointless. | ||
87 | |||
88 | # Highlight active window | ||
89 | set-option -gw window-status-current-bg red | ||
90 | set-option -gw window-status-current-format '[#I:#W]' | ||
91 | set-option -gw window-status-format '[#I:#W]#F' | ||
92 | |||
93 | # Set window notifications | ||
94 | set-option -gw monitor-activity on # Bell on activity. | ||
95 | |||
96 | # We want 256 colours in our terminal. | ||
97 | set-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 | |||
3 | source ../common.sh | ||
4 | |||
5 | echo "Securing OpenSim." | ||
6 | sudo chmod 600 ${OS_PATH}/config/*.ini | ||
7 | sudo chmod 600 ${OS_PATH}/config/ROBUST/*.ini | ||
8 | sudo chown -R ${OS_USER}:${OS_USER} ${OS_PATH} | ||
9 | sudo chmod -R 775 ${OS_PATH} | ||
10 | sudo chmod -R a-x ${OS_PATH} | ||
11 | sudo chmod -R a+X ${OS_PATH} | ||
12 | sudo chmod -R g+w ${OS_PATH} | ||
13 | sudo chmod -R a+x ${OS_PATH}/current/*.sh | ||
14 | sudo chmod -R a+x ${OS_PATH}/current/scripts/*.sh | ||
15 | sudo chmod -R a+x ${OS_PATH}/current/scripts/install/*.sh | ||
16 | sudo chmod a+x ${OS_PATH}/current/scripts/show-console | ||
17 | sudo chmod a+x ${OS_PATH}/current/scripts/start-sim | ||
18 | |||
19 | sudo chmod ug+rwx ${OS_PATH}/config | ||
20 | sudo chmod g+s ${OS_PATH}/config | ||
21 | sudo chmod 600 ${OS_PATH}/config/*.ini | ||
22 | sudo chmod 600 ${OS_PATH}/config/ROBUST/*.ini | ||
23 | |||
24 | chmod ug+rwx ${OS_PATH}/caches | ||
25 | chmod o-rwx ${OS_PATH}/caches | ||
26 | chmod g+s ${OS_PATH}/caches | ||