summarylogtreecommitdiffstats
path: root/intelpwm-udev.install
blob: 19523dced3a99490538819b27b90249309d0559e (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
post_install() {
    echo "Updating udev rules..."
    udevadm control --reload-rules
    echo "Edit /etc/intelpwm.conf to suit your needs"
    echo "Visit http://devbraindom.blogspot.com/2013/03/eliminate-led-screen-flicker-with-intel.html for more details"
}

post_upgrade() {
    echo "Migrating /etc/intelpwm.conf to new format..."
    CONFIG=/etc/intelpwm.conf

    if [ ! -f $CONFIG ]
        then
            echo "$CONFIG not found"
            return
    fi

    source $CONFIG
    if [[ $PERIOD =~ ^0x[0-9a-fA-F]{8}$ ]]
        then
            NEW_PERIOD=${PERIOD:2:4}
            sed -i.backup "s/^\(PERIOD=\).*/\1$NEW_PERIOD/" $CONFIG
            echo "$CONFIG backup is saved as $CONFIG.backup"
        else
            echo "Expected PERIOD to be in format 0x01234567. No changes were made"
    fi
}