File: gen_dch.sh

package info (click to toggle)
usb-modeswitch-data 20191128-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,324 kB
  • sloc: tcl: 53; makefile: 37; sh: 19
file content (30 lines) | stat: -rwxr-xr-x 577 bytes parent folder | download | duplicates (7)
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
#!/bin/bash

set -e

# Commit identifiant
cid=$1

attrs_line=0

echo "    + New devices"
git show $cid *-usb_modeswitch.rules | egrep -B1 -e '^\+ATTR{idVendor}' | while read line
do
	
	if [ $attrs_line -eq 0 ]
	then
		attrs_line=1
		# Line 0 is the Description
		DESC=`echo $line | sed -e 's/^.*# \(.*\)$/\1/'`
	elif [ $attrs_line -eq 1 ]
	then
		attrs_line=2
		# Line 1 is the Attributes
		ATTRS=`echo $line | sed -e 's/^.*ATTR{idVendor}=="\(.*\)".*ATTR{idProduct}=="\(.*\)",.*$/\[\1:\2\]/'`
		echo "     $ATTRS $DESC"
	else
		attrs_line=0
		# Line 2 is the context
	fi
done