Check-in [e31361a090]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Update fossil script.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e31361a09065be2a5cb5a9ae27893dc12e87ce67
User & Date: stephanie.gawroriski 2019-09-02 15:04:42
Context
2019-09-02
15:05
Move decomma dependencies script to the old area. check-in: 5785f4147c user: stephanie.gawroriski tags: trunk
15:04
Update fossil script. check-in: e31361a090 user: stephanie.gawroriski tags: trunk
14:47
Move some more old utilties over. check-in: b564c30ef6 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to utils-dev/__.sh.

8
9
10
11
12
13
14
15
16

17
18
19
20
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Emits a warning.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"


echo "The underscore scripts are potentially dangerous!" 1>&2
exit 1








|

>




8
9
10
11
12
13
14
15
16
17
18
19
20
21
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Emits a warning.

# Force C locale
export LC_ALL=C

# Common directories
__exedir="$(dirname -- "$0")"
__tmpdir="$("$__exedir/tmpdir.sh")"

echo "The underscore scripts are potentially dangerous!" 1>&2
exit 1

Deleted utils-dev/__projclasses.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Creates stuff to lay out into cards accordingly for GitHub.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































Changes to utils-dev/mkfossil.sh.

5
6
7
8
9
10
11







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3, or later.
# For more information see license.txt.
# ---------------------------------------------------------------------------
# DESCRIPTION: Exports fossil image








# Target location
if [ -n "$1" ]
then
	TARGET="$1"
else
	TARGET="/tmp/squirreljme.fossil"
fi

# Kill previous fossil repo, if it exists
if [ -f /tmp/squirreljme-fossil-pid ]
then
	kill $(cat /tmp/squirreljme-fossil-pid)
	rm -f /tmp/squirreljme-fossil-pid
fi

# Force C locale
export LC_ALL=C

# Current checkout
INFOLINE="$(fossil info | grep 'checkout:' | head -n 1)"
NOW="$(echo "$INFOLINE" | sed 's/.*\([0-9a-fA-F]\{40\}\).*/\1/g')"

# Generate random port to use
PORT="$(expr $(expr $$ % 32765) + 32765)"

# Sadfully, a local repo cannot be cloned to a new one (it is treated as
# a direct copy).
echo "Serving local copy to clone it..." 1>&2
fossil serve -P $PORT &
FOSSILPID=$!
echo $FOSSILPID > /tmp/squirreljme-fossil-pid
time fossil clone -A squirreljme "http://127.0.0.1:$PORT" \
	"/tmp/$$.fsl"
kill -- $FOSSILPID
wait
rm -f -- /tmp/squirreljme-fossil-pid

