Skip to content

Commit

Permalink
Merge pull request #3 from Rytisgit/feature/merge_crawl_origin
Browse files Browse the repository at this point in the history
Feature/merge crawl origin
  • Loading branch information
Rytisgit authored Feb 21, 2024
2 parents cfe71d7 + 4b539e4 commit a177345
Show file tree
Hide file tree
Showing 34 changed files with 239 additions and 224 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ itself
2. `dgl create-chroot` command to set up a basic chroot jail with all the
fixtures dgamelaunch wants (dgamelaunch already has a skeleton script
that can serve as a basis, although this is unfortunately NetHack-biased).

3. Support for installing different games, including fetching their sources
from their respective source repositories, compiling, installing into the
chroot, etc.
Expand Down
2 changes: 1 addition & 1 deletion bin/compress-ttyrecs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ for ttyrec in "$TTYRECDIR"/*/*.ttyrec; do
continue
fi
if bzip2 "$ttyrec"; then
(( ++succ ))
(( ++succ ))
verbiate -n "+"
else
(( ++fail ))
Expand Down
6 changes: 3 additions & 3 deletions bin/passwd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ change-password() {
local password_clear="$2"

assert-password-safe "$password_clear"
local password_crypt
local password_crypt
password_crypt="$(perl -le 'print crypt($ARGV[0], substr($ARGV[0], 0, 2))' "$password_clear")"
sqlite3 "$LOGIN_DB" <<EOF
UPDATE dglusers
Expand All @@ -53,7 +53,7 @@ EOF

assert-sane-user-match() {
local user=$1
local count
local count
count=$(count-users "$user")
if (( count != 1 )); then
if (( count == 0 )); then
Expand All @@ -63,7 +63,7 @@ assert-sane-user-match() {
fi
fi
}

USER=$1
assert-sane-user-match "$USER"

Expand Down
3 changes: 1 addition & 2 deletions bin/publish-conf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@

# assert-chroot-exists
set -- "--confirm" "--match" "dgamelaunch.conf" "$@"
# shellcheck source=crawl-git.conf
source "$DGL_CONF_HOME/crawl-git.conf"
source "$DGL_CONF_HOME/bin/publish.sh"
3 changes: 1 addition & 2 deletions bin/publish-scripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@

# assert-chroot-exists
set -- "--confirm" "--skip" "dgamelaunch.conf" "$@"
# shellcheck source=crawl-git.conf
source "$DGL_CONF_HOME/crawl-git.conf"
source "$DGL_CONF_HOME/bin/publish.sh"
21 changes: 21 additions & 0 deletions bin/publish.pl
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,29 @@
[ 'utils/trigger-rebuild.pl', '//usr/lib/cgi-bin' ],
[ 'utils/webtiles', '//etc/init.d' ],
[ 'config.py', "/crawl-master/webserver" ],
[ 'config.yml', "/crawl-master/webserver" ],
[ 'games.d/*.{yml,yaml}', "/crawl-master/webserver/games.d" ],
[ 'banned_players.yml', "/crawl-master/webserver" ],
[ 'banned_players.txt', "/crawl-master/webserver" ],
[ 'chroot/data/menus/*.txt', "/dgldir/data/menus" ],
[ 'chroot/data/*.{rc,macro}', "/dgldir/data" ],
[ 'chroot/bin/*.sh', '/bin' ],
[ 'chroot/sbin/*.sh', '/sbin' ]);

# if a file is in this list, it will be ignored if it doesn't exist, rather
# than erroring. globs not expanded.
my @OPTIONAL_TARGETS = ('config.yml',
'banned_players.yml',
'banned_players.txt');
my @optional_skipped = ();

foreach my $targ ( @OPTIONAL_TARGETS ) {
if (! -e $targ) {
@COPY_TARGETS = grep($$_[0] !~ /\Q$targ/, @COPY_TARGETS);
push(@optional_skipped, $targ);
}
}

if ($OPT{match}) {
@COPY_TARGETS = grep($$_[0] =~ /\Q$OPT{match}/, @COPY_TARGETS);
}
Expand Down Expand Up @@ -120,6 +138,9 @@ ()
print("$index) $summary\n");
$dirty = 1 if change_exists($stat);
}
if (@optional_skipped > 0) {
print("Skipping optional files: @optional_skipped");
}
$dirty
}

Expand Down
1 change: 0 additions & 1 deletion bin/remove-trunks.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/bin/bash

sudo -H "$DGL_CHROOT/sbin/remove-trunks.sh" $*

1 change: 0 additions & 1 deletion bin/savegame-transfer-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,3 @@ for char in ${ALL_CHARS}
do
dgl savegame-transfer "${char}"
done

98 changes: 49 additions & 49 deletions chroot/bin/crawl-git-launcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# ===========================================================================
#

Expand Down Expand Up @@ -146,54 +146,54 @@ transfer-save() {
local game_hash=$2
local target="$CRAWL_GIT_DIR/$BINARY_BASE_NAME-$game_hash/$SAVES"
local src_save_dir=$(dirname $save)

wecho -n '{"msg":"show_dialog", "html":"'

if [[ -d "$target" ]]; then
# It's okay if moving the .prf fails (it might not exist one day).
mv "$src_save_dir/start-$CHAR_NAME-ns.prf" "$target" 2>/dev/null || true
mv -n "$src_save_dir/$CHAR_NAME".cs "$target"

if test $? -eq 0
then
if test $? -eq 0
then
wcat <<EOF
<p>Transferring successful!</p>
<input type='button' class='button' data-key=' ' value='Continue' style='float:right;'>
"}
EOF
cecho ": successful!"
cecho
OUR_GAME_HASH="${game_hash}"
cecho ": successful!"
cecho
OUR_GAME_HASH="${game_hash}"
cecho -n "--- any key to continue ---"
read -n 1 -t 5 -s
cecho
else
read -n 1 -t 5 -s
cecho
else
wcat <<EOF
<p>Transferring failed!</p>
<p>Transferring your save failed! Continuing with former version.</p>
<input type='button' class='button' data-key=' ' value='Continue' style='float:right;'>
"}
EOF
cecho ": failed!"
cecho
cecho "Transferring your save failed! Continuing with former version."
cecho ": failed!"
cecho
cecho "Transferring your save failed! Continuing with former version."
cecho -n "--- any key to continue ---"
read -n 1 -s
cecho
fi
read -n 1 -s
cecho
fi
else
wcat <<EOF
<p>Transferring failed!</p>
<p>Target version is corrupt! Continuing with former version.</p>
<input type='button' class='button' data-key=' ' value='Continue' style='float:right;'>
"}
EOF
cecho ": failed!"
cecho
cecho "Target version is corrupt! Continuing with former version."
cecho ": failed!"
cecho
cecho "Target version is corrupt! Continuing with former version."
cecho -n "--- any key to continue ---"
read -n 1 -s
cecho
read -n 1 -s
cecho
fi
wecho '{"msg":"hide_dialog"}'
}
Expand All @@ -217,19 +217,19 @@ if [[ -n "$SAVE" ]]; then
then
current_ver="$(hash-description $OUR_GAME_HASH)"
cecho "Hi, you have a $current_ver save game:"
cecho
cecho

OUR_SGV_MAJOR="$(major-version-for-game $OUR_GAME_HASH)"
NEW_GAME_HASH="$(newest-version-with-major-version $OUR_SGV_MAJOR)"
OUR_SGV_MAJOR="$(major-version-for-game $OUR_GAME_HASH)"
NEW_GAME_HASH="$(newest-version-with-major-version $OUR_SGV_MAJOR)"
new_ver="$(hash-description $NEW_GAME_HASH)"

if [[ "$OUR_GAME_HASH" != "$NEW_GAME_HASH" &&
"$TRANSFER_ENABLED" == "1" ]]; then
wecho '{"msg":"layer", "layer":"crt"}'
wecho -n '{"msg":"show_dialog", "html":"'

if [[ "${NEW_GAME_HASH}" != "${LATEST_GAME_HASH}" ]]; then
cecho "There's a newer version ($new_ver) that can load your save."
if [[ "${NEW_GAME_HASH}" != "${LATEST_GAME_HASH}" ]]; then
cecho "There's a newer version ($new_ver) that can load your save."
cecho -n "[T]ransfer your save to this version?"
wcat <<EOF
<p>There's a newer version ($new_ver) that can load your save.</p>
Expand All @@ -239,39 +239,39 @@ if [[ -n "$SAVE" ]]; then
"}
EOF
read -n 1 -s REPLY
cecho
else
cecho
else
cecho -n "[T]ransfer your save to the latest version ($new_ver)?"
wcat <<EOF
<p>[T]ransfer your save to the latest version ($new_ver)?</p>
<input type='button' class='button' data-key='N' value='No' style='float:right;'>
<input type='button' class='button' data-key='T' value='Yes' style='float:right;'>
"}
EOF
read -n 1 -s REPLY
cecho
fi
read -n 1 -s REPLY
cecho
fi
wecho '{"msg":"hide_dialog"}'

if test "$REPLY" = "t" -o "$REPLY" = "T" -o "$REPLY" = "y" -o "$REPLY" = "Y"
then
cecho -n "Transferring..."
if test "$REPLY" = "t" -o "$REPLY" = "T" -o "$REPLY" = "y" -o "$REPLY" = "Y"
then
cecho -n "Transferring..."
transfer-save "$SAVE" "$NEW_GAME_HASH"
fi
else
if test "${TRANSFER_ENABLED}" != "1"
then
cecho "Transfering of saves is currently disabled."
cecho "Finish your game or end your character to play in latest version."
else
cecho "Your save cannot be tranferred though because of incompatibility."
cecho "Finish your game or end your character to play in latest version."
fi
fi
else
if test "${TRANSFER_ENABLED}" != "1"
then
cecho "Transfering of saves is currently disabled."
cecho "Finish your game or end your character to play in latest version."
else
cecho "Your save cannot be tranferred though because of incompatibility."
cecho "Finish your game or end your character to play in latest version."
fi

cecho -n "--- any key to continue ---"
[[ -z "$WEBTILES" ]] && read -n 1 -t 5 -s
cecho
fi
[[ -z "$WEBTILES" ]] && read -n 1 -t 5 -s
cecho
fi
fi
else
OUR_GAME_HASH="${LATEST_GAME_HASH}"
Expand Down
4 changes: 2 additions & 2 deletions chroot/bin/crawl-stable-launcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# ===========================================================================
#

Expand Down
4 changes: 2 additions & 2 deletions chroot/bin/init-webtiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ NAME=$1
VERSIONS="git $(seq 25 25 | sed 's/^/0./')"

for v in $VERSIONS; do
cp --no-clobber "%%CHROOT_DGLDIR%%/data/crawl-$v-settings/init.txt" "%%CHROOT_RCFILESDIR%%/crawl-$v/$NAME.rc"
cp --no-clobber "%%CHROOT_DGLDIR%%/data/crawl-git.macro" "%%CHROOT_RCFILESDIR%%/crawl-$v/$NAME.macro"
cp --no-clobber "%%CHROOT_DGLDIR%%/data/crawl-$v-settings/init.txt" "%%CHROOT_RCFILESDIR%%/crawl-$v/$NAME.rc"
cp --no-clobber "%%CHROOT_DGLDIR%%/data/crawl-git.macro" "%%CHROOT_RCFILESDIR%%/crawl-$v/$NAME.macro"
done

cp --no-clobber "%%CHROOT_DGLDIR%%/data/crawl-dcssca-settings/init.txt" "%%CHROOT_RCFILESDIR%%/crawl-dcssca/$NAME.rc"
Expand Down
17 changes: 8 additions & 9 deletions chroot/bin/savegame-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# ===========================================================================
#

Expand Down Expand Up @@ -58,7 +58,7 @@ savedir-containing() {
local char="$1"
local -a saves
saves=($PREFIX/$BINARY_SAVE_NAME{,-*}/saves/$char{,-$USER_ID}.{cs,chr,sav})
local savefile
local savefile
savefile="$(first-existing-file "${saves[@]}")"
[[ -n "$savefile" ]] && dirname "$savefile"
return 0
Expand Down Expand Up @@ -131,14 +131,13 @@ if [[ -n "$SAVE_FOUND" && -f "$SAVE_FOUND" ]]; then

if test $? -ne 0
then
echo -e " ${C_RED}failed!${C_NORMAL}"
echo -e " ${C_RED}failed!${C_NORMAL}"
else
echo -e " ${C_GREEN}successful.${C_NORMAL}"
echo "- ${HTTP_LINK}/$TARNAME"
echo
echo "Please provide this link in your bug-report or give it to a developer."
echo -e " ${C_GREEN}successful.${C_NORMAL}"
echo "- ${HTTP_LINK}/$TARNAME"
echo
echo "Please provide this link in your bug-report or give it to a developer."
fi
else
echo "Your character ($CHAR_NAME) was not found in $SAVES."
fi

2 changes: 1 addition & 1 deletion chroot/data/menus/crawl-0.25.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ A)dvanced options

q) Return to main menu

=>
=>
2 changes: 1 addition & 1 deletion chroot/data/menus/crawl-0.25_adv.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ O) Reset options

q) Return to previous menu

=>
=>
2 changes: 1 addition & 1 deletion chroot/data/menus/crawl_git.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ A)dvanced options

q) Return to main menu

=>
=>
2 changes: 1 addition & 1 deletion chroot/data/menus/crawl_git_adv.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ O) Reset options

q) Return to previous menu

=>
=>
2 changes: 1 addition & 1 deletion chroot/data/menus/experimental.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ without warning: don't get too attached to your character. Thanks for helping
us evaluate potential new features!

q) Return to trunk menu
=>
=>
2 changes: 1 addition & 1 deletion chroot/data/menus/main_admin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ G) GoonCrawl
H) X-Crawl


=>
=>
Loading

0 comments on commit a177345

Please sign in to comment.