-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprotopocket.sh
More file actions
executable file
·81 lines (71 loc) · 1.96 KB
/
protopocket.sh
File metadata and controls
executable file
·81 lines (71 loc) · 1.96 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
#!/usr/bin/env bash
set -e
SOURCE_DIR="$(pwd)"
TARGET_DIR="$HOME/.local/var/pmbootstrap/cache_git/pmaports/device/testing"
DEVICE_DIR="device-sineware-protopocket"
LINUX_DIR="linux-sineware-protopocket"
function show_help {
echo "Usage: $0 COMMAND"
echo ""
echo "Commands:"
echo " install Create symlinks from local directories to pmaports dir"
echo " pmapull Remove symlinks, runs 'pmbootstrap pull', then recreate symlinks"
echo " remove Remove symlinks"
echo " help Show this help message"
}
function check_directories {
if [ ! -d "$SOURCE_DIR/$DEVICE_DIR" ]; then
echo "Error: Directory $DEVICE_DIR not found in current directory"
exit 1
fi
if [ ! -d "$SOURCE_DIR/$LINUX_DIR" ]; then
echo "Error: Directory $LINUX_DIR not found in current directory"
exit 1
fi
if [ ! -d "$TARGET_DIR" ]; then
echo "Error: Target directory $TARGET_DIR not found"
echo "Make sure pmbootstrap is initialized properly"
exit 1
fi
}
function create_symlinks {
echo "Creating symlinks in $TARGET_DIR..."
ln -sf "$SOURCE_DIR/$DEVICE_DIR" "$TARGET_DIR/"
ln -sf "$SOURCE_DIR/$LINUX_DIR" "$TARGET_DIR/"
echo "Symlinks created successfully!"
}
function remove_symlinks {
echo "Removing symlinks..."
if [ -L "$TARGET_DIR/$DEVICE_DIR" ]; then
rm "$TARGET_DIR/$DEVICE_DIR"
fi
if [ -L "$TARGET_DIR/$LINUX_DIR" ]; then
rm "$TARGET_DIR/$LINUX_DIR"
fi
echo "Symlinks removed successfully!"
}
case "$1" in
install)
check_directories
create_symlinks
;;
pmapull)
check_directories
remove_symlinks
echo "Running 'pmbootstrap pull'..."
pmbootstrap pull
create_symlinks
;;
remove)
remove_symlinks
;;
help|--help|-h)
show_help
;;
*)
echo "Error: Unknown command '$1'"
show_help
exit 1
;;
esac
exit 0