~salgado/linaro-image-tools/fix-duplicate-apt-source-detection

« back to all changes in this revision

Viewing changes to linaro-hwpack-install

  • Committer: Guilherme Salgado
  • Date: 2010-09-16 15:11:29 UTC
  • Revision ID: salgado@canonical.com-20100916151129-ozj4d3sgaeqb1687
Make sure we don't add duplicate apt sources when installing a hardware pack

Show diffs side-by-side

added added

removed removed

Lines of Context:
83
83
# Install the apt sources that contain the packages we need.
84
84
for filename in $(ls "${HWPACK_DIR}"/sources.list.d/); do
85
85
  file="${HWPACK_DIR}"/sources.list.d/$filename
 
86
  found=0
86
87
  while read line; do
87
88
    # Skip any files that contain lines that are already present in the apt
88
89
    # configuration.
89
 
    grep -q "$line" /etc/apt/sources.list.d/* && continue
90
 
    grep -q "$line" /etc/apt/sources.list && continue
 
90
    grep -q "$line" /etc/apt/sources.list.d/* && found=1 && continue
 
91
    grep -q "$line" /etc/apt/sources.list && found=1 && continue
91
92
  done < $file
92
93
 
93
 
  sudo cp $file /etc/apt/sources.list.d/hwpack.$filename
 
94
  if [ $found -eq 0 ]; then
 
95
    sudo cp $file /etc/apt/sources.list.d/hwpack.$filename
 
96
  fi
94
97
done
95
98
 
96
99
# Import the OpenPGP keys for the files installed above.