| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: dot.profile,v 1.3 2008/11/17 20:14:35 abs Exp $ | | 1 | # $NetBSD: dot.profile,v 1.3.10.1 2012/07/05 17:33:59 riz Exp $ |
2 | # | | 2 | # |
3 | # Copyright (c) 1995 Jason R. Thorpe | | 3 | # Copyright (c) 1995 Jason R. Thorpe |
4 | # Copyright (c) 1994 Christopher G. Demetriou | | 4 | # Copyright (c) 1994 Christopher G. Demetriou |
5 | # All rights reserved. | | 5 | # All rights reserved. |
6 | # | | 6 | # |
7 | # Redistribution and use in source and binary forms, with or without | | 7 | # Redistribution and use in source and binary forms, with or without |
8 | # modification, are permitted provided that the following conditions | | 8 | # modification, are permitted provided that the following conditions |
9 | # are met: | | 9 | # are met: |
10 | # 1. Redistributions of source code must retain the above copyright | | 10 | # 1. Redistributions of source code must retain the above copyright |
11 | # notice, this list of conditions and the following disclaimer. | | 11 | # notice, this list of conditions and the following disclaimer. |
12 | # 2. Redistributions in binary form must reproduce the above copyright | | 12 | # 2. Redistributions in binary form must reproduce the above copyright |
13 | # notice, this list of conditions and the following disclaimer in the | | 13 | # notice, this list of conditions and the following disclaimer in the |
14 | # documentation and/or other materials provided with the distribution. | | 14 | # documentation and/or other materials provided with the distribution. |
| @@ -37,36 +37,33 @@ PATH=/sbin:/bin:/usr/bin:/usr/sbin:/ | | | @@ -37,36 +37,33 @@ PATH=/sbin:/bin:/usr/bin:/usr/sbin:/ |
37 | export PATH | | 37 | export PATH |
38 | TERM=vt220 | | 38 | TERM=vt220 |
39 | export TERM | | 39 | export TERM |
40 | HOME=/ | | 40 | HOME=/ |
41 | export HOME | | 41 | export HOME |
42 | OBLOCKSIZE=1k | | 42 | OBLOCKSIZE=1k |
43 | export BLOCKSIZE | | 43 | export BLOCKSIZE |
44 | EDITOR=ed | | 44 | EDITOR=ed |
45 | export EDITOR | | 45 | export EDITOR |
46 | | | 46 | |
47 | umask 022 | | 47 | umask 022 |
48 | | | 48 | |
49 | makerootwritable() { | | 49 | makerootwritable() { |
50 | if [ ! -e /tmp/.root_writable ]; then | | 50 | # note, only handles up to partition 'j' |
51 | # note, only handles up to partition 'j' | | 51 | rootdev=/dev/$(sysctl -n kern.root_device)$(sysctl -n kern.root_partition | sed y/0123456789/abcdefghij/) |
52 | rootdev=/dev/$(sysctl -n kern.root_device)$(sysctl -n kern.root_partition | sed y/0123456789/abcdefghij/) | | 52 | if ! mount -u $rootdev / ; then |
53 | if ! mount $rootdev / ; then | | 53 | echo "Unable to mount $rootdev read-write" |
54 | echo "Unable to mount $rootdev read-write" | | 54 | exit 1 |
55 | exit 1 | | | |
56 | fi | | | |
57 | cp /dev/null /tmp/.root_writable | | | |
58 | echo "Mounted $rootdev read-write" | | | |
59 | fi | | 55 | fi |
| | | 56 | echo "Mounted $rootdev read-write" |
60 | } | | 57 | } |
61 | | | 58 | |
62 | if [ "X${DONEPROFILE}" = "X" ]; then | | 59 | if [ "X${DONEPROFILE}" = "X" ]; then |
63 | DONEPROFILE=YES | | 60 | DONEPROFILE=YES |
64 | export DONEPROFILE | | 61 | export DONEPROFILE |
65 | | | 62 | |
66 | # set up some sane defaults | | 63 | # set up some sane defaults |
67 | echo 'erase ^H, werase ^W, kill ^U, intr ^C' | | 64 | echo 'erase ^H, werase ^W, kill ^U, intr ^C' |
68 | stty newcrt werase ^W intr ^C kill ^U erase ^H 9600 | | 65 | stty newcrt werase ^W intr ^C kill ^U erase ^H 9600 |
69 | | | 66 | |
70 | # mount root read write | | 67 | # mount root read write |
71 | makerootwritable | | 68 | makerootwritable |
72 | | | 69 | |