Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
system.linux
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Simple Deploy- and Management
system.linux
Commits
2c004c9e
Commit
2c004c9e
authored
5 years ago
by
Pietsch, Martin
Browse files
Options
Downloads
Patches
Plain Diff
refactored functions
parent
c0713183
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
files/functions.sh
+63
-16
63 additions, 16 deletions
files/functions.sh
with
63 additions
and
16 deletions
files/functions.sh
+
63
−
16
View file @
2c004c9e
# installTcPackages - install tiny core packages
# parameter:
#
space seperated
list of package names
#
$@ -
list of package names
# return:
# 0 is installed
# 1 something went wrong
installTcPackages
(){
while
[
$#
-
ne
0
]
while
[
$#
-
gt
0
]
;
do
su
do
-u
tc tce-load
-w
-i
$1
su tc
-c
"
tce-load
-s
-w -i
$1
"
2>&1
>
/dev/null
shift
done
}
# beginLogEntry - starts a new log entry
# parameter:
# $1 - log message
# return:
# none
# hint:
# The log entries are saved in file /var/log/installer.log by default.
# The location can be changed with the variable $LOGFILE_PATH
beginLogEntry
(){
echo
-n
"
$1
... "
|
tee
-a
${
LOGFILE_PATH
:-
/var/log/installer.log
}
}
# finishLogEntry - finishs a started log entry
# parameter:
# $1 - result of log content
# return:
# none
# hint:
# The log entries are saved in file /var/log/installer.log by default.
# The location can be changed with the variable $LOGFILE_PATH
finishLogEntry
(){
echo
"
$1
"
|
tee
-a
${
LOGFILE_PATH
:-
/var/log/installer.log
}
}
start_chroot
(){
sudo mkdir
-p
/mnt/debinst/
{
dev/pts,proc,sys
}
sudo
mount /dev /mnt/debinst/dev
--bind
sudo
mount devpts /mnt/debinst/dev/pts
-t
devpts
sudo
mount none /mnt/debinst/proc
-t
proc
sudo
mount none /mnt/debinst/sys
-t
sysfs
# getAnswerfile - downloads Answerfile
# parameter:
# $1 - remote answerfile path
# $2 - local path answerfile path
# return:
# 0 - no error
# 1 - error occurred
getAnswerfile
()
{
local
retval
=
1
if
[
$#
-eq
2
]
;
then
wget
-q
-O
$2
$1
retval
=
$?
fi
return
${
retval
}
}
# runChroot - prepare and run a chroot environment for second stage installer
# parameter:
# $1 - path of second stage installer script inside the chroot environment
# return:
# none
runChroot
(){
mkdir
-p
/target/
{
dev/pts,proc,sys
}
mount /dev /target/dev
--bind
mount devpts /target/dev/pts
-t
devpts
mount none /target/proc
-t
proc
mount none /target/sys
-t
sysfs
sudo
LANG
=
C.UTF-8
chroot
/
mnt/debins
t
$1
LANG
=
C.UTF-8
chroot
/
targe
t
$1
sudo
umount /mnt/debinst/sys
sudo
umount /mnt/debinst/proc
sudo
umount /mnt/debinst/dev/pts
sudo
umount /dev /mnt/debinst/dev
}
\ No newline at end of file
umount /target/sys
umount /target/proc
umount /target/dev/pts
umount /dev /target/dev
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment