Install script, fix Discworld directory
This commit is contained in:
parent
5224688158
commit
fd43c15bcd
12
Discworld
12
Discworld
@ -1,6 +1,9 @@
|
|||||||
# Change to the 'discworld-tintin' directory and remove the input history file
|
# Change to the 'discworld-tintin' directory and remove the input history file
|
||||||
cd "$( dirname -- "$( readlink -f -- "$0"; )"; )"
|
export DISCWORLD_DIRECTORY="PACKAGE_DIRECTORY"
|
||||||
|
cd $DISCWORLD_DIRECTORY
|
||||||
|
if [ -e logs/history.log ]; then
|
||||||
rm logs/history.log
|
rm logs/history.log
|
||||||
|
fi
|
||||||
|
|
||||||
# Set hotkeys to switch in/out of "mobile" mode
|
# Set hotkeys to switch in/out of "mobile" mode
|
||||||
tmux bind C-f resize-pane -x 80%
|
tmux bind C-f resize-pane -x 80%
|
||||||
@ -15,9 +18,9 @@ if [[ ! $(tmux ls -F '#S') =~ discworld ]]; then
|
|||||||
rm logs/chat.log && touch logs/chat.log
|
rm logs/chat.log && touch logs/chat.log
|
||||||
|
|
||||||
# Start a new tmux session named "discworld" with our tmuxp setup
|
# Start a new tmux session named "discworld" with our tmuxp setup
|
||||||
tmuxp load -s discworld ./discworld2.yaml
|
echo "No existing discworld session, create a new one"
|
||||||
fi
|
tmuxp load -s discworld ./discworld.yaml
|
||||||
|
else
|
||||||
# If there is already a session, just attach
|
# If there is already a session, just attach
|
||||||
if [ -z "$TMUX" ]; then
|
if [ -z "$TMUX" ]; then
|
||||||
#tmux send-keys 'clear && tt++ -G config.tin' 'C-m'
|
#tmux send-keys 'clear && tt++ -G config.tin' 'C-m'
|
||||||
@ -25,3 +28,4 @@ if [ -z "$TMUX" ]; then
|
|||||||
# If we aren't already inside of TMUX, then attach to our session
|
# If we aren't already inside of TMUX, then attach to our session
|
||||||
tmux -2 attach-session -t discworld -d
|
tmux -2 attach-session -t discworld -d
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|||||||
@ -144,10 +144,11 @@ A short guide to getting the client installed, this package put in place and MUD
|
|||||||
- tmux and [tmuxp](https://github.com/tmux-python/tmuxp) (sudo apt install tmux tmuxp)
|
- tmux and [tmuxp](https://github.com/tmux-python/tmuxp) (sudo apt install tmux tmuxp)
|
||||||
- python 3
|
- python 3
|
||||||
- sqlite 3
|
- sqlite 3
|
||||||
* With package downloaded and requirements installed then `tt++ -G config.tin` will launch
|
* Run "install.sh" to configure your directories and create a global alias
|
||||||
* "Discworld" shell-file exists to setup tmux layout or connect to existing
|
- Will request sudo password to create link in /usr/local/bin
|
||||||
- Recommend symlinking e.g. (`sudo ln -s /home/myuser/discworld-tintin/Discworld /usr/local/bin/disc)
|
* Now you can type "disc" from your terminal to create a new session or connect to an existing one
|
||||||
- Now you can type "disc" from anywhere to launch or connect to the setup
|
- To run just the client without any tmux panes use `tt++ -G config.tin`
|
||||||
|
- The `disc` command runs the `Discworld` script which handles tmux session creation or re-attachment
|
||||||
|
|
||||||
### Configuring the MUD
|
### Configuring the MUD
|
||||||
|
|
||||||
|
|||||||
@ -1,16 +1,16 @@
|
|||||||
---
|
---
|
||||||
session_name: discworld
|
session_name: discworld
|
||||||
|
start_directory: "$DISCWORLD_DIRECTORY"
|
||||||
windows:
|
windows:
|
||||||
- focus: 'true'
|
- focus: 'true'
|
||||||
layout: 459d,144x79,0,0[144x8,0,0,289,144x10,0,9,290,144x59,0,20{116x59,0,20,291,27x59,117,20[27x38,117,20,292,27x10,117,59,293,27x9,117,70,294]}]
|
layout: 459d,144x79,0,0[144x8,0,0,289,144x10,0,9,290,144x59,0,20{116x59,0,20,291,27x59,117,20[27x38,117,20,292,27x10,117,59,293,27x9,117,70,294]}]
|
||||||
options: {}
|
options: {}
|
||||||
panes:
|
panes:
|
||||||
- tail
|
- clear && tail -fs .5 logs/chat.log
|
||||||
- sh
|
- ./bin/mdt
|
||||||
- focus: 'true'
|
- focus: 'true'
|
||||||
shell_command: tt++
|
shell_command: tt++ -G config.tin
|
||||||
- bash
|
- ./bin/dt
|
||||||
- sh
|
- ./bin/grp
|
||||||
- bash
|
- ./bin/map
|
||||||
start_directory: "$(dirname '$0')"
|
|
||||||
window_name: DiscworldMUD
|
window_name: DiscworldMUD
|
||||||
|
|||||||
24
install.sh
Executable file
24
install.sh
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Directory where this script lives
|
||||||
|
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
||||||
|
|
||||||
|
discworld_file="$script_dir/Discworld"
|
||||||
|
|
||||||
|
# Ensure the Discworld file exists
|
||||||
|
if [ ! -f "$discworld_file" ]; then
|
||||||
|
echo "Error: '$discworld_file' not found."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Escape characters that might confuse sed (& and |)
|
||||||
|
escaped_dir=$(printf '%s\n' "$script_dir" | sed 's/[&|]/\\&/g')
|
||||||
|
|
||||||
|
# Replace "PACKAGE_DIRECTORY" on the second line with the full path
|
||||||
|
sed -i "2s|PACKAGE_DIRECTORY|$escaped_dir|" "$discworld_file"
|
||||||
|
|
||||||
|
# Create (or overwrite) the symlink in /usr/local/bin
|
||||||
|
sudo ln -sf "$discworld_file" /usr/local/bin/disc
|
||||||
|
|
||||||
|
echo "The discworld-tintin package is installed, you can now type 'disc' from anywhere to connect"
|
||||||
Loading…
x
Reference in New Issue
Block a user