~isantop/system76-driver/pkexec

« back to all changes in this revision

Viewing changes to acpi/initrd-add-dsdt.sh

  • Committer: Ian Santopietro
  • Date: 2012-06-07 14:30:02 UTC
  • mto: This revision was merged to the branch mainline in revision 53.
  • Revision ID: ian@system76.com-20120607143002-hwt1i0jf42uckks0
Fix logs issue in GTK2 interface

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/bash
2
 
# Adds a DSDT file to the initrd (if it's an initramfs)
3
 
# first argument is the name of archive
4
 
# second argurment is the name of the file to add
5
 
# The file will be copied as /DSDT.aml
6
 
 
7
 
# 20060126: fix "Premature end of file" with some old cpio (Roland Robic)
8
 
# 20060205: this time it should really work
9
 
 
10
 
 
11
 
# check the arguments
12
 
if [ $# -ne 2 ]; then
13
 
        program_name=$(basename $0)
14
 
        echo "\
15
 
$program_name: too few arguments
16
 
Usage: $program_name initrd-name.img DSDT-to-add.aml
17
 
Adds a DSDT file to an initrd (in initramfs format)
18
 
 
19
 
  initrd-name.img: filename of the initrd in initramfs format
20
 
  DSDT-to-add.aml: filename of the DSDT file to add
21
 
  " 1>&2
22
 
    exit 1
23
 
fi
24
 
 
25
 
# we should check it's an initramfs
26
 
 
27
 
tempcpio=$(mktemp -d)
28
 
# cleanup on exit, hangup, interrupt, quit, termination
29
 
trap 'rm -rf $tempcpio' 0 1 2 3 15
30
 
 
31
 
# extract the archive
32
 
gunzip -c "$1" > "$tempcpio"/initramfs.cpio || exit 1
33
 
 
34
 
# copy the DSDT file at the root of the directory so that we can call it "/DSDT.aml"
35
 
cp -f "$2" "$tempcpio"/DSDT.aml
36
 
 
37
 
# add the file
38
 
cd "$tempcpio"
39
 
(echo DSDT.aml | cpio --quiet -H newc -o -A -O "$tempcpio"/initramfs.cpio) || exit 1
40
 
cd "$OLDPWD"
41
 
 
42
 
# re-compress the archive
43
 
gzip -c "$tempcpio"/initramfs.cpio > "$1"