-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·100 lines (84 loc) · 2.55 KB
/
setup.sh
File metadata and controls
executable file
·100 lines (84 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
# pplr Setup Script
# This script helps set up pplr on your system
echo "pplr Setup"
echo "=========="
echo
# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
# Default values
DEFAULT_PPLR_ROOT="$SCRIPT_DIR"
DEFAULT_PPLR_DATA="$HOME/Dropbox/Career/People"
# Ask for configuration
echo "Configuration:"
echo
read -p "pplr code directory [$DEFAULT_PPLR_ROOT]: " PPLR_ROOT
PPLR_ROOT="${PPLR_ROOT:-$DEFAULT_PPLR_ROOT}"
read -p "pplr data directory [$DEFAULT_PPLR_DATA]: " PPLR_DATA
PPLR_DATA="${PPLR_DATA:-$DEFAULT_PPLR_DATA}"
echo
echo "Setting up pplr with:"
echo " Code directory: $PPLR_ROOT"
echo " Data directory: $PPLR_DATA"
echo
# Create data directory structure if it doesn't exist
if [ ! -d "$PPLR_DATA" ]; then
echo "Creating data directory structure..."
mkdir -p "$PPLR_DATA"
# Create A-Z directories
for letter in {A..Z}; do
mkdir -p "$PPLR_DATA/$letter"
done
echo "Data directory created."
else
echo "Data directory already exists."
fi
# Determine shell config file
SHELL_CONFIG=""
if [ -n "$ZSH_VERSION" ]; then
SHELL_CONFIG="$HOME/.zshrc"
elif [ -n "$BASH_VERSION" ]; then
if [ -f "$HOME/.bash_profile" ]; then
SHELL_CONFIG="$HOME/.bash_profile"
else
SHELL_CONFIG="$HOME/.bashrc"
fi
fi
if [ -z "$SHELL_CONFIG" ]; then
echo "Could not determine shell configuration file."
echo "Please add the following to your shell configuration manually:"
else
echo "Adding pplr to your shell configuration ($SHELL_CONFIG)..."
# Check if pplr is already configured
if grep -q "PPLR_ROOT" "$SHELL_CONFIG" 2>/dev/null; then
echo "pplr appears to be already configured in $SHELL_CONFIG"
echo "Please update the configuration manually if needed."
else
# Add configuration to shell
cat >> "$SHELL_CONFIG" << EOF
# pplr - Personal Relationship Manager
export PPLR_ROOT="$PPLR_ROOT"
export PPLR_DATA="$PPLR_DATA"
export PPLR_BIN_DIR="\$PPLR_ROOT/bin"
export PPLR_TEMPLATE_DIR="\$PPLR_ROOT/templates"
export PPLR_DIR="\$PPLR_DATA" # For backwards compatibility
export PATH="\$PATH:\$PPLR_BIN_DIR"
EOF
echo "Configuration added to $SHELL_CONFIG"
fi
fi
echo
echo "Setup complete!"
echo
echo "To start using pplr:"
echo "1. Reload your shell configuration:"
echo " source $SHELL_CONFIG"
echo
echo "2. Test the installation:"
echo " pplr help"
echo
echo "3. Create your first person:"
echo " pplr new \"Surname\" \"Firstname\""
echo
echo "For more information, see:"
echo " pplr help --details"