Install script, fix Discworld directory
This commit is contained in:
parent
5224688158
commit
fd43c15bcd
26
Discworld
26
Discworld
@ -1,6 +1,9 @@
|
||||
# Change to the 'discworld-tintin' directory and remove the input history file
|
||||
cd "$( dirname -- "$( readlink -f -- "$0"; )"; )"
|
||||
rm logs/history.log
|
||||
export DISCWORLD_DIRECTORY="PACKAGE_DIRECTORY"
|
||||
cd $DISCWORLD_DIRECTORY
|
||||
if [ -e logs/history.log ]; then
|
||||
rm logs/history.log
|
||||
fi
|
||||
|
||||
# Set hotkeys to switch in/out of "mobile" mode
|
||||
tmux bind C-f resize-pane -x 80%
|
||||
@ -15,13 +18,14 @@ if [[ ! $(tmux ls -F '#S') =~ discworld ]]; then
|
||||
rm logs/chat.log && touch logs/chat.log
|
||||
|
||||
# Start a new tmux session named "discworld" with our tmuxp setup
|
||||
tmuxp load -s discworld ./discworld2.yaml
|
||||
fi
|
||||
|
||||
# If there is already a session, just attach
|
||||
if [ -z "$TMUX" ]; then
|
||||
#tmux send-keys 'clear && tt++ -G config.tin' 'C-m'
|
||||
echo "Not already in TMUX, so let's attach"
|
||||
# If we aren't already inside of TMUX, then attach to our session
|
||||
tmux -2 attach-session -t discworld -d
|
||||
echo "No existing discworld session, create a new one"
|
||||
tmuxp load -s discworld ./discworld.yaml
|
||||
else
|
||||
# If there is already a session, just attach
|
||||
if [ -z "$TMUX" ]; then
|
||||
#tmux send-keys 'clear && tt++ -G config.tin' 'C-m'
|
||||
echo "Not already in TMUX, so let's attach"
|
||||
# If we aren't already inside of TMUX, then attach to our session
|
||||
tmux -2 attach-session -t discworld -d
|
||||
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)
|
||||
- python 3
|
||||
- sqlite 3
|
||||
* With package downloaded and requirements installed then `tt++ -G config.tin` will launch
|
||||
* "Discworld" shell-file exists to setup tmux layout or connect to existing
|
||||
- Recommend symlinking e.g. (`sudo ln -s /home/myuser/discworld-tintin/Discworld /usr/local/bin/disc)
|
||||
- Now you can type "disc" from anywhere to launch or connect to the setup
|
||||
* Run "install.sh" to configure your directories and create a global alias
|
||||
- Will request sudo password to create link in /usr/local/bin
|
||||
* Now you can type "disc" from your terminal to create a new session or connect to an existing one
|
||||
- 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
|
||||
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
---
|
||||
session_name: discworld
|
||||
start_directory: "$DISCWORLD_DIRECTORY"
|
||||
windows:
|
||||
- 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]}]
|
||||
options: {}
|
||||
panes:
|
||||
- tail
|
||||
- sh
|
||||
- clear && tail -fs .5 logs/chat.log
|
||||
- ./bin/mdt
|
||||
- focus: 'true'
|
||||
shell_command: tt++
|
||||
- bash
|
||||
- sh
|
||||
- bash
|
||||
start_directory: "$(dirname '$0')"
|
||||
shell_command: tt++ -G config.tin
|
||||
- ./bin/dt
|
||||
- ./bin/grp
|
||||
- ./bin/map
|
||||
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