-
Notifications
You must be signed in to change notification settings - Fork 24
/
postinst
executable file
·40 lines (33 loc) · 1.03 KB
/
postinst
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
#!/bin/bash
set -x
PLUGIN_NAME="openscap-policies"
PRETTY_NAME="OpenSCAP Policies"
CONFIGURATION_PATH=/opt/rudder/share/plugins/$PLUGIN_NAME
# Code below should be mostly comon between the plugins
SOURCE_DIR=${CONFIGURATION_PATH}/techniques
CONFIG_REPO=/var/rudder/configuration-repository
CATEGORY="$PRETTY_NAME plugin"
C_CATEGORY=$(echo $CATEGORY | sed "s/[^a-zA-Z0-9_]/_/g")
FOLDERS="techniques/$C_CATEGORY"
mkdir -p $CONFIG_REPO/techniques/$C_CATEGORY
cat <<EOT > $CONFIG_REPO/techniques/$C_CATEGORY/category.xml
<xml>
<name>$CATEGORY</name>
<description>
Techniques from the $CATEGORY
</description>
</xml>
EOT
# Import Generic Methods
cd $CONFIG_REPO
git reset
for file in $FOLDERS
do
git add $file
done
git commit -m "$CATEGORY installation"
/opt/rudder/bin/rudder-fix-repository-permissions
# Make extra scripts executables
chmod +x $CONFIGURATION_PATH/rudder_synchronize.py $CONFIGURATION_PATH/remove_configuration
# Import Techniques
${CONFIGURATION_PATH}/rudder_synchronize.py import technique ${CONFIGURATION_PATH}/techniques