# If target exists, Do a compressed rebuild
if [ -f "/tmp/$$.fsl" ]
then
	# Sync unversioned files
	fossil unversioned sync "/tmp/$$.fsl" --once
	
	# Set difficult to use password to discourage people
	echo "Setting a random password..." 1>&2
	RPASS="$( (dd if=/dev/urandom bs=4096 count=1 2> /dev/null | fossil sha1sum -) | tr '\t' ' ' | \
		cut -d ' ' -f 1)"
	echo "which is: '$RPASS'" 1>&2
	fossil user password squirreljme "$RPASS" -R "/tmp/$$.fsl"
	fossil user default squirreljme -R "/tmp/$$.fsl"
	
	# Modify default permissions to make them a bit strong a bit
	# Anonymous logins can spam the ticket or wiki system, which is an exploit
	# provided they know how to cut and paste a password.
	echo "Changing permissions..." 1>&2
	CAPANON="$(fossil user capabilities anonymous -R "/tmp/$$.fsl")"
	CAPDEVE="$(fossil user capabilities developer -R "/tmp/$$.fsl")"
	CAPNOBO="$(fossil user capabilities nobody -R "/tmp/$$.fsl")"
	CAPREAD="$(fossil user capabilities reader -R "/tmp/$$.fsl")"
	
	# Change Powers
		# nobody
	echo "nobody was: $CAPNOBO" 1>&2
	CAPNOBO="ghjorz"
	fossil user capabilities nobody $CAPNOBO -R "/tmp/$$.fsl"
	echo "Now: $CAPNOBO" 1>&2
	
		# Anon (same as nobody)
	echo "anonymous was: $CAPANON" 1>&2
	CAPANON="$CAPNOBO"
	fossil user capabilities anonymous $CAPANON -R "/tmp/$$.fsl"
	echo "Now: $CAPANON" 1>&2
	
		# reader
	echo "reader was: $CAPREAD" 1>&2
	CAPREAD="kptwhmnczgjor"
	fossil user capabilities reader $CAPREAD -R "/tmp/$$.fsl"
	echo "Now: $CAPREAD" 1>&2
	
		# Dev
	echo "developer was: $CAPDEVE" 1>&2
	CAPDEVE="deihmnczgjor"
	fossil user capabilities developer $CAPDEVE -R "/tmp/$$.fsl"
	echo "Now: $CAPDEVE" 1>&2
	
	# Change some settings
	echo "Changing a few settings..." 1>&2
		# URL being set to the local clone is bad by default
	fossil remote-url -R "/tmp/$$.fsl" off
	fossil remote-url -R "/tmp/$$.fsl" \
		http://multiphasicapps.net/
		# Autosync to a 127.0.0.1 == Very annoying
	fossil settings -R "/tmp/$$.fsl" autosync 0
		# Case sensitivity (for Windows/DOS)
	fossil settings -R "/tmp/$$.fsl" case-sensitive 1
		# Enable the manifest so it appears in the ZIPs and such
	fossil settings -R "/tmp/$$.fsl" manifest 1
	
	# Add all of these settings
	for __conf in project skin shun ticket
	do
		fossil config push "$__conf" "/tmp/$$.fsl"
	done
	
	# Scrub
	fossil scrub --force --verily "/tmp/$$.fsl"

	# Rebuild
	#echo "Rebuilding..." 1>&2
	#fossil rebuild --force --vacuum --pagesize 4096 --compress \
	#	--stats "/tmp/$$.fsl"
	
	# Create a ZIP file to append to the repository (note that any changes made
	# to the repository will damage it). Although this wastes a bit of space,
	# it is rather cool so that way you can still extract and compile the OS
	# from the appended ZIP without needing a fossil installation.
	echo "Exporting a ZIP of current code..." 1>&2
	fossil zip "$NOW" "/tmp/$$.zip" --name "squirreljme" -R "/tmp/$$.fsl"
	
	# Compress using some algorithms
	# Just used as a test to see how well things compress, not really that
	# important.
	if false
	then
		# Base tar to recompress
		fossil tar tip - --name "squirreljme" -R "/tmp/$$.fsl" \
			| gunzip -c - > "/tmp/$$.tar"
		
		# GZIP
		if which gzip 2> /dev/null > /dev/null
		then
			if ! gzip -9 -v -c - < "/tmp/$$.tar" > "/tmp/$$.tgz"
			then
				rm -f "/tmp/$$.tgz"
			fi
		fi
	
		# BZIP2
		if which bzip2 2> /dev/null > /dev/null
		then
			if ! bzip2 -9 -v -c - < "/tmp/$$.tar" > "/tmp/$$.tb2"
			then
				rm -f "/tmp/$$.tb2"
			fi
		fi
		
		# XZ
		if which xz 2> /dev/null > /dev/null
		then
			if ! xz -9 -v -c - < "/tmp/$$.tar" > "/tmp/$$.txz"
			then
				rm -f "/tmp/$$.txz"
			fi
		fi
	fi
	
	# Join the repository and the zip as one
	echo "Merging the files..." 1>&2
	cat "/tmp/$$.fsl" "/tmp/$$.zip" > "$TARGET"
	ls -sh "/tmp/$$."??? "$TARGET" | sort -h
	
	# Clear old files
	echo "Cleaning up..." 1>&2
	rm -f "/tmp/$$.fsl" "/tmp/$$.zip" "/tmp/$$.tar" "/tmp/$$.tgz" \
		"/tmp/$$.txz" "/tmp/$$.tb2"
