Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
alpine-conf
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
19
Issues
19
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpine
alpine-conf
Commits
7e495678
Commit
7e495678
authored
May 02, 2011
by
Natanael Copa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setup-disk: allow entering more than one disk at prompt
So you can specify more than one disk
parent
18fec8f8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
9 deletions
+27
-9
setup-disk.in
setup-disk.in
+27
-9
No files found.
setup-disk.in
View file @
7e495678
...
...
@@ -17,6 +17,17 @@ in_list() {
return
1
}
all_in_list
()
{
local
needle
=
"
$1
"
local
i
[
-z
"
$needle
"
]
&&
return
1
shift
for
i
in
$needle
;
do
in_list
"
$i
"
$@
||
return
1
done
return
0
}
# wrapper to only show given device
_blkid
()
{
blkid |
grep
"^
$1
:"
...
...
@@ -368,7 +379,7 @@ show_disk_info() {
vendor
=
$(
cat
/sys/block/
$d
/device/vendor 2>/dev/null
)
model
=
$(
cat
/sys/block/
$d
/device/model 2>/dev/null
)
size
=
$(
awk
'{gb = ($1 * 512)/1000000000; printf "%.1f GB\n", gb}'
/sys/block/
$d
/size 2>/dev/null
)
echo
"
$d
(
$size
$vendor
$model
)"
echo
"
$d
(
$size
$vendor
$model
)"
done
}
...
...
@@ -759,21 +770,25 @@ __EOF__
ask_disk
()
{
local
prompt
=
"
$1
"
local
help_func
=
"
$2
"
local
i
=
shift
2
answer
=
while
!
in_list
"
$answer
"
$@
"none"
"abort"
;
do
echo
"Available disks are:
$@
"
while
!
all_in_list
"
$answer
"
$@
"none"
"abort"
;
do
echo
"Available disks are:"
show_disk_info
"
$@
"
echon
"
$prompt
[
$1
] "
default_read answer
$1
case
"
$answer
"
in
'abort'
)
exit
0
;;
'none'
)
return
0
;;
'?'
)
$help_func
;;
*
)
if
!
[
-b
"/dev/
$answer
"
]
;
then
echo
"/dev/
$answer
is not a block device"
>
&2
answer
=
fi
;;
*
)
for
i
in
$answer
;
do
if
!
[
-b
"/dev/
$i
"
]
;
then
echo
"/dev/
$i
is not a block device"
>
&2
answer
=
fi
done
;;
esac
done
}
...
...
@@ -867,10 +882,12 @@ if [ $# -gt 0 ]; then
diskdevs
=
"
$diskdevs
/dev/
$j
"
done
else
ask_disk
"Which disk would you like to use? (or '?' for help or 'none')"
\
ask_disk
"Which disk
(s)
would you like to use? (or '?' for help or 'none')"
\
diskselect_help
$disks
if
[
"
$answer
"
!=
none
]
;
then
diskdevs
=
/dev/
$answer
for
i
in
$answer
;
do
diskdevs
=
"
$diskdevs
/dev/
$i
"
done
else
DISK_MODE
=
"none"
fi
...
...
@@ -880,6 +897,7 @@ if [ -n "$diskdevs" ] && [ -z "$DISK_MODE" ]; then
answer
=
disk_is_or_disks_are
=
"disk is"
it_them
=
"it"
set
--
$diskdevs
if
[
$#
-gt
1
]
;
then
disk_is_or_disks_are
=
"disks are"
it_them
=
"them"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment