blob: 5e2ec9903a4f408c3de422770b7abcca27101329 (
plain)
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
# Colored makepkg-like functions
note() {
printf "${_blue}==>${_yellow} NOTE:${_bold} %s${_all_off}\n" "$1"
}
_all_off="$(tput sgr0)"
_bold="${_all_off}$(tput bold)"
_blue="${_bold}$(tput setaf 4)"
_yellow="${_bold}$(tput setaf 3)"
pre_install() {
# Check for existing plugins
if pacman -Qs zoomcitrixplugin >/dev/null; then
echo "Error: zoomcitrixplugin is installed. Please remove it first."
exit 1
fi
# Remove existing symbolic links
citrix_default_link="/opt/Citrix/ICAClient/ZoomMedia.so"
if [ -L "$citrix_default_link" ]; then
sudo rm -f "$citrix_default_link"
fi
}
post_install() {
# Check if Citrix is installed
RESULT_CITRIX_EXIST=$(pacman -Qs icaclient)
if [ "$RESULT_CITRIX_EXIST" != "" ]; then
citrix_default_directory="/opt/Citrix/ICAClient"
# Create the directory if it doesn't exist
if [ ! -d "$citrix_default_directory" ]; then
sudo mkdir -p "$citrix_default_directory"
echo "auto created directory '$citrix_default_directory'"
fi
# Create symbolic link for the plugin
sudo ln -sf /usr/lib/zoomvdi-universal-plugin/libZoomPlugin.so "$citrix_default_directory/ZoomMedia.so"
# Locate the module.ini configuration file
CONFIG_LINK_FILE=/opt/Citrix/ICAClient/config/module.ini
if [ ! -f "$CONFIG_LINK_FILE" ]; then
echo "Error: $CONFIG_LINK_FILE does not exist!"
exit 1
fi
if [ ! -L "$CONFIG_LINK_FILE" ]; then
CONFIG_FILE=$CONFIG_LINK_FILE
else
CONFIG_FILE=$(readlink -f $CONFIG_LINK_FILE)
if [ ! -f "$CONFIG_FILE" ]; then
echo "Error: $CONFIG_FILE does not exist!"
exit 1
fi
fi
# Find the line containing VirtualDriver
line=$(grep -n "VirtualDriver" $CONFIG_FILE | cut -d ":" -f 1)
VIRTUAL_CONTENT=$(sed -n "${line}p" $CONFIG_FILE | grep "ZoomMedia")
if [ -z "$VIRTUAL_CONTENT" ]; then
echo "Zoom media plugin has not been installed before."
else
echo "Zoom media plugin has already been installed, skipping this step."
exit 0
fi
# Find the first empty line after the VirtualDriver entry
EMPTY_LINES=$(sed -n '/^$/=' $CONFIG_FILE)
FIRST_EMPTY_LINE=1
for itemline in $EMPTY_LINES; do
if [ $itemline -gt $line ]; then
FIRST_EMPTY_LINE=$itemline
break
fi
done
if [ $FIRST_EMPTY_LINE -eq 1 ]; then
echo "No suitable location to add ZoomMedia configuration."
exit 1
fi
echo "Adding ZoomMedia configuration to $CONFIG_FILE"
sudo sed -i "/VirtualDriver/s/$/, ZoomMedia/" $CONFIG_FILE
sudo sed -i "${FIRST_EMPTY_LINE}i ZoomMedia=On" $CONFIG_FILE
FIRST_EMPTY_LINE=$((FIRST_EMPTY_LINE + 2))
sudo sed -i "${FIRST_EMPTY_LINE}i [ZoomMedia]" $CONFIG_FILE
FIRST_EMPTY_LINE=$((FIRST_EMPTY_LINE + 1))
sudo sed -i "${FIRST_EMPTY_LINE}i DriverName=ZoomMedia.so" $CONFIG_FILE
fi
note "Config write completed to $CONFIG_LINK_FILE"
note "Please reboot or kill all citrix instances: killall wfica"
}
pre_remove() {
# Remove configuration entries
CONFIG_LINK_FILE="/opt/Citrix/ICAClient/config/module.ini"
if [ -f "$CONFIG_LINK_FILE" ]; then
sudo sed -i 's/, ZoomMedia//g' "$CONFIG_LINK_FILE"
sudo sed -i '/ZoomMedia=On/d' "$CONFIG_LINK_FILE"
sudo sed -i '/\[ZoomMedia\]/d' "$CONFIG_LINK_FILE"
sudo sed -i '/ZoomMedia.so/d' "$CONFIG_LINK_FILE"
fi
# Remove symbolic link
citrix_default_link="/opt/Citrix/ICAClient/ZoomMedia.so"
if [ -L "$citrix_default_link" ]; then
sudo rm -f "$citrix_default_link"
fi
}
|