else
	exit 1
fi

echo "Done." 1>&2
exit 0








>
>
>
>
>
>
>





|



|

|
|


<
<
<












|
|
|


|


|


|



|
<

|
|





|
|
|
|





|





|





|





|





|
|


|

|

|




|



|




|






|







|
|




|

|






|

|






|

|






|
|



|
|







5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3, or later.
# For more information see license.txt.
# ---------------------------------------------------------------------------
# DESCRIPTION: Exports fossil image

# Force C locale
export LC_ALL=C

# Common directories
__exedir="$(dirname -- "$0")"
__tmpdir="$("$__exedir/tmpdir.sh")"

# Target location
if [ -n "$1" ]
then
	TARGET="$1"
else
	TARGET="$__tmpdir/squirreljme.fossil"
fi

# Kill previous fossil repo, if it exists
if [ -f "$__tmpdir/squirreljme-fossil-pid" ]
then
	kill $(cat "$__tmpdir/squirreljme-fossil-pid")
	rm -f "$__tmpdir/squirreljme-fossil-pid"
fi




# Current checkout
INFOLINE="$(fossil info | grep 'checkout:' | head -n 1)"
NOW="$(echo "$INFOLINE" | sed 's/.*\([0-9a-fA-F]\{40\}\).*/\1/g')"

# Generate random port to use
PORT="$(expr $(expr $$ % 32765) + 32765)"

# Sadfully, a local repo cannot be cloned to a new one (it is treated as
# a direct copy).
echo "Serving local copy to clone it..." 1>&2
fossil serve -P $PORT &
FOSSILPID=$!
echo $FOSSILPID > "$__tmpdir/squirreljme-fossil-pid"
fossil clone -A squirreljme "http://127.0.0.1:$PORT" \
	"$__tmpdir/$$.fsl"
kill -- $FOSSILPID
wait
rm -f -- "$__tmpdir/squirreljme-fossil-pid"

