itoffshore / alpine-linux-scripts

Alpine Linux Setup Scripts
GNU General Public License v2.0
46 stars 13 forks source link

sed: bad regex '^.\{1,-15\}$': Invalid contents of {} #1

Closed Lem closed 9 years ago

Lem commented 9 years ago

Hi,

localhost:~# ./setup-partitions
Alpine Linux Custom Installation:

NAME       SIZE       VENDOR     LABEL 
sda        11.7G      ATA                  

Choose Disk [ sda ]
>>>[ sda ]: ENTER

Choose Partition Scheme [  ]
>>>[ m(br) | g(pt) ]: m

Choose Disk Layout [ none ]
>>>[ l(vm) | b(oot) | none ]: 

pressing enter for choosing none on disk layout following error appears:

sed: bad regex '^.\{1,-15\}$': Invalid contents of {}
Alpine Linux Custom Installation:

NAMETYPE     FSTYPE     MOUNT@     FORMAT@         

 Choose device to configure?    [ q to Quit ]
>>>[  ...  ]: 

After a grep sed setup-partiotions it seems to be the sed-command at line 1085.

itoffshore commented 9 years ago

Somehow $part_line_pad has become -15 (& not 1 / 2 or 3)

What does:

lsblk -no NAME,SIZE,TYPE /dev/sda

show ?

Lem commented 9 years ago
localhost:~# lsblk -no NAME,SIZE,TYPE /dev/sda
sda    8G disk
localhost:~# lsblk -no NAME,SIZE,TYPE /dev/sda 2>/dev/null |iconv -c -f utf-8 -t ascii|tr -d '[:*:]' 
sda    8G disk
localhost:~# lsblk -no NAME,SIZE,TYPE /dev/sda 2>/dev/null |iconv -c -f utf-8 -t ascii|tr -d '[:*:]' |awk '$3 = /part|lvm|crypt/ && 
$2 != "1K" { print $1}'
localhost:~# 

Some background to my setup: I'm using virtualbox with a fresh disk-image.

I was successful installing alpine with disk layout 'boot'. Rebooting into alpine, do some stuff. Then I tried setup-partitions with layout 'none' again, but this time cfdisk opened up. Closing cfdisk same error shows up. Creating a new VM with a freshly disk-images reproduce the same behaviour like my first post.

itoffshore commented 9 years ago

If you do not create any partitions you will get this error. I will add a check that partitions exist & exit with an error message if they don't.

Thank you for testing the script - it never occurred to me to check for this situation.

Lem commented 9 years ago

Will test it, thanks :) Found another bug I will open an issue for, but I'm not sure if this one will maybe fix it.

itoffshore commented 9 years ago

Fixed with https://github.com/itoffshore/alpine-linux-scripts/commit/fcc5d6e2c878da6c8f80547e6c55880f65d5e5cf - many thx for testing