Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
18a17416
authored
Feb 09, 2013
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
context: fixes #42
parent
08eb1894
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
18 deletions
+47
-18
miscellaneous/context/ubuntu/etc/context/cleanup.conf
+8
-0
miscellaneous/context/ubuntu/etc/context/cleanup.sh
+10
-2
miscellaneous/context/ubuntu/etc/context/init.d/00networking
+16
-11
miscellaneous/context/ubuntu/etc/context/init.d/02sshfs
+1
-0
miscellaneous/context/ubuntu/etc/context/init.d/03profile
+3
-1
miscellaneous/context/ubuntu/etc/context/init.sh
+9
-4
No files found.
miscellaneous/context/ubuntu/etc/context/cleanup.conf
0 → 100644
View file @
18a17416
description
"cleanup.sh"
start
on
runlevel
[
2345
]
stop
on
runlevel
[!
2345
]
post
-
stop
script
/
etc
/
context
/
cleanup
.
sh
end
script
miscellaneous/context/ubuntu/etc/context/cleanup.sh
View file @
18a17416
#!/bin/bash
#!/bin/bash
#rm -f /etc/ssh/ssh_host_*
if
[
!
-f
/run/context-cleanup
]
;
then
exit
0
fi
stop rsyslog
stop rsyslog
rm
-fr
/home/cloud/.bash_history /root/.bash_history /var/log/
*
echo
-e
"auto lo
\n
iface lo inet loopback
\n
"
>
/etc/network/interfaces
sed
-i
's/^<volume user=.*//'
/etc/security/pam_mount.conf.xml
rm
-rf
~cloud/
{
.bash_history,.ssh/id_rsa
}
rm
-rf
~root/
{
.bash_history
}
rm
-rf
/etc/ssh/ssh_host_
*
miscellaneous/context/ubuntu/etc/context/init.d/00networking
View file @
18a17416
...
@@ -2,15 +2,20 @@
...
@@ -2,15 +2,20 @@
echo
"En vagyok a
$0
!"
echo
"En vagyok a
$0
!"
if
!
grep
-qs
-P
'^\s*auto eth0'
/etc/network/interfaces
;
then
arr
=(
$((
echo
'ibase=16'
;
ifconfig eth0
|
awk
'/HWaddr/ {print $5}'
|
tr
':a-z'
'\nA-Z'
)
|
bc
)
)
arr
=(
$((
echo
'ibase=16'
;
ifconfig eth0
|
awk
'/HWaddr/ {print $5}'
|
tr
':a-z'
'\nA-Z'
)
|
bc
)
)
ipv4
=
"
${
arr
[2]
}
.
${
arr
[3]
}
.
${
arr
[4]
}
.
${
arr
[5]
}
"
ipv4
=
"
${
arr
[2]
}
.
${
arr
[3]
}
.
${
arr
[4]
}
.
${
arr
[5]
}
"
gw4
=
"
${
arr
[2]
}
.
${
arr
[3]
}
.255.254"
gw4
=
"
${
arr
[2]
}
.
${
arr
[3]
}
.255.254"
ipv6
=
"2001:738:2001:4031:
${
arr
[3]
}
:
${
arr
[4]
}
:
${
arr
[5]
}
:0"
ipv6
=
"2001:738:2001:4031:
${
arr
[3]
}
:
${
arr
[4]
}
:
${
arr
[5]
}
:0"
gw6
=
"2001:738:2001:4031:
${
arr
[3]
}
:255:254:0"
gw6
=
"2001:738:2001:4031:
${
arr
[3]
}
:255:254:0"
echo
ok
"
$ipv4
$ipv6
$gw4
$gw6
"
echo
ok
"
$ipv4
$ipv6
$gw4
$gw6
"
cat
<<
EOF
>> /etc/network/interfaces
/
etc/init.d/network-manager stop
ifdown eth0
||
ifconfig eth0
0
down
cat
>
/
etc/network/interfaces
<<
EOF
auto lo
iface lo inet loopback
auto eth0
auto eth0
iface eth0 inet static
iface eth0 inet static
address
$ipv4
address
$ipv4
...
@@ -22,7 +27,7 @@ iface eth0 inet6 static
...
@@ -22,7 +27,7 @@ iface eth0 inet6 static
netmask 80
netmask 80
gateway
$gw6
gateway
$gw6
EOF
EOF
ifconfig eth0
0
;
ifdown eth0
;
ifup eth0
fi
ifup eth0
miscellaneous/context/ubuntu/etc/context/init.d/02sshfs
View file @
18a17416
...
@@ -8,4 +8,5 @@ chmod 600 "$HOME/.ssh/id_rsa"
...
@@ -8,4 +8,5 @@ chmod 600 "$HOME/.ssh/id_rsa"
mkdir
"
$HOME
/sshfs"
mkdir
"
$HOME
/sshfs"
chown
"
$USER
:
$USER
"
-R
"
$HOME
"
chown
"
$USER
:
$USER
"
-R
"
$HOME
"
sed
-i
's/^<volume user=.*//'
/etc/security/pam_mount.conf.xml
sed
-i
"s/^
\(
<
\/
pam_mount>.*
\)
/<volume user=
\"
$USER
\"
fstype=
\"
fuse
\"
path=
\"
sshfs#
${
NEPTUN
}
@
${
SERVER
}
:home
\"
mountpoint=
\"
~
\/
sshfs
\"
options=
\"
nonempty,reconnect,StrictHostKeyChecking=no
\"
\/
>
\n\1
/"
/etc/security/pam_mount.conf.xml
sed
-i
"s/^
\(
<
\/
pam_mount>.*
\)
/<volume user=
\"
$USER
\"
fstype=
\"
fuse
\"
path=
\"
sshfs#
${
NEPTUN
}
@
${
SERVER
}
:home
\"
mountpoint=
\"
~
\/
sshfs
\"
options=
\"
nonempty,reconnect,StrictHostKeyChecking=no
\"
\/
>
\n\1
/"
/etc/security/pam_mount.conf.xml
miscellaneous/context/ubuntu/etc/context/init.d/03profile
View file @
18a17416
...
@@ -2,5 +2,7 @@
...
@@ -2,5 +2,7 @@
echo
"En vagyok a
$0
!"
echo
"En vagyok a
$0
!"
echo
"export NEPTUN=
$NEPTUN
"
>>
$HOME
/.profile
if
[
"
$RECONTEXT
"
!=
"YES"
]
;
then
echo
"export NEPTUN=
$NEPTUN
"
>>
$HOME
/.profile
fi
miscellaneous/context/ubuntu/etc/context/init.sh
View file @
18a17416
...
@@ -4,6 +4,7 @@ export BASEDIR=$(dirname $0)
...
@@ -4,6 +4,7 @@ export BASEDIR=$(dirname $0)
export
USER
=
"cloud"
export
USER
=
"cloud"
export
HOME
=
$(
awk
-F
:
-v
u
=
$USER
'$1==u{print $6}'
/etc/passwd
)
export
HOME
=
$(
awk
-F
:
-v
u
=
$USER
'$1==u{print $6}'
/etc/passwd
)
mkdir
-p
"
$BASEDIR
/mnt"
cd
"
$BASEDIR
"
cd
"
$BASEDIR
"
mount
-t
iso9660 /dev/cdrom1
"
$BASEDIR
/mnt"
2> /dev/null
mount
-t
iso9660 /dev/cdrom1
"
$BASEDIR
/mnt"
2> /dev/null
...
@@ -11,12 +12,16 @@ mount -t iso9660 /dev/cdrom1 "$BASEDIR/mnt" 2> /dev/null
...
@@ -11,12 +12,16 @@ mount -t iso9660 /dev/cdrom1 "$BASEDIR/mnt" 2> /dev/null
if
[
$?
-eq
0
-a
-f
"
$BASEDIR
/firstrun"
-a
-f
"
$BASEDIR
/mnt/context.sh"
]
;
then
if
[
$?
-eq
0
-a
-f
"
$BASEDIR
/firstrun"
-a
-f
"
$BASEDIR
/mnt/context.sh"
]
;
then
.
"
$BASEDIR
/mnt/context.sh"
.
"
$BASEDIR
/mnt/context.sh"
# hogy tudom kiexportalni ennel szebben ezeket a valtozokat?
if
[
"
$RECONTEXT
"
!=
"YES"
]
;
then
eval
`
grep
-o
'^[a-zA-Z0-9]\+='
"
$BASEDIR
/mnt/context.sh"
|
while
read
x
;
do
echo export
${
x
%=
}
;
done
`
rm
"
$BASEDIR
/firstrun"
else
touch /run/context-cleanup
fi
run-parts
"
$BASEDIR
/init.d"
for
i
in
$BASEDIR
/init.d/
*
;
do
source
$i
done
rm
"
$BASEDIR
/firstrun"
else
else
echo
"mar korabban lefutott!"
echo
"mar korabban lefutott!"
fi
fi
...
...
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