# If target exists, Do a compressed rebuild
if [ -f "$__tmpdir/$$.fsl" ]
then
	# Sync unversioned files
	fossil unversioned sync "$__tmpdir/$$.fsl" --once
	
	# Set difficult to use password to discourage people
	echo "Setting a random password..." 1>&2
	RPASS="$("$__exedir/random.sh" 24)"

	echo "which is: '$RPASS'" 1>&2
	fossil user password squirreljme "$RPASS" -R "$__tmpdir/$$.fsl"
	fossil user default squirreljme -R "$__tmpdir/$$.fsl"
	
	# Modify default permissions to make them a bit strong a bit
	# Anonymous logins can spam the ticket or wiki system, which is an exploit
	# provided they know how to cut and paste a password.
	echo "Changing permissions..." 1>&2
	CAPANON="$(fossil user capabilities anonymous -R "$__tmpdir/$$.fsl")"
	CAPDEVE="$(fossil user capabilities developer -R "$__tmpdir/$$.fsl")"
	CAPNOBO="$(fossil user capabilities nobody -R "$__tmpdir/$$.fsl")"
	CAPREAD="$(fossil user capabilities reader -R "$__tmpdir/$$.fsl")"
	
	# Change Powers
		# nobody
	echo "nobody was: $CAPNOBO" 1>&2
	CAPNOBO="ghjorz"
	fossil user capabilities nobody $CAPNOBO -R "$__tmpdir/$$.fsl"
	echo "Now: $CAPNOBO" 1>&2
	
		# Anon (same as nobody)
	echo "anonymous was: $CAPANON" 1>&2
	CAPANON="$CAPNOBO"
	fossil user capabilities anonymous $CAPANON -R "$__tmpdir/$$.fsl"
	echo "Now: $CAPANON" 1>&2
	
		# reader
	echo "reader was: $CAPREAD" 1>&2
	CAPREAD="kptwhmnczgjor"
	fossil user capabilities reader $CAPREAD -R "$__tmpdir/$$.fsl"
	echo "Now: $CAPREAD" 1>&2
	
		# Dev
	echo "developer was: $CAPDEVE" 1>&2
	CAPDEVE="deihmnczgjor"
	fossil user capabilities developer $CAPDEVE -R "$__tmpdir/$$.fsl"
	echo "Now: $CAPDEVE" 1>&2
	
	# Change some settings
	echo "Changing a few settings..." 1>&2
		# URL being set to the local clone is bad by default
	fossil remote-url -R "$__tmpdir/$$.fsl" off
	fossil remote-url -R "$__tmpdir/$$.fsl" \
		http://multiphasicapps.net/
		# Autosync to a 127.0.0.1 == Very annoying
	fossil settings -R "$__tmpdir/$$.fsl" autosync 0
		# Case sensitivity (for Windows/DOS)
	fossil settings -R "$__tmpdir/$$.fsl" case-sensitive 1
		# Enable the manifest so it appears in the ZIPs and such
	fossil settings -R "$__tmpdir/$$.fsl" manifest 1
	
	# Add all of these settings
	for __conf in project skin shun ticket
	do
		fossil config push "$__conf" "$__tmpdir/$$.fsl"
	done
	
	# Scrub
	fossil scrub --force --verily "$__tmpdir/$$.fsl"

	# Rebuild
	#echo "Rebuilding..." 1>&2
	#fossil rebuild --force --vacuum --pagesize 4096 --compress \
	#	--stats "$__tmpdir/$$.fsl"
	
	# Create a ZIP file to append to the repository (note that any changes made
	# to the repository will damage it). Although this wastes a bit of space,
	# it is rather cool so that way you can still extract and compile the OS
	# from the appended ZIP without needing a fossil installation.
	echo "Exporting a ZIP of current code..." 1>&2
	fossil zip "$NOW" "$__tmpdir/$$.zip" --name "squirreljme" -R "$__tmpdir/$$.fsl"
	
	# Compress using some algorithms
	# Just used as a test to see how well things compress, not really that
	# important.
	if false
	then
		# Base tar to recompress
		fossil tar tip - --name "squirreljme" -R "$__tmpdir/$$.fsl" \
			| gunzip -c - > "$__tmpdir/$$.tar"
		
		# GZIP
		if which gzip 2> /dev/null > /dev/null
		then
			if ! gzip -9 -v -c - < "$__tmpdir/$$.tar" > "$__tmpdir/$$.tgz"
			then
				rm -f "$__tmpdir/$$.tgz"
			fi
		fi
	
		# BZIP2
		if which bzip2 2> /dev/null > /dev/null
		then
			if ! bzip2 -9 -v -c - < "$__tmpdir/$$.tar" > "$__tmpdir/$$.tb2"
			then
				rm -f "$__tmpdir/$$.tb2"
			fi
		fi
		
		# XZ
		if which xz 2> /dev/null > /dev/null
		then
			if ! xz -9 -v -c - < "$__tmpdir/$$.tar" > "$__tmpdir/$$.txz"
			then
				rm -f "$__tmpdir/$$.txz"
			fi
		fi
	fi
	
	# Join the repository and the zip as one
	echo "Merging the files..." 1>&2
	cat "$__tmpdir/$$.fsl" "$__tmpdir/$$.zip" > "$TARGET"
	ls -sh "$__tmpdir/$$."??? "$TARGET" | sort -h
	
	# Clear old files
	echo "Cleaning up..." 1>&2
	rm -f "$__tmpdir/$$.fsl" "$__tmpdir/$$.zip" "$__tmpdir/$$.tar" "$__tmpdir/$$.tgz" \
		"$__tmpdir/$$.txz" "$__tmpdir/$$.tb2"
else
	exit 1
fi

echo "Done." 1>&2
exit 0

Added utils-dev/tmpdir.sh.



















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Outputs the temporary directory

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Use this environment variable
if [ -n "$TMPDIR" ]
then
	echo "$TMPDIR"

# Otherwise a fixed directory
else
	echo "/tmp"
fi