chr
2026-04-05 fe750b791d5b517cc4e9bc8e99a9a75139a0cfba
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
#!/bin/bash
set -e
 
# create opentap group if it doesn't exist
getent group opentap || groupadd opentap && echo "Created opentap group"
 
echo "Changing permissions of opentap folder (/usr/share/opentap)"
chgrp -R opentap /usr/share/opentap
# set sticky bit for the directory so new files will belong to the opentap group
chmod -R g+rwxs /usr/share/opentap
 
echo "opentap group configured."
 
# Attempt to add a user to the opentap group if a regular user installed opentap using sudo.
if [ ! -z "$SUDO_USER" ]; then
  if [ ! "$SUDO_USER" == "root" ]; then
    usermod -a -G opentap "$SUDO_USER"
    echo "Added user $SUDO_USER to the opentap group"
  fi
fi
 
echo "A user must be a member of the 'opentap' group to use opentap."
echo "Add users to the 'opentap' group with the following command:"
echo "    usermod -a -G opentap \$USER"
echo "This OpenTAP installation is global. If this is a multi-user system, consider creating a user-level OpenTAP
installation with"
echo "    tap package install OpenTAP --target /local/install/dir"