Magellan Linux

Diff of /trunk/grubby/grubby-bls

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3144 by niro, Tue Jul 7 11:20:52 2020 UTC revision 3146 by niro, Tue Jul 7 11:22:01 2020 UTC
# Line 56  get_bls_value() { Line 56  get_bls_value() {
56      local bls="$1" && shift      local bls="$1" && shift
57      local key="$1" && shift      local key="$1" && shift
58    
59      echo "$(grep "^${key}[ \t]" "${bls}" | sed -e "s,^${key}[ \t]*,,")"      echo "$(grep "^${key}[ \t]" "${bls}" | sed -e "s!^${key}[ \t]*!!")"
60  }  }
61    
62  set_bls_value() {  set_bls_value() {
# Line 64  set_bls_value() { Line 64  set_bls_value() {
64      local key="$1" && shift      local key="$1" && shift
65      local value="$1" && shift      local value="$1" && shift
66    
67      sed -i -e "s,^${key}.*,${key} ${value}," "${bls}"      sed -i -e "s!^${key}.*!${key} ${value}!" "${bls}"
68  }  }
69    
70  append_bls_value() {  append_bls_value() {
# Line 159  param_to_indexes() { Line 159  param_to_indexes() {
159      fi      fi
160    
161      for i in ${!bls_file[@]}; do      for i in ${!bls_file[@]}; do
162          if [[ $param = "${bls_linux[$i]}" ]]; then          if [[ $param = "${bls_linux[$i]}" || "/${param##*/}" = "${bls_linux[$i]}" ]]; then
163              indexes="$indexes $i"              indexes="$indexes $i"
164          fi          fi
165    
# Line 247  add_bls_fragment() { Line 247  add_bls_fragment() {
247    
248      if [[ $kernel = *"vmlinuz-"* ]]; then      if [[ $kernel = *"vmlinuz-"* ]]; then
249   kernelver="${kernel##*/vmlinuz-}"   kernelver="${kernel##*/vmlinuz-}"
250     prefix="vmlinuz-"
251      else      else
252   kernelver="${kernel##*/}"   kernelver="${kernel##*/}"
253      fi      fi
254    
255      if [[ ! -d "/lib/modules/${kernelver}" || ! -f "/boot/vmlinuz-${kernelver}" ]] &&      if [[ ! -f "/boot/${prefix}${kernelver}" ]] &&
256         [[ $bad_image != "true" ]]; then         [[ $bad_image != "true" ]]; then
257          print_error "The ${kernelver} kernel isn't installed in the machine"          print_error "The ${kernelver} kernel isn't installed in the machine"
258      fi      fi
# Line 321  update_args() { Line 322  update_args() {
322      local add_args=($1) && shift      local add_args=($1) && shift
323    
324      for arg in ${remove_args[*]}; do      for arg in ${remove_args[*]}; do
325          args="$(echo $args | sed -e "s,$arg[^ ]*,,")"          args="$(echo $args | sed -e "s!$arg[^ ]*!!")"
326      done      done
327    
328      for arg in ${add_args[*]}; do      for arg in ${add_args[*]}; do
# Line 330  update_args() { Line 331  update_args() {
331              key=${arg%%=$value}              key=${arg%%=$value}
332              exist=$(echo $args | grep "${key}=")              exist=$(echo $args | grep "${key}=")
333              if [[ -n $exist ]]; then              if [[ -n $exist ]]; then
334                  args="$(echo $args | sed -e "s,$key=[^ ]*,$key=$value,")"                  args="$(echo $args | sed -e "s!$key=[^ ]*!$key=$value!")"
335              else              else
336                  args="$args $key=$value"                  args="$args $key=$value"
337              fi              fi

Legend:
Removed from v.3144  
changed lines
  Added in v